Skip to content

fix: remove developer note from transfer_to_agent tool description#4731

Open
giulio-leone wants to merge 1 commit intogoogle:mainfrom
giulio-leone:fix/transfer-to-agent-docstring
Open

fix: remove developer note from transfer_to_agent tool description#4731
giulio-leone wants to merge 1 commit intogoogle:mainfrom
giulio-leone:fix/transfer-to-agent-docstring

Conversation

@giulio-leone
Copy link

The transfer_to_agent tool's description contains internal developer notes that get passed to the LLM as part of the tool schema. This can confuse models and waste tokens.

This PR cleans up the description to only include user-facing information.

Supersedes #4654 (closed due to CLA issue, now resolved).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 refines the transfer_to_agent tool's description by excising internal developer-centric notes. The modification aims to enhance the clarity of the tool's schema when presented to Large Language Models, thereby preventing misinterpretations and reducing unnecessary token consumption during LLM interactions.

Highlights

  • Tool Description Cleanup: Removed internal developer notes from the transfer_to_agent tool's description to prevent confusion for Large Language Models (LLMs) and optimize token usage.
  • Improved LLM Interaction: Relocated the developer note from the tool's docstring to an inline code comment, ensuring only user-facing information is exposed to LLMs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/google/adk/tools/transfer_to_agent_tool.py
    • Moved a developer note from the function's docstring to an inline code comment.
Activity
  • Pull request created by giulio-leone.
  • No human activity (comments, reviews) recorded yet.
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 Mar 6, 2026
@adk-bot
Copy link
Collaborator

adk-bot commented Mar 6, 2026

Response from ADK Triaging Agent

Hello @giulio-leone, thank you for creating this PR!

Could you please include a testing plan section in your PR to describe how you tested your changes? This will help reviewers to review your PR more efficiently. Thanks!

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 correctly moves a developer-facing note from the transfer_to_agent function's docstring to an inline code comment. This change prevents the note from being part of the tool's schema sent to the LLM, which avoids potential confusion and token wastage, as described in the pull request. The implementation is clean and effectively resolves the stated issue.

@giulio-leone giulio-leone force-pushed the fix/transfer-to-agent-docstring branch from 707df76 to f837afa Compare March 6, 2026 16:13
The docstring of transfer_to_agent() included a 'Note:' section with
developer-facing advice about preferring TransferToAgentTool. Since
FunctionTool uses the full docstring as the tool description sent to
the model on every invocation, this note was consuming input tokens
and adding irrelevant information to the model context.

Move the note to an inline comment in the function body so it remains
visible to developers but is not included in the tool description.

Fixes google#4615
@giulio-leone giulio-leone force-pushed the fix/transfer-to-agent-docstring branch from f837afa to fe7ed77 Compare March 6, 2026 17:14
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.

2 participants