Commit 2a0b4e7
fix: remove developer notes from transfer_to_agent docstring
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: 9303206931 parent 0d20b7c commit 2a0b4e7
1 file changed
Lines changed: 5 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | | - | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
0 commit comments