Routing Modes
The routing mode decides how a conversation flows through your custodians.
It's set on the squad (squad.routingMode) and is one of three values:
| Mode | Best for | Shape |
|---|---|---|
single | A topic-routed support hub | Every custodian hangs off Input independently |
chain | Escalation-style helpers | Entry custodians start; anyone can hand off |
workflow | Research → analyse → write pipelines | A fixed top-to-bottom pipeline |
You don't have to wire the canvas perfectly by hand — the Flow Builder canonicalizes edges and layout automatically based on the mode, and even auto-generates a clean layout when you change it.
single — topic-routed hub
- Every custodian connects to Input and never to another custodian.
- Conversation is routed to the custodian whose topics best match the message.
- Give each custodian a
topicslist (e.g.billing,security,api-keys) so routing picks the right specialist.
Good for: a support hub with specialists, where the user's question picks the agent.
chain — escalation flow
- Only the entry custodians can start a conversation — these are the drawn Input
connections, persisted as
squad.entryAgents. If you don't set them, any custodian may start (topic match picks the best). - A custodian may hand off to one or more other custodians via
canHandoffTo(mirrored with the drawn custodian → custodian edges). - When a custodian can hand off to several targets, the runtime routes to the best match based on topics / name / description.
maxHandoffscaps how many times a conversation can change hands.
Good for: a tier-1 agent that escalates to a billing specialist, a security officer, etc.
workflow — fixed pipeline
- The custodians run in order, top to bottom — the order of custody on the canvas is the execution order.
- Exactly one Input → first custodian edge, then a straight
C1 → C2 → … → Cnpipeline; the canvas is always a single clean line. - Data sources and tools work the same as any other mode.
Good for: content pipelines (Welcome → Research → Writer → Editor → Reviewer → Translator → Formatter) or any study → draft → polish flow.
How edges are canonicalized
The Flow Builder rebuilds your edges per the mode whenever it validates a flow:
- workflow → one Input edge to the first custodian, then
C1→C2→…→Cn. - chain → Input to each entry custodian, plus custodian→custodian handoff edges
(mirrored from
canHandoffTo). IfentryAgentsis omitted, Input connects to every custodian. - single → Input to every custodian; custodian→custodian edges are removed.
Layout is optional too. When it's missing (or nodes would overlap), a clean layout is generated automatically: a vertical line for workflow, an input-on-the-left grid for single/chain, and data-source nodes stacked to the left of the custodian they feed.
See also: Overview · Custodians & Tools · Data Sources & RAG