Concept
Write the clear routes first, such as intent categories or data conditions. Write one quoted plain-language route last for requests that are vague, unsupported, or in conflict. The fallback agent can end in one of two ways.
A plain-language
WHEN is guidance for the model. The model chooses the fallback route when the request fits that text. A supervisor without a BEHAVIOR block can also answer directly instead of choosing any route. Set BEHAVIOR with ROLE: router when every message must reach a route. A router can also ask the customer one question when no route fits.
Minimal working example
This supervisor sends billing and technical requests to specialists. It sends everything else to a triage agent. The triage agent asks one question, then returns control. The supervisor then routes the customer’s answer.How it works
- The two specialist routes use
intent.category.INTENTS:declares the categories. The model chooses the fallback route when neither category fits. - The fallback agent asks its
GATHERquestion. ItsCOMPLETEcondition fires whenclarified_requestis set. Because the route hasRETURN: true, control goes back to the supervisor. ON_RETURNwithACTION: resume_intentmakes the supervisor route again after the return.RESUME_WITH: latest_child_user_utterancereplays the customer’s answer to the triage question. WithoutRESUME_WITH, the supervisor replays the original message, which was the vague one.- During the replay, the supervisor does not offer the fallback route again, so the customer cannot loop back to it. The platform replays at most once for each return.
- The platform does not run deterministic routing during the replay. The model chooses among the routes still offered.
- If the triage question gets a sensitive reply, the platform replays the original message instead.
- A
HANDOFFentry withoutHISTORYgives the specialist the full conversation history. A project-level coordination default can change this value. ON_RETURN: "resume_intent"is the short form. It uses the default replay of the original message.
Common variations
Map a returned value to the supervisor
UseMAP when a route condition must read what the fallback learned. MAP copies a child field to a parent variable. The left side is the child field. The right side is the parent variable.
clarified_area in its own MEMORY. The mapped value stays in the session. A route that reads it keeps matching while the supervisor owns the conversation, so use it with specialists that keep the conversation (RETURN: false). If the child returns an empty value, the parent keeps its existing value.
Always-available default route
UseWHEN: true on the last route when one agent can take every leftover request.
true route before the model reasons. The route stays available, and the model chooses it.
Explain and stop
For an out-of-scope request, useRETURN: false on the fallback route and end the fallback agent with a COMPLETE condition. With RETURN: false, the fallback owns the conversation after the transfer. Without a COMPLETE condition or a human handoff, the customer cannot reach a specialist later in the same session.
Hand the customer to a person
Route to an agent that declaresESCALATE. Escalation reaches a person only when the project has a human-agent connection and the ESCALATE block has a routing block with connection, queue, or skills. See the ESCALATE reference.
Verification
- Validate the supervisor and all target agents together.
- Send a clear billing message. Expect
Billing_Agent. - Send a clear technical message. Expect
Technical_Support_Agent. - Send a vague message, such as “I need help with my account.” Expect
Fallback_Triage_Agentand its question. - Answer the question. Expect a
resume_intenttrace event, and then the matching specialist. - Send an out-of-scope message. Expect the fallback route, not a specialist.
handoff_condition_checkfor each route the model chose. ReadresultandevaluatedContext.resume_intent. CheckresumeWith,resumeMessageSource, andresumeMessageto see which text the supervisor replayed.- For the
MAPvariation, amemory_errorevent means the platform refused to write the mapped value.
Production readiness checklist
- Every specialist route has an owner and a short
SUMMARY. - The fallback route is last, and its text is plain lowercase words.
- A returning fallback has
RESUME_WITH: latest_child_user_utterance, or the supervisor has a route that reads the mapped value. - Every
MAPtarget is declared in the supervisor’sMEMORY. - A non-returning fallback ends with a
COMPLETEcondition or a human handoff. - A human handoff has a human-agent connection and a
routingblock. - Fallback traces are reviewed on a schedule. Add a real route for any request type that keeps landing there.
- Tests cover a clear request, a vague request, an out-of-scope request, and an answer to the triage question.