Concept 3Sub-agents & multi-agent systems (MAS)
02b & 05a · Art #2

ADK supports 3 orchestration topologies:

1

sub_agents=[...] (peer handoff): the parent transfers full control of the conversation turn to a specialist child (Gatekeeper → Registratore or Cameriere).

2

AgentTool(agent=...) (supervisor consultation): a coordinator invokes a specialist like a function call, gets structured JSON back, and keeps control (Suggeritore).

3

Workflow graph (deterministic DAG): explicit Python Edge routing + RequestInput human-in-the-loop pauses when LLM routing is too loose (github branch 02c).

Comparing sub_agents (02b) vs AgentTool (05a)
# 1. Conversational Handoff (sub_agents)
gatekeeper_agent = LlmAgent(
name="gatekeeper",
sub_agents=[registratore_agent, cameriere_agent],
)
# 2. Supervisor Pipeline (AgentTool)
suggeritore_soste_agent = LlmAgent(
name="suggeritore_soste",
tools=[
AgentTool(agent=route_planner_agent),
AgentTool(agent=soste_search_agent),
AgentTool(agent=menu_checker_agent),
],
)
agent→ Edge → ⏸ RequestInput→ Edge → agent