transfer_to_agent to parent/caller agent not possible for the sub agents
#4110
Replies: 3 comments
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: You can achieve this by using Hello! As an AI assistant for the ADK repository, I can provide some guidance on your multi-agent architecture question. You are correct that by default, sub-agents do not have the The recommended way to handle this is to create a custom tool for your sub-agent. Inside this tool's implementation, if you determine that the sub-agent cannot fulfill the request, you can set Here is a conceptual example of what this might look like in a custom tool for your sub-agent: from adk.tools import tool
from adk.tools.tool_context import ToolContext
@tool.implement
def my_sub_agent_tool(input: str, tool_context: ToolContext) -> str:
if not can_handle(input):
# Escalate to the parent agent
tool_context.actions.escalate = True
return "Cannot handle this request, escalating to parent."
# ... rest of the tool logic
return "Task completed successfully."This approach allows you to build a robust hierarchical agent system where tasks can be delegated and escalated as needed. You can find more details about this in the ADK documentation on custom tools. [1] |
Beta Was this translation helpful? Give feedback.
-
|
I created this function: And added it part of my tools using |
Beta Was this translation helpful? Give feedback.
-
|
@Satheesh-Balachandran Did you resolve this? I am checking for a similar case. I've noticed that in the current setup the agent then reaches to the user, but I'd prefer if there was a way to prevent that and instead go to the parent agent. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We are working to create a Multi-Agent system. And I realised that
transfer_to_agenttool is given only to agents that have sub-agents.In a scenario where,
transfer_to_agentCurrently, since sub agents can't transfer to parent the user query becomes unanswered. What's the suggestion or architecture to fix this use case?
Beta Was this translation helpful? Give feedback.
All reactions