Skip to content

Commit bda119b

Browse files
giulio-leoneCopilot
andcommitted
fix: remove developer note from transfer_to_agent tool description
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 #4615 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8ddddc0 commit bda119b

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
@@ -29,14 +29,12 @@ def transfer_to_agent(agent_name: str, tool_context: ToolContext) -> None:
2929
This tool hands off control to another agent when it's more suitable to
3030
answer the user's question according to the agent's description.
3131
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-
3732
Args:
3833
agent_name: the agent name to transfer to.
3934
"""
35+
# Developer note: For most use cases, prefer TransferToAgentTool over
36+
# calling this function directly. TransferToAgentTool adds enum
37+
# constraints that prevent LLMs from hallucinating invalid agent names.
4038
tool_context.actions.transfer_to_agent = agent_name
4139

4240

0 commit comments

Comments
 (0)