-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: implement enterprise search agent tool and related functionality #3544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
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. |
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
22efa99 to
8387ff5
Compare
|
/gemini review |
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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.
|
Hi @m-baden , Thank you for your work on this pull request. We appreciate the effort you've invested. |
refactor: remove unnecessary blank line in test_enterprise_search_agent_tool.py
|
Hi @ryanaiagent, thanks for taking the time to look into it. The lint errors are fixed now. |
|
Hi @m-baden , |
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Testing Plan
Unit Tests:
A new test file
tests/unittests/tools/test_enterprise_search_agent_tool.pyhas 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.
Manual End-to-End (E2E) Tests:
Manual E2E tests were performed using the following agent definition:
Manual E2E tests were also performed with an agent using a custom tool alongside the Google Search Tool:
These tests confirmed that the

GoogleSearchToolcan be used alongside other custom tools whenbypass_multi_tools_limit=Trueis set.The agent was run with various queries to ensure that both
EnterpriseWebSearchToolandGoogleSearchToolare correctly invoked and their results are processed as expected. Thebypass_multi_tools_limit=Trueparameter was verified to allow both tools to be used simultaneously.Checklist
Additional context
This PR is similar to d3148da