Skip to content

Expose agentic retrieval via MCP and HTTP service endpoints - #2416

Merged
mahikaw merged 5 commits into
mainfrom
dev/mahikaw/mcp-agentic-query
Aug 5, 2026
Merged

Expose agentic retrieval via MCP and HTTP service endpoints#2416
mahikaw merged 5 commits into
mainfrom
dev/mahikaw/mcp-agentic-query

Conversation

@mahikaw

@mahikaw mahikaw commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Add server-owned AgenticConfig and thin service adapters so existing agentic_query_documents() can run in service mode without changing AgenticRetriever internals.

  • Expose POST /v1/agentic/query on the VectorDB app (execution) and gateway proxy; add config-gated MCP tool agentic_query alongside unchanged plain query.

  • Wire Helm/retriever-service.yaml so gateway gets enablement + timeout from ConfigMap, and the VectorDB deployment gets --agentic* CLI flags + API key when a remote LLM URL is set.

  • Service mode requires remote invoke_url + llm_model (and remote embed); request body stays {query, top_k} with server-owned ReAct knobs. Hits remain slim (rank / doc_id / result_source).

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mahikaw
mahikaw requested review from a team as code owners July 30, 2026 23:11
@mahikaw
mahikaw requested a review from charlesbluca July 30, 2026 23:11
@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment thread nemo_retriever/src/nemo_retriever/service/vectordb_app.py Outdated
Comment thread nemo_retriever/src/nemo_retriever/service/query_schema.py Outdated
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds server-configured agentic retrieval to the existing query service.

  • Exposes agentic execution through /v1/query and an optional MCP tool.
  • Adds dedicated VectorDB workers and admission control for long-running ReAct queries.
  • Wires agentic model, endpoint, tuning, timeout, and credential settings through service and Helm configuration.
  • Adds request validation, result-envelope mapping, documentation, and service/MCP tests.

Confidence Score: 4/5

The PR is not yet safe to merge because distinct embedding and LLM credentials remain unsupported and oversized agentic requests are still buffered by the gateway before validation.

The agentic workflow resolves one embedding credential and sends it to both upstream authentication domains, while the gateway materializes and forwards the complete request body before the VectorDB applies the new query-length constraint; the dedicated worker-slot and schema-limit fixes otherwise address their reported failures.

Files Needing Attention: nemo_retriever/src/nemo_retriever/query/workflow.py, nemo_retriever/src/nemo_retriever/service/config.py, nemo_retriever/src/nemo_retriever/service/routers/ingest.py

Important Files Changed

Filename Overview
nemo_retriever/src/nemo_retriever/query/workflow.py Adds explicit embedding-key resolution, but the same credential remains assigned to the independent LLM client.
nemo_retriever/src/nemo_retriever/service/vectordb_app.py Adds dedicated agentic worker capacity whose semaphore follows the underlying future lifetime rather than the HTTP request lifetime.
nemo_retriever/src/nemo_retriever/service/routers/ingest.py Adds agentic routing and timeout selection, while the gateway continues buffering raw query bodies before downstream validation.
nemo_retriever/src/nemo_retriever/service/query_schema.py Adds agentic-only shape, format, non-empty-string, and 4096-character validation.
nemo_retriever/src/nemo_retriever/service/agentic_query.py Adds the service adapter that constructs workflow requests and maps document-level rankings into the existing hits envelope.
nemo_retriever/src/nemo_retriever/service/mcp_server.py Adds a configuration-gated agentic MCP tool with a dedicated long request timeout.
nemo_retriever/helm/templates/deployment-vectordb.yaml Wires agentic CLI settings and secret-backed API-key environment configuration into the VectorDB deployment.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Gateway
    participant VectorDB
    participant Pool as Agentic worker pool
    participant Embed as Embedding endpoint
    participant LLM as LLM endpoint

    Client->>Gateway: "POST /v1/query {agentic: true}"
    Gateway->>VectorDB: Forward query body
    VectorDB->>Pool: Admit and submit ReAct workflow
    Pool->>Embed: Embed retrieval queries
    Pool->>LLM: ReAct and selection calls
    Pool-->>VectorDB: Ranked document IDs
    VectorDB-->>Gateway: Standard hits envelope
    Gateway-->>Client: Query response
Loading

Reviews (7): Last reviewed commit: "review fix" | Re-trigger Greptile

Comment thread nemo_retriever/src/nemo_retriever/query/workflow.py
Comment thread nemo_retriever/src/nemo_retriever/service/query_schema.py Outdated
Comment thread nemo_retriever/src/nemo_retriever/service/query_schema.py Outdated
Comment thread nemo_retriever/src/nemo_retriever/service/vectordb_app.py Outdated
Comment thread nemo_retriever/src/nemo_retriever/service/routers/ingest.py Outdated
Comment thread nemo_retriever/src/nemo_retriever/service/agentic_query.py Outdated
@mahikaw
mahikaw force-pushed the dev/mahikaw/mcp-agentic-query branch from 311108e to 9d8201f Compare August 5, 2026 18:54
@mahikaw
mahikaw merged commit 97f80a4 into main Aug 5, 2026
8 of 9 checks passed
@mahikaw
mahikaw deleted the dev/mahikaw/mcp-agentic-query branch August 5, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants