You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] Best way of passing parameters between root LLM agent and sequential agent-as-a-tool #2812
I'm looking for guidance on the best practice for passing initial parameters from a root LLMAgent to a SequentialAgent that is being used as a tool.
My Setup
My setup involves a root LLMAgent that uses AgentTool to delegate tasks to a multi-step SequentialAgent.
# A multi-step agent that will be used as a tool """
foo_tool_agent = SequentialAgent(
name="FooTool",
sub_agents=[...], # Contains one or more BaseAgents
description="A tool that performs a multi-step task.",
)
# The root agent that calls the tool
bar_assistant_agent = Agent(
name="BarAssistant",
model="gemini-2.5-flash",
tools=[AgentTool(agent=foo_tool_agent)],
)
Observed Data Flow
When the BarAssistant's LLM generates a tool call for my SequentialAgent, the function call looks like this:
By inspecting the AgentTool's source code, I can see that it takes the string value from args['request'] and wraps it in a types.Content object. This Content object is then passed as the new_message to the Runner that executes the foo_tool_agent.
The Question: How to Read the Arguments?
My question is: What is the official or most idiomatic way for the first sub-agent inside FooTool to access this initial request string ("{"param1": "valueA", "param2": 123}")?
I see a few potential ways to access this data from the ctx object within my sub-agent's _run_async_impl method:
A) From ctx.user_content: Should I access the raw message directly?
Activity