Skip to content

Conversation

@m-baden
Copy link

@m-baden m-baden commented Nov 13, 2025

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Testing Plan

Unit Tests:

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

A new test file tests/unittests/tools/test_enterprise_search_agent_tool.py has been added to test the new functionality. The tests are passing.

All unit tests were run. There are some collection errors that are unrelated to this change.

$ pytest tests/unittests
================================================= 3182 passed, 2410 warnings in 35.24s ==================================================

Manual End-to-End (E2E) Tests:

Manual E2E tests were performed using the following agent definition:

from google.adk.agents.llm_agent import Agent
from google.adk.tools.enterprise_search_tool import EnterpriseWebSearchTool
from google.adk.tools.google_search_tool import GoogleSearchTool


root_agent = Agent(
    model='gemini-2.5-flash',
    name='root_agent',
    description="A helpful assistant that can use tools",
    instruction="You are a helpful assistant. Always use both search tools to answer user queries.",
    tools=[EnterpriseWebSearchTool(
        bypass_multi_tools_limit=True), GoogleSearchTool(bypass_multi_tools_limit=True)],
)
image

Manual E2E tests were also performed with an agent using a custom tool alongside the Google Search Tool:

from google.adk.agents.llm_agent import Agent
from google.adk.tools.enterprise_search_tool import EnterpriseWebSearchTool

def get_current_time(city: str) -> dict:
    """Returns the current time in a specified city."""
    return {"status": "success", "city": city, "time": "10:30 AM"}

root_agent = Agent(
    model='gemini-2.5-flash',
    name='root_agent',
    description="A helpful assistant that can use tools",
    instruction="You are a helpful assistant. Always use both search tools to answer user queries.",
    tools=[get_current_time, GoogleSearchTool(bypass_multi_tools_limit=True)],
)

These tests confirmed that the GoogleSearchTool can be used alongside other custom tools when bypass_multi_tools_limit=True is set.
image

The agent was run with various queries to ensure that both EnterpriseWebSearchTool and GoogleSearchTool are correctly invoked and their results are processed as expected. The bypass_multi_tools_limit=True parameter was verified to allow both tools to be used simultaneously.

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.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

This PR is similar to d3148da

@google-cla
Copy link

google-cla bot commented Nov 13, 2025

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @m-baden, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new EnterpriseSearchAgentTool and related functionality to address a limitation preventing the EnterpriseWebSearchTool from being used with other tools simultaneously. By implementing a sub-agent wrapper and a bypass_multi_tools_limit flag, agents can now leverage enterprise search capabilities alongside other custom or built-in tools. The changes also integrate the new enterprise search agent into the grounding metadata processing, ensuring proper context handling.

Highlights

  • New Enterprise Search Agent Tool: Introduced EnterpriseSearchAgentTool and create_enterprise_search_agent to enable the EnterpriseWebSearchTool to function alongside other tools.
  • Bypass Multi-Tool Limitation: The EnterpriseWebSearchTool now includes a bypass_multi_tools_limit parameter, allowing it to be used concurrently with other tools by wrapping it in a sub-agent.
  • Grounding Metadata Integration: The system's grounding metadata logic has been extended to recognize and process the enterprise_search_agent for improved context.
  • Comprehensive Testing: New unit tests have been added for the EnterpriseSearchAgentTool, and extensive manual end-to-end tests were performed to validate the new functionality and the bypass_multi_tools_limit feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Nov 13, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the EnterpriseWebSearchTool and its corresponding EnterpriseSearchAgentTool as a workaround for multi-tool limitations, which aligns with existing patterns for other search tools in the codebase. The implementation is generally sound and includes new unit tests. However, I've identified a significant code duplication issue between the new EnterpriseSearchAgentTool and the existing GoogleSearchAgentTool. I've recommended a refactoring to introduce a shared base class to address this, which will enhance maintainability. Additionally, I've pointed out a minor copy-paste error in a docstring and an opportunity for code simplification.

@m-baden m-baden force-pushed the main branch 2 times, most recently from 22efa99 to 8387ff5 Compare November 13, 2025 23:49
@m-baden
Copy link
Author

m-baden commented Nov 14, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the EnterpriseWebSearchTool and a mechanism to allow it to be used alongside other tools, which is a great enhancement. The implementation follows the pattern established for GoogleSearchTool, including creating a sub-agent and a wrapper tool (EnterpriseSearchAgentTool). The refactoring of common logic into a _SearchAgentTool base class is a good move to reduce code duplication.

My review includes a few suggestions to improve documentation, code cleanliness, and test coverage. Specifically, I've pointed out a minor inaccuracy in a docstring, a redundant import, a suggestion to refactor duplicated logic for handling tool workarounds, and an opportunity to strengthen the unit tests for the new search agent tool.

@m-baden
Copy link
Author

m-baden commented Nov 14, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the EnterpriseSearchAgentTool and related functionality, which is a great addition. The refactoring to create a _SearchAgentTool base class is well-executed and significantly improves code maintainability by reducing duplication between GoogleSearchAgentTool and the new EnterpriseSearchAgentTool. The new tests for the enterprise search agent tool are also comprehensive.

I've identified a couple of potential issues related to the management of temporary state for grounding metadata, which could lead to data leakage between agent turns or incorrect state propagation to sub-agents. My review comments provide more details and suggestions for addressing these.

Overall, this is a solid contribution. Addressing the state management concerns will make it even more robust.

@ryanaiagent ryanaiagent self-assigned this Nov 14, 2025
@ryanaiagent ryanaiagent added the awaiting-user-response Waiting for the issue author to provide necessary information (stale bot workflow) label Nov 14, 2025
@ryanaiagent
Copy link
Collaborator

Hi @m-baden , Thank you for your work on this pull request. We appreciate the effort you've invested.
Can you please fix lint errors. You can run autoformat.sh

refactor: remove unnecessary blank line in test_enterprise_search_agent_tool.py
@m-baden
Copy link
Author

m-baden commented Nov 14, 2025

Hi @ryanaiagent, thanks for taking the time to look into it. The lint errors are fixed now.

@ryanaiagent
Copy link
Collaborator

Hi @m-baden ,
Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@ryanaiagent ryanaiagent removed the awaiting-user-response Waiting for the issue author to provide necessary information (stale bot workflow) label Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support using enterprise_web_search built-in tool with other tools in the same agent

3 participants