Skip to content

Commit 8bc5237

Browse files
committed
fix: clean up transfer_to_agent docstring to reduce token waste
Move developer-facing note from the docstring to a code comment above the function. The docstring is sent to the model on every tool call, so keeping it lean reduces token usage and lowers hallucination risk. Fixes #4615
1 parent d47e4c6 commit 8bc5237

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/google/adk/tools/transfer_to_agent_tool.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@
2323
from .tool_context import ToolContext
2424

2525

26+
# Note: For most use cases, you should use TransferToAgentTool instead of this
27+
# function directly. TransferToAgentTool provides additional enum constraints
28+
# that prevent LLMs from hallucinating invalid agent names.
2629
def transfer_to_agent(agent_name: str, tool_context: ToolContext) -> None:
2730
"""Transfer the question to another agent.
2831
2932
This tool hands off control to another agent when it's more suitable to
3033
answer the user's question according to the agent's description.
3134
32-
Note:
33-
For most use cases, you should use TransferToAgentTool instead of this
34-
function directly. TransferToAgentTool provides additional enum constraints
35-
that prevent LLMs from hallucinating invalid agent names.
36-
3735
Args:
3836
agent_name: the agent name to transfer to.
3937
"""

0 commit comments

Comments
 (0)