Skip to main content
Use this pattern when a supervisor agent classifies what the user is trying to do, then hands the conversation to the specialist that owns that work.

Concept

Intent routing uses three ABL surfaces working together:
  • INTENTS declares the classifier categories. Each category has a description that tells the model what kinds of requests belong to it.
  • HANDOFF is the executable routing surface. Each entry names a target agent, the condition that triggers the handoff, and the context the child receives.
  • WHEN conditions on each handoff entry can be deterministic expressions (intent.category == "billing") or semantic natural-language text ("the user request is unclear"). The platform detects the form automatically: multi-word quoted text without structured operators routes through model reasoning; expressions with operators like == route through deterministic evaluation.
Two decisions shape every intent-routing supervisor:
  1. History strategy — By default, the child agent receives the full parent conversation history (history: full). This is the platform default when history is omitted. Choose summary_only, none, auto, or last_n when the child should see less. See Common variations for the options.
  2. Return behaviorEXPECT_RETURN: false (the default) transfers ownership permanently. EXPECT_RETURN: true pauses the parent and resumes it when the child returns. Use ON_RETURN to map child results back to parent variables.

Minimal working example

The MEMORY section declares customer_id and account_id as session variables so the pass fields have a defined source. Any variable you pass must come from MEMORY, GATHER, a tool result, or runtime context.

How it works

  1. The supervisor receives the user message and retains ownership until a handoff condition matches.
  2. The platform evaluates the INTENTS classifier against the user message, producing intent.category.
  3. HANDOFF entries are evaluated in authored order (override with PRIORITY when needed). The first matching condition wins.
  4. The matched child receives: the pass variables, the summary text, and conversation history controlled by the history strategy. When history is omitted, the child receives the full parent conversation — this is the platform default (full).
  5. If EXPECT_RETURN: false (the default), the child owns the conversation permanently. If EXPECT_RETURN: true, the child runs and returns control to the parent, optionally mapping result variables through ON_RETURN.
  6. If no HANDOFF condition matches, the supervisor continues with its own GOAL. A semantic fallback entry (like the General_Service_Agent above) prevents unmatched requests from going unhandled.

Common variations

Control conversation history with history

When the child should not receive the full parent transcript, set history explicitly:
Choose summary_only or none when the child is a focused specialist that should not be influenced by earlier conversation turns. Choose full (or omit) when the child needs the complete conversation record.

Shorthand context syntax

pass, summary, and history can appear as direct siblings of the handoff entry instead of nested under CONTEXT::
Both forms compile identically. The nested CONTEXT: form is preferred when you also need set or memory_grants.

Return to the parent with ON_RETURN

When a specialist should report back to the supervisor after completing its task:
EXPECT_RETURN: true pauses the parent. When the child returns, ON_RETURN.map copies child variables into the parent scope. action: continue resumes the parent’s flow; action: resume_intent re-runs routing with the original user intent and the returned context. The legacy keyword RETURN is accepted as an alias for EXPECT_RETURN.

Set evaluation order with PRIORITY

When multiple handoff conditions could match the same utterance, use PRIORITY to control evaluation order. Lower values are evaluated first:
Without PRIORITY, entries are evaluated in authored order.

Handle dispatch failures with ON_FAILURE

ON_FAILURE defines what happens when the handoff dispatch itself fails — for example, the target agent is not found or pre-transfer validation fails. It does not handle child-agent runtime errors.

Verification

  • Send a test utterance for each intent category and confirm the correct child agent is selected. Check the trace for the matched HANDOFF entry and the condition result.
  • Send an ambiguous utterance and confirm the fallback entry handles it. Verify the trace shows the semantic WHEN evaluation.
  • Inspect the trace for passed context: confirm pass variables are present in the child’s session and the summary appears in the child’s context.
  • If EXPECT_RETURN: true is used, verify the parent resumes and ON_RETURN.map variables appear in the parent’s session after the child returns.
  • Verify the history strategy by checking what conversation messages the child receives. With full (or omitted), the child should see the complete parent transcript. With summary_only, the child should see only the summary text.

Production readiness checklist

  • Every specialist route has a clear owner and a concise context summary.
  • Every pass variable has a declared source (MEMORY, GATHER, tool result, or runtime context).
  • Deterministic conditions use declared fields; semantic conditions are quoted as natural-language WHEN text.
  • Choose a history strategy appropriate for each child. The default full passes the entire parent transcript, which may include irrelevant turns and increase token usage.
  • Add ON_FAILURE to critical handoff entries so dispatch failures have a defined recovery path.
  • Fallback behavior is explicit and does not hide missing intent coverage.
  • Test at least one utterance per intent category, one ambiguous utterance, and one utterance outside all categories.
  • Temporary child agents (EXPECT_RETURN: true) produce every field mapped in ON_RETURN.
  • Verify handoff depth does not exceed the platform limit of 10 nested handoffs.

Common mistakes

Troubleshooting