Ch 7 — Multi-Agent Under the Hood
Supervisor routing internals, Command objects, handoff mechanics, sub-graph state mapping, and A2A protocol wire format
Under the Hood
-
Click play or press Space to begin...
ASupervisor Routing InternalsHow the supervisor decides which worker to call
1supervisor_account
Supervisor LLMwith_structured_output
→ {next: "worker"}
route
call_split
Conditional Edgestate["next"] →
node name
dispatch
2settings
Worker NodeFull ReAct agent
with own tools
3arrow_downward Command object: how handoffs work at the Pregel level
BThe Command ObjectLangGraph's primitive for dynamic routing from within a node
build
Handoff ToolReturns Command
instead of string
yields
code
Command()goto + update
+ graph target
Pregel
4route
Dynamic RouteOverrides edge
evaluation
5arrow_downward Shared state vs scoped state between agents
CState Sharing Between AgentsFull shared state vs message-only handoff
share
Shared StateAll agents read/write
same TypedDict
vs
mail
Message PassingOnly messages
travel between agents
vs
6lock
Scoped StateSub-graph sees
only mapped keys
7arrow_downward Sub-graph internals: state mapping and invocation
DSub-Graph Invocation InternalsHow parent and child graphs exchange state
account_tree
Parent StateParentState with
messages + metadata
map in
lan
Sub-GraphChildState with
own schema
map out
8output
ResultChild output mapped
back to parent state
9arrow_downward Execution trace: supersteps across a multi-agent run
EMulti-Agent Execution TraceSuperstep-by-superstep through a supervisor workflow
looks_one
Supervisor→ next: researcher
superstep 1
→
looks_two
Researchertools loop
supersteps 2-5
→
looks_3
Supervisor→ next: writer
superstep 6
→
looks_4
Writer → ENDsupersteps 7-8
→ FINISH
10arrow_downward A2A wire format: JSON-RPC tasks, streaming, and artifacts
FA2A Protocol Wire FormatTasks, messages, artifacts, and streaming over HTTP
send
tasks/sendJSON-RPC request
with message
process
task
Task Objectid, status, history,
artifacts
stream
stream
SSE Updatestasks/sendSubscribe
for streaming