Skip to main content
Back to how-to guides Use this pattern when the supervisor cannot choose a specialist, or when the customer asks for something outside the supported intents. A fallback agent clarifies the request or explains the limit. It does not absorb every request.

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.
These two stand-in specialists let the project compile. Replace them with your real agents.

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 GATHER question. Its COMPLETE condition fires when clarified_request is set. Because the route has RETURN: true, control goes back to the supervisor.
  • ON_RETURN with ACTION: resume_intent makes the supervisor route again after the return. RESUME_WITH: latest_child_user_utterance replays the customer’s answer to the triage question. Without RESUME_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 HANDOFF entry without HISTORY gives 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

Use MAP 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.
The supervisor declares 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

Use WHEN: true on the last route when one agent can take every leftover request.
The platform does not evaluate a true route before the model reasons. The route stays available, and the model chooses it.

Explain and stop

For an out-of-scope request, use RETURN: 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 declares ESCALATE. 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

  1. Validate the supervisor and all target agents together.
  2. Send a clear billing message. Expect Billing_Agent.
  3. Send a clear technical message. Expect Technical_Support_Agent.
  4. Send a vague message, such as “I need help with my account.” Expect Fallback_Triage_Agent and its question.
  5. Answer the question. Expect a resume_intent trace event, and then the matching specialist.
  6. Send an out-of-scope message. Expect the fallback route, not a specialist.
In the trace, check these events.
  • handoff_condition_check for each route the model chose. Read result and evaluatedContext.
  • resume_intent. Check resumeWith, resumeMessageSource, and resumeMessage to see which text the supervisor replayed.
  • For the MAP variation, a memory_error event 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 MAP target is declared in the supervisor’s MEMORY.
  • A non-returning fallback ends with a COMPLETE condition or a human handoff.
  • A human handoff has a human-agent connection and a routing block.
  • 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.

Common mistakes

Troubleshooting