Replies: 3 comments 1 reply
-
I've been facing the same issue, and after trying various approaches, I found that creating the following Callback and adding it to the def TransferToParentCallback(callback_context: CallbackContext):
"""
A callback that always performs TransferToAgent to the parent Agent.
"""
from google.genai import types
current_agent = callback_context._invocation_context.agent
if current_agent.parent_agent:
return types.Content(
parts=[
types.Part(
function_call=types.FunctionCall(
name="transfer_to_agent",
args={"agent_name": current_agent.parent_agent.name}
)
)
]
) As I proposed this in #2234 , I believe the ideal solution would be for an |
Beta Was this translation helpful? Give feedback.
-
I'm facing the same issue. As far as I know, there's no way to do that — ADK doesn't support that kind of interaction either. It looks like every workflow follows a single path, and the only way to switch between agents is by starting a new chat, What worked for me was using agents as tools, which gives more control and allows the root agent to decide which agent should be used. |
Beta Was this translation helpful? Give feedback.
-
I created a PR to solve this problem, #2253 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have in my instructions that the sub-agent should delegate back when the task is done and very seldom does it do this.
Though if the user asks for it , then the Agent always does it.
I have had to come up with workaround that are either that I manually delegate through a callback (e.g. after tool use with transfer_to_agent) or I use the sub-agent as a tool so that the results are directly returned to the root agent.
To clarify , the major problems is when a sub-agent should delegate back to the root agent after its task is done. Have not really encountered the same problem with the root agent delegating to the sub-agents.
Beta Was this translation helpful? Give feedback.
All reactions