-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore: refines transfer_to_agent docstring for more stable agent transfer stability. #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refines transfer_to_agent docstring for more stable agent transfer stability. #466
Conversation
transfer_to_agent now takes **kwargs to swallow unexpected keyword args Added integration tests covering single and multiple extra kwargs. Fixes google#458.
Thanks for the PR! But I think this is not the way to go. Model shouldn't be passing A better approach could be improving the docstring, which will be in the prompt. |
…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 google#458
Thanks @Jacksunwei for the feedback! I’ve removed the |
Copybara import of the project: -- e246af5 by Alankrit Verma <[email protected]>: 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. -- 55fea78 by Alankrit Verma <[email protected]>: fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d by Alankrit Verma <[email protected]>: 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 -- d37448d by Alankrit Verma <[email protected]>: fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af by Wei Sun (Jack) <[email protected]>: Update transfer_to_agent_tool docstring for better prompt -- a144069 by Wei Sun (Jack) <[email protected]>: Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=#466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436 PiperOrigin-RevId: 764940463
merged in 854a544. Thanks! |
Copybara import of the project: -- e246af5 by Alankrit Verma <[email protected]>: 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 google#458. -- 55fea78 by Alankrit Verma <[email protected]>: fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d by Alankrit Verma <[email protected]>: 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 google#458 -- d37448d by Alankrit Verma <[email protected]>: fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af by Wei Sun (Jack) <[email protected]>: Update transfer_to_agent_tool docstring for better prompt -- a144069 by Wei Sun (Jack) <[email protected]>: Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=google#466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436 PiperOrigin-RevId: 764940463
Copybara import of the project: -- e246af5 by Alankrit Verma <[email protected]>: 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 google#458. -- 55fea78 by Alankrit Verma <[email protected]>: fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d by Alankrit Verma <[email protected]>: 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 google#458 -- d37448d by Alankrit Verma <[email protected]>: fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af by Wei Sun (Jack) <[email protected]>: Update transfer_to_agent_tool docstring for better prompt -- a144069 by Wei Sun (Jack) <[email protected]>: Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=google#466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436 PiperOrigin-RevId: 764940463
Fixes: #458
Background
When an LLM‐driven agent called
transfer_to_agent
with extra parameters (e.g.query
,temperature
), the tool raised:because its signature only accepted
agent_name
andtool_context
.With this change, we:
src/google/adk/tools/transfer_to_agent_tool.py
to:kwargs
are silently ignored.tests/integration/tools/test_transfer.py
to include:query
)query
,temperature
,max_tokens
)Each test is parametrized to run against both the GOOGLE_AI and VERTEX backends.
Test Plan
Checklist
Next Steps / TODO
@hangfei @Jacksunwei
Per the existing TODO comment in
transfer_to_agent_tool.py
, we could further internalize this tool (e.g. rename to_transfer_to_agent
or move into aninternal/
submodule) so it doesn’t leak into the public API.I can work on that. Let me know if I can / should?