From 854a5440614590c2a3466cf652688ba57d637205 Mon Sep 17 00:00:00 2001 From: Alankrit Verma Date: Thu, 29 May 2025 16:56:54 -0700 Subject: [PATCH] fix(transfer_to_agent): update docstring for clarity and accuracy Copybara import of the project: -- e246af5965dfd4d032e0a3ce29513f3e2e874f73 by Alankrit Verma : tools: allow transfer_to_agent to accept extra kwargs transfer_to_agent now takes **kwargs to swallow unexpected keyword args Added integration tests covering single and multiple extra kwargs. Fixes #458. -- 55fea786a9b7eb19b830dc67d7a2e37fe7937608 by Alankrit Verma : fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d777bd4f3d8951dadd5e4e105530bd6281 by Alankrit Verma : fix(transfer_to_agent): restore strict two-arg signature and clarify usage Revert the earlier **kwargs change so transfer_to_agent again only accepts (agent_name, tool_context). Improve the doc-string to make clear that no other parameters should be passed to this tool. Fixes #458 -- d37448dd0ef9fc6199ca0e42b211b3cd9c886eb0 by Alankrit Verma : fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af78fc2c9abdf030ad50e24bba8c996df75 by Wei Sun (Jack) : Update transfer_to_agent_tool docstring for better prompt -- a144069a67b2e5652ffd50224b1ce68ddea14783 by Wei Sun (Jack) : Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436457e3141d128c6e81452fddc546a14a7e PiperOrigin-RevId: 764940463 --- src/google/adk/tools/transfer_to_agent_tool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/google/adk/tools/transfer_to_agent_tool.py b/src/google/adk/tools/transfer_to_agent_tool.py index b791a25..6d2a5a9 100644 --- a/src/google/adk/tools/transfer_to_agent_tool.py +++ b/src/google/adk/tools/transfer_to_agent_tool.py @@ -16,5 +16,12 @@ from .tool_context import ToolContext def transfer_to_agent(agent_name: str, tool_context: ToolContext): - """Transfer the question to another agent.""" + """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. + + Args: + agent_name: the agent name to transfer to. + """ tool_context.actions.transfer_to_agent = agent_name