Skip to content

fix: remove developer notes from transfer_to_agent docstring#4617

Open
stakeswky wants to merge 1 commit intogoogle:mainfrom
stakeswky:fix/transfer-to-agent-docstring-cleanup
Open

fix: remove developer notes from transfer_to_agent docstring#4617
stakeswky wants to merge 1 commit intogoogle:mainfrom
stakeswky:fix/transfer-to-agent-docstring-cleanup

Conversation

@stakeswky
Copy link

Summary

Fixes #4615

The transfer_to_agent function's docstring included a Note section with developer guidance about using TransferToAgentTool instead. Since this docstring is sent to the model as the tool description on every invocation, the extra text wastes input tokens and increases hallucination risk.

Before

description: "Transfer the question to another agent. This tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description. Note: For most use cases, you should use TransferToAgentTool instead of this function directly. TransferToAgentTool provides additional enum constraints that prevent LLMs from hallucinating invalid agent names. Args: agent_name: the agent name to transfer to."

After

description: "Transfer the question to another agent. Use this tool to hand off control to another agent that is more suitable to answer the user's question according to the agent's description. Args: agent_name: the agent name to transfer to."

Changes

  • src/google/adk/tools/transfer_to_agent_tool.py: Removed the Note section from the docstring, keeping only the model-facing description and Args.

Testing

All 9 existing tests in test_transfer_to_agent_tool.py pass, including test_transfer_to_agent_tool_preserves_description which validates the tool description content.

The function docstring included a Note section with developer guidance
about using TransferToAgentTool instead. Since this docstring is sent
to the model as the tool description on every invocation, the extra
text wastes input tokens and increases hallucination risk.

Removed the Note section while keeping the user-facing description
and Args documentation intact.

Fixes google#4615
@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@google-cla
Copy link

google-cla bot commented Feb 25, 2026

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.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Feb 25, 2026
@stakeswky stakeswky force-pushed the fix/transfer-to-agent-docstring-cleanup branch from 91c0ea6 to 404cb23 Compare February 25, 2026 04:16
@ryanaiagent ryanaiagent self-assigned this Feb 26, 2026
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.

Change the docstring for the transfer_to_agent tool to remove unneeded information sent to the model.

3 participants