`bypass_multi_tools_limit` on `VertexAiSearchTool` is a leaky abstraction: unexpected dependencies, silent shift from inbuilt RAG to tool calling, and prompt fragility
Maintainer thường phản hồi trong vòng 5 ngày
@llalitkumarrr đang làm issue này rồi.
Từ ngày 14/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
The bypass_multi_tools_limit=True flag on VertexAiSearchTool is presented as a convenient boolean toggle to allow using Vertex AI Search alongside other tools. In practice, this flag is implemented as a hidden class replacement (VertexAiSearchTool → DiscoveryEngineSearchTool) that breaks the developer experience in three major ways:
- Unexpected runtime dependency: Silently requires
google-cloud-discoveryengine(google-adk[gcp]), failing at runtime with aModuleNotFoundError. - Silent shift from inbuilt RAG to client tool calling: Transparent, citation-backed model retrieval is secretly replaced with an explicit client-side function call.
- Hardcoded tool naming and prompt fragility: The substituted tool is hardcoded as
discovery_engine_search. Because developers write instructions for their domain (e.g., "use the knowledge base"), the model naturally hallucinates callingsearch(...)instead, causing runtime crashes (ValueError: Tool 'search' not found).
This breaks the illusion that setting bypass_multi_tools_limit=True is a clean, seamless configuration switch.
Minimal Reproduction
Consider a minimal agent combining a knowledge base search with a single custom helper function:
from google.adk.agents import Agent
from google.adk.tools import VertexAiSearchTool
def get_user_tier() -> str:
"""Returns the loyalty tier of the current user."""
return "Platinum"
search_tool = VertexAiSearchTool(
data_store_id="projects/my-project/locations/global/collections/default_collection/dataStores/my-store",
max_results=10,
bypass_multi_tools_limit=True,
)
agent = Agent(
name="support_agent",
model="gemini-flash-lite-latest",
static_instruction="You are a helpful support assistant. Answer user questions using the knowledge base.",
tools=[search_tool, get_user_tier],
)
The Issues
1. Undeclared Runtime Dependency (google-adk[gcp])
When bypass_multi_tools_limit=False (or when the agent has only one tool), VertexAiSearchTool works with the base google-adk package using the Gemini API's built-in grounding (types.Tool(retrieval=...)).
However, the moment a second tool is added and bypass_multi_tools_limit=True is set, ADK's internal resolver (llm_agent.py) silently swaps VertexAiSearchTool for DiscoveryEngineSearchTool. This class imports google.cloud.discoveryengine, immediately crashing with:
ModuleNotFoundError: No module named 'google.cloud.discoveryengine'
There is no warning at agent instantiation time indicating that setting this flag requires the [gcp] extra.
2. Silent Paradigm Shift: Inbuilt RAG Grounding → Tool Calling
Developers choose VertexAiSearchTool because it integrates natively with Gemini's retrieval capability:
- Grounding happens transparently inside the model generation turn.
- The model returns grounded responses with citations and
groundingMetadata. - The model does not need to decide whether to execute a function call, construct JSON arguments, or wait for a second inference round-trip.
Flipping bypass_multi_tools_limit=True quietly transforms this into a client-side function calling tool:
- The model must now generate a structured tool call.
- A local API client executes an RPC to Discovery Engine.
- The raw JSON results are piped back into the conversation context for a second LLM turn.
This fundamental architectural shift is completely hidden behind what appears to be a minor transport flag.
3. Leaky Tool Naming & Prompt Fragility (discovery_engine_search)
In discovery_engine_search_tool.py, the substituted tool inherits from FunctionTool and registers self.discovery_engine_search:
class DiscoveryEngineSearchTool(FunctionTool):
def __init__(self, ...):
super().__init__(self.discovery_engine_search)
This creates two critical problems:
- The name cannot be customized: The function name is hardcoded to
"discovery_engine_search"with the docstring"Search through Vertex AI Search's discovery engine search API."NeitherVertexAiSearchToolnorDiscoveryEngineSearchToolaccepts anameordescriptionparameter. - The model fails to call it: Prompts written naturally (e.g. "Answer user questions using the knowledge base") give the model no reason to suspect the tool is called
discovery_engine_search. LLMs (especially lightweight models likegemini-flash-lite) guess generic names likesearch(query=...), leading directly to:ValueError: Tool 'search' not found. Available tools: discovery_engine_search, get_user_tier
To make the agent work, developers are forced to leak internal Google Cloud plumbing into user-facing prompts:
"Answer user questions using the knowledge base by calling discovery_engine_search."
Suggested Improvements
-
Allow Custom Tool Naming and Description:
IfVertexAiSearchToolis going to be transformed into a clientFunctionTool, it must acceptnameanddescriptionparameters (e.g.,name="knowledge_base_search"), forwarding them toDiscoveryEngineSearchToolso the tool declaration matches the domain instructions. -
Handle Common Name Aliases / Fuzzy Resolution:
WhenDiscoveryEngineSearchToolis the only search tool present, ADK should either registersearchas an alias or allow flexible resolution rather than failing with a hardValueError. -
Explicit Tooling over Magic Flags:
Rather than hiding a completely different execution model and dependency set behindbypass_multi_tools_limit=True, consider deprecating the flag in favor of:- Providing
DiscoveryEngineSearchTooldirectly as a first-class, documented tool when client-side search is desired. - Documenting the sub-agent pattern (
AgentTool/sub_agents) as the recommended architectural pattern when combining native search retrieval grounding with function tools.
- Providing
-
Fail Fast with Clear Dependency Errors:
Ifbypass_multi_tools_limit=Trueis used withoutgoogle-cloud-discoveryengineinstalled, raise a clear error duringAgent.__init__instructing the user to installgoogle-adk[gcp].
- Ngôn ngữ chính
- Python
- Star
- 21.6k
- Fork
- 4k
- Merge trung bình
- 9 giờ 59 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/adk-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
google/adk-python#7385 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
google/adk-python#7381 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[A2A] RemoteA2aAgent(use_legacy=False): extension header written to state['http_kwargs'], ignored by a2a-sdk 1.x transportsCó thể đã có người làm @surajksharma07 đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
google/adk-python#7334 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 5 ngày
-
GoogleOidcVerifier treats string "false" as a verified email claimCó thể đã có người làm @surajksharma07 đã nhận 4 ngày trước. Đang mởcore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
google/adk-python#7289 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 5 ngày
-
RestApiTool raises uncaught KeyError when a required path param is omittedCó thể đã có người làm @llalitkumarrr đã nhận 4 ngày trước. Đang mởrequest clarification tools
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
google/adk-python#7282 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của google/adk-python
Issue tương tự
-
tool-calling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
vllm-project/vllm#59838 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
raullenchai/Rapid-MLX#4042 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
transitmatters/mbta-slow-zone-bot#70 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
litestar-org/advanced-alchemy#811 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày