Skip to content

fix(tools): forward custom name and description from VertexAiSearchTool bypass path to DiscoveryEngineSearchTool - #7123

Open
musi22 wants to merge 1 commit into
google:mainfrom
musi22:fix-search-tool-custom-naming
Open

musi22 wants to merge 1 commit into
google:mainfrom
musi22:fix-search-tool-custom-naming

Conversation

@musi22

@musi22 musi22 commented Sep 15, 2026

Copy link
Copy Markdown

Description

Addresses Problem 3 identified in #7100.

When bypass_multi_tools_limit=True is enabled on VertexAiSearchTool, ADK converts the tool to a client-side DiscoveryEngineSearchTool during canonical tool resolution. Previously, this conversion always named the resulting tool 'discovery_engine_search' -- an internal implementation detail.

This caused two key problems for developers:

  1. Instruction coupling: Agents had to reference 'discovery_engine_search' explicitly in prompts rather than domain concepts like 'product_search' or 'knowledge_base'.
    1. Runtime crashes: Lightweight or third-party LLMs frequently guess natural tool names (like search or query) instead of discovery_engine_search, leading to ValueError: Tool '...' not found.
      While DiscoveryEngineSearchTool already supported name and description parameters, they were unreachable through the VertexAiSearchTool conversion path.

Changes

  • Added optional name and description parameters to VertexAiSearchTool.__init__.
  • Stored them internally as _bypass_tool_name and _bypass_tool_description to avoid shadowing BaseTool.name = 'vertex_ai_search' (preserving backward compatibility with the built-in grounding path).
  • Forwarded name and description during bypass conversion in llm_agent.py.
  • Added 5 unit tests in tests/unittests/agents/test_llm_agent_fields.py.
  • Added 4 unit tests in tests/unittests/tools/test_discovery_engine_search_tool.py.

Related Issues

Testing Plan

  • Ran unit tests for DiscoveryEngineSearchTool (pytest tests/unittests/tools/test_discovery_engine_search_tool.py) -- 31/31 passed.
    -[x] Ran unit tests for VAIS tool conversion (pytest tests/unittests/agents/test_llm_agent_fields.py -k "vais") -- 10/10 passed.

@google-cla

google-cla Bot commented Sep 15, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

…ypass path to DiscoveryEngineSearchTool

When bypass_multi_tools_limit=True converts VertexAiSearchTool to a
client-side DiscoveryEngineSearchTool, the resulting tool was always
named 'discovery_engine_search' — an internal implementation name.
Developers had no way to express a domain-specific tool name, forcing
them to leak GCP internals into agent instructions or accept runtime
ValueError: Tool 'search' not found crashes.

DiscoveryEngineSearchTool already accepted name/description params but
they were unreachable through the conversion path.

- Add optional name/description kwargs to VertexAiSearchTool.__init__
  stored as _bypass_tool_name/_bypass_tool_description to never shadow
  the base-class 'vertex_ai_search' name used in the grounding path
- Forward them in llm_agent.py during the bypass conversion
- Add 5 unit tests for the agent conversion path
- Add 4 unit tests for DiscoveryEngineSearchTool constructor

Fixes: google#7100 (partial — addresses problem 3, hardcoded tool naming)
Related: google#7101
@musi22
musi22 force-pushed the fix-search-tool-custom-naming branch from 18b4a3c to a25cde5 Compare September 15, 2026 17:58
@musi22

musi22 commented Sep 15, 2026

Copy link
Copy Markdown
Author

@googlebot I signed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants