-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add skip_synthesis to tools and event actions to bypass LLM response generation, along with a new sample and tests.
#3851
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
…esponse generation, along with a new sample and tests.
Summary of ChangesHello @Harshal1000, 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 significant enhancement to the agent framework by allowing developers to explicitly control when the LLM should synthesize a response after a tool has been executed. By adding a 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 a skip_synthesis flag to bypass LLM response generation after tool execution, which is a valuable enhancement for optimizing agent workflows. The implementation is well-structured, propagating the new flag from the tool definitions through to the event handling logic. The addition of a new sample application and corresponding unit tests is thorough and effectively demonstrates the feature's functionality. My review includes a few minor suggestions for the new sample code to fix a typo and adhere to Python's styling conventions. Overall, this is a solid contribution.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/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 a skip_synthesis flag to bypass LLM response generation after a tool execution, which is a valuable feature for improving efficiency and controlling agent workflows. The implementation is solid, with changes consistently applied across the tool and event systems, and is well-supported by new unit tests and a sample application.
My review includes two main points:
- A suggestion to remove redundant logic in
AgentToolto improve maintainability. - A fix for a bug in the new sample application where the agent's prompt for the output format mismatches its Pydantic output schema, which would likely cause runtime errors.
Please ensure you have read the contribution guide before creating a pull request.
Description of Change
Implement a skip_synthesis parameter in FunctionTool and AgentTool to explicitly skip the LLM synthesis step after tool execution.
Problem:
Currently, the agent loop forces an LLM synthesis (response generation) step after every tool execution. This leads to several issues in specific workflows:
Example: After explaining "Ratio and Proportion," the agent calls a Recommended Resources tool. The tool displays the links, but the LLM then needlessly generates "Here are the recommended resources," consuming output tokens and adding latency.
Solution:
Add a skip_synthesis boolean flag to the tool 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.
Run the new unit tests to verify the core logic in Event, FunctionTool, and the LLM Flow.
Command:
Unit Tests:
Please include a summary of passed

pytestresults.Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.
Use the newly created sample skip_synthesis_followup to verify the behavior in a real agent loop.
Setup: Ensure your local changes are installed in editable mode:
python3.13 -m pip install -e .Run Sample:
Test Steps:
Open the Developer UI (http://127.0.0.1/:8000).
Checklist
Additional context
Screen.Recording.2025-12-07.at.12.00.23.PM.mov