HANDOFF list to route on channel, locale, role, entitlement, failure count, or session state.
Use this when the same user intent must branch by channel, language, role, or current session state.
Concept
A supervisor evaluatesHANDOFF entries in authored order. Each entry has a WHEN condition that can be either:
- Deterministic: a structured expression referencing session data values, such as
session.channel == "voice"orsession.interaction.current.language == "es". The runtime evaluates these against session state and produces a boolean result without involving the model. - Semantic: a natural-language description of when the route should activate, such as
"the user is an administrator and the account is locked". The runtime defers these to the model, which decides based on conversation context.
Key context paths
History default
When a HANDOFF entry omits thehistory property, the child agent receives the full parent conversation history. This is the platform default. To limit what the child sees, set history explicitly:
full(default when omitted): complete parent conversation historyauto: uses the handoff summary when available, otherwise the last 5 messagessummary_only: only the summary text, no raw messagesnone: no history{ mode: last_n, count: <n> }: the last N messages
Minimal working example
This supervisor routes by channel, language, role, and a general fallback. Each variable inpass must be populated before routing — typically via ON_START SET, GATHER, a tool call, or caller context from the SDK/channel.
customer_id and account_id are populated from caller context or an ON_START lookup. conversation_summary is a platform-provided session variable. These must exist in session data before the HANDOFF evaluates.
This example uses the flat CONTEXT shorthand (PASS:, SUMMARY:, HISTORY: as direct siblings of the HANDOFF entry). The nested CONTEXT: wrapper form is also supported:
How it works
- The supervisor receives the user message and evaluates HANDOFF entries in authored order.
- For each entry, the runtime classifies the WHEN condition:
- Structured conditions (containing operators like
==,!=,AND,OR,IS SET, comparisons) are evaluated deterministically against session data values. - Natural-language conditions (free-form text without operators) are deferred to the model, which decides based on conversation context and the condition text.
- Structured conditions (containing operators like
- The first matching handoff transfers control to the target agent. The target receives the declared
passvariables, thesummary, and conversation history according to thehistorystrategy (default:full). - When
EXPECT_RETURN: false, the child becomes the new active agent permanently. WhenEXPECT_RETURN: true, the child returns control to the supervisor viaON_RETURN.
Common variations
Combining deterministic and semantic conditions
You can combine a deterministic check with a semantic qualifier in a single WHEN using AND:Routing on locale instead of language
Routing with explicit priority
UsePRIORITY to override authored-order evaluation. Lower values are evaluated first:
Return-expected handoff with ON_RETURN
When a specialist should return control after completing its task:Adding ON_FAILURE for robustness
ON_FAILURE fires when the target agent cannot be found or the dispatch fails before the target accepts the handoff.
Verification
- Validate the ABL document parses and compiles without errors or warnings.
- Send a test message from a voice channel and confirm the
Voice_Escalation_Agentis selected. Inspect the trace for arouting_primitive_whenevent showingkind: deterministic_passfor thesession.channel == "voice"condition. - Send a test message with the interaction context language set to
esand confirm theSpanish_Service_Agentis selected. - Send a test message as an administrator (with role context populated) and confirm the
Admin_Support_Agentis selected via model-deferred semantic evaluation. - Send a test message that matches no specific override and confirm the
Standard_Service_Agentis selected. - Confirm that each target agent receives the expected
passvariables and conversation history.
Production readiness checklist
- Every variable in
passlists has a verified source: gathered field, ON_START SET, caller context, tool output, or memory. Variables that are not populated before routing will be passed as empty/null. - Deterministic conditions use platform-provided paths (
session.channel,session.interaction.current.language) or variables with known, reliable sources. - Semantic conditions describe clear, unambiguous selection criteria. Vague conditions may cause inconsistent routing.
- The
historydefault isfullwhen omitted. If children should not see full history, sethistoryexplicitly on each handoff. - A catch-all route or direct-response capability exists for messages that match no specific route.
- Each specialist agent is defined and reachable (either inline or as an imported agent reference).
ON_FAILUREis set on critical routes where target unavailability must produce a user-facing message rather than silence.- Route distinctness: each deterministic WHEN condition is mutually exclusive or ordered so the first match wins correctly. Overlapping semantic conditions may produce non-deterministic routing.
Common mistakes
Troubleshooting
Related articles