chore: refines transfer_to_agent docstring for more stable agent transfer stability. #466
Closed
AlankritVerma01 wants to merge 9 commits intogoogle:mainfrom
Closed
chore: refines transfer_to_agent docstring for more stable agent transfer stability. #466AlankritVerma01 wants to merge 9 commits intogoogle:mainfrom
AlankritVerma01 wants to merge 9 commits intogoogle:mainfrom
Conversation
transfer_to_agent now takes **kwargs to swallow unexpected keyword args Added integration tests covering single and multiple extra kwargs. Fixes google#458.
Collaborator
|
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
Contributor
Author
|
Thanks @Jacksunwei for the feedback! I’ve removed the |
Jacksunwei
reviewed
May 5, 2025
Jacksunwei
approved these changes
May 29, 2025
copybara-service bot
pushed a commit
that referenced
this pull request
May 29, 2025
Copybara import of the project: -- e246af5 by Alankrit Verma <alankrit386@gmail.com>: 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 <alankrit386@gmail.com>: fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d by Alankrit Verma <alankrit386@gmail.com>: 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 <alankrit386@gmail.com>: fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af by Wei Sun (Jack) <Jacksunwei@gmail.com>: Update transfer_to_agent_tool docstring for better prompt -- a144069 by Wei Sun (Jack) <Jacksunwei@gmail.com>: Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=#466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436 PiperOrigin-RevId: 764940463
Collaborator
|
merged in 854a544. Thanks! |
whhlct
pushed a commit
to whhlct/adk-python
that referenced
this pull request
Jun 6, 2025
Copybara import of the project: -- e246af5 by Alankrit Verma <alankrit386@gmail.com>: 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 <alankrit386@gmail.com>: fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d by Alankrit Verma <alankrit386@gmail.com>: 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 <alankrit386@gmail.com>: fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af by Wei Sun (Jack) <Jacksunwei@gmail.com>: Update transfer_to_agent_tool docstring for better prompt -- a144069 by Wei Sun (Jack) <Jacksunwei@gmail.com>: Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=google#466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436 PiperOrigin-RevId: 764940463
coder-aditi
pushed a commit
to coder-aditi/adk-python
that referenced
this pull request
Jul 2, 2025
Copybara import of the project: -- e246af5 by Alankrit Verma <alankrit386@gmail.com>: 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 <alankrit386@gmail.com>: fix(tests): correct indentation in test_transfer.py for better readability -- 0c04f2d by Alankrit Verma <alankrit386@gmail.com>: 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 <alankrit386@gmail.com>: fix(transfer_to_agent): update docstring for clarity and accuracy -- ea827af by Wei Sun (Jack) <Jacksunwei@gmail.com>: Update transfer_to_agent_tool docstring for better prompt -- a144069 by Wei Sun (Jack) <Jacksunwei@gmail.com>: Update transfer_to_agent_tool.py COPYBARA_INTEGRATE_REVIEW=google#466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436 PiperOrigin-RevId: 764940463
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #458
Background
When an LLM‐driven agent called
transfer_to_agentwith extra parameters (e.g.query,temperature), the tool raised:because its signature only accepted
agent_nameandtool_context.With this change, we:
src/google/adk/tools/transfer_to_agent_tool.pyto:kwargsare silently ignored.tests/integration/tools/test_transfer.pyto 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_agentor 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?