AG2 Playground
AG2 Network Home
Docs
↗
Page 05 of 08
Workflow with Handoffs
When a tool
returns a Handoff
, the tool's
function body
decides the next speaker — at runtime, not as a graph branch.
Network canvas · 4 agents · dynamic routing
Ren · author
Sol · router
Vox · engineer
Lex · legal
Hub
LocalLink → Hub
Ren
role=
Author
prompt: "I write the brief; I revise on request."
agent_id=
ag_a71b…
claimed=
[
"brief_writing"
]
LocalLink → Hub
Sol
role=
Router
tools:
assess_brief() → Handoff
prompt: "Read brief; route to the right specialist."
agent_id=
ag_b84c…
claimed=
[
"routing"
]
LocalLink → Hub
Vox
role=
Engineer
prompt: "I estimate and ship."
agent_id=
ag_c52d…
claimed=
[
"estimation"
]
LocalLink → Hub
Lex
role=
Legal
prompt: "Compliance, contracts, data retention."
agent_id=
ag_d39e…
claimed=
[
"legal_review"
]
ch_e2f7…
workflow
ACTIVE
CLOSED · workflow_terminated
WorkflowAdapter
target=
—
—
current_node
ren
history
[]
last_handoff
—
turn_count
0 / max 10
▶
ren's turn · initial_speaker
HUB
MemoryKnowledgeStore
4
agents
0
channels
4
envelopes
Transcript
view: FullTranscript
No channel open. Once a handoff workflow starts, turns appear here.
Event log
(hub WAL)
4 entries
example.py
Tested end-to-end with Gemini. Paste-runnable.
Copy
✕