fix: remove developer notes from transfer_to_agent docstring#4617
fix: remove developer notes from transfer_to_agent docstring#4617stakeswky wants to merge 2 commits into
Conversation
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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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. |
91c0ea6 to
404cb23
Compare
|
Hi @stakeswky , Thank you for your contribution! We appreciate you taking the time to submit this pull request. 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. |
|
Hi @xuanyang15 , can you please review this. |
Signed-off-by: stakeswky <stakeswky@gmail.com>
ca8ae7b to
4c78693
Compare
Merge #4617 ## 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. Co-authored-by: Bo Yang <ybo@google.com> COPYBARA_INTEGRATE_REVIEW=#4617 from stakeswky:fix/transfer-to-agent-docstring-cleanup 4c78693 PiperOrigin-RevId: 930320693
|
Thank you @stakeswky for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 2a0b4e7. Closing this PR as the changes are now in the main branch. |
Summary
Fixes #4615
The
transfer_to_agentfunction's docstring included aNotesection with developer guidance about usingTransferToAgentToolinstead. 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
After
Changes
src/google/adk/tools/transfer_to_agent_tool.py: Removed theNotesection from the docstring, keeping only the model-facing description and Args.Testing
All 9 existing tests in
test_transfer_to_agent_tool.pypass, includingtest_transfer_to_agent_tool_preserves_descriptionwhich validates the tool description content.