Skip to content

Feat: Google Search Agent Tool#316

Open
AmaadMartin wants to merge 7 commits into
google:mainfrom
AmaadMartin:feat/google-search-agent-tool
Open

Feat: Google Search Agent Tool#316
AmaadMartin wants to merge 7 commits into
google:mainfrom
AmaadMartin:feat/google-search-agent-tool

Conversation

@AmaadMartin
Copy link
Copy Markdown
Collaborator

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

Problem: The built-in GoogleSearchTool cannot be used together with other tools in the same agent due to model limitations in Gemini 1.x. In adk-python, a workaround was implemented to automatically wrap the GoogleSearchTool in a specialized sub-agent (GoogleSearchAgentTool) when multiple tools are present, allowing it to function alongside others. This capability was missing in adk-js.

Solution: Ported the GoogleSearchAgentTool feature from adk-python to adk-js. This includes:

  • Automatic wrapping of GoogleSearchTool in GoogleSearchAgentTool when bypassMultiToolsLimit is true and multiple tools are present.
  • Propagation of grounding metadata from the sub-agent to the parent agent's session state.
  • Proper integration with the model override configuration.

Testing Plan

Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes.

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

I ran the specific test file core/test/tools/google_search_agent_tool_test.ts and all 13 tests passed.
Coverage for core/src/tools/google_search_agent_tool.ts and core/src/tools/google_search_tool.ts achieved 100%.

Integration Tests (Serving as Manual E2E):
An integration test was created at tests/integration/tools/google_search_agent_tool_test.ts to simulate the full flow of automatic wrapping and grounding metadata propagation using mocked responses. This test serves as the verification for the end-to-end behavior, as manual testing with live models was not performed.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

@AmaadMartin AmaadMartin force-pushed the feat/google-search-agent-tool branch from 0166981 to 72d74e5 Compare April 29, 2026 20:27
Comment thread core/src/agents/llm_agent.ts Outdated
const searchTool = toolUnion as unknown as GoogleSearchTool;
if (searchTool.bypassMultiToolsLimit) {
const {createGoogleSearchAgent, GoogleSearchAgentTool} =
await import('../tools/google_search_agent_tool.js');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not use inline imports

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the inline import

Amaad Martin added 6 commits May 12, 2026 09:28
- Implement GoogleSearchAgentTool to wrap search sub-agent.

- Implement automatic wrapping of GoogleSearchTool in LlmAgent when used with other tools.

- Add propagateGroundingMetadata support to AgentTool.

- Add comprehensive unit tests with 100% coverage for new code.
@AmaadMartin AmaadMartin force-pushed the feat/google-search-agent-tool branch from 1337815 to 50ac619 Compare May 12, 2026 16:34
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