-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Feature Request] Support grounding metadata propagation to root agent when routing between multiple VertexAiSearchTool instances #4671
Description
This issue is a follow-up to the discussion and findings in Issue #3406 (cc: @xuanyang15).
🔴 Required Information
Is your feature request related to a specific problem?
Yes. I am trying to use multiple VertexAiSearchTool instances (e.g., one for structured data, one for unstructured data) in a single agent so the LLM can dynamically route user queries to the appropriate datastore.
Because the built-in tool's name is hardcoded to vertex_ai_search, the LLM treats all instances as a single tool and cannot route queries. When I try the workaround of wrapping them in sub-agents via a custom AgentTool (to give them distinct names and descriptions for routing), the routing works perfectly, but the grounding metadata (citations) is lost when returning to the root agent.
Describe the Solution You'd Like
I would like the root agent to be able to successfully merge and retain grounding metadata propagated from a sub-agent, so that citations are correctly displayed in the final response (e.g., in the ADK Web UI).
Alternatively, providing an official VertexAiSearchAgentTool that handles this metadata propagation out-of-the-box (similar to GoogleSearchAgentTool) would perfectly solve this.
Impact on your work
This is a major blocker for our use case. Our goal is to build a single smart agent that can route queries to the correct Vertex AI Datastore while strictly providing grounded answers with citations. Without metadata propagation from sub-agents, we are forced to choose between "intelligent routing" and "retaining citations," as we cannot achieve both simultaneously.
Willingness to contribute
No
🟡 Recommended Information
Describe Alternatives You've Considered
- Attempt 1: All tools in the root agent. * Why it failed: Built-in tools do not accept custom names. The LLM cannot distinguish between the datastores, making dynamic routing impossible.
- Attempt 2: Custom
AgentToolpropagating metadata (Suggested in Issue with structured VertexAI datastores when using multiple instances of VertexAiSearchTool in the same agent #3406). * Why it failed: Following@xuanyang15's advice, I created a customMetadataPropagatingAgentToolbased onGoogleSearchAgentTool, addingtool_context.state['temp:_adk_grounding_metadata'] = last_grounding_metadata. While local debug logs confirmed the sub-agent successfully queries the right datastore and retrieves the metadata, the root agent fails to merge this metadata into the final response. The citations are missing in the UI, and the root LLM lacks the context of the retrieved documents (it cannot answer "Which document did you refer to?").
Proposed API / Implementation
Update the root agent's response generation logic (or artifact service) to respect and merge grounding metadata returned from sub-agent tool executions, ensuring it gets passed down to the final UI response.
Additional Context
- ADK Version: v1.25.0
- Model: gemini-3-flash-preview