Skip to main content
Back to how-to guides Use this pattern when the first assistant turn should send users to a specialist agent. The route can run at session start from known data, or after the user picks an option.

Concept

A welcome route needs a signal. The signal decides which specialist receives the conversation. ABL supports three signals. Start data is a value the channel passes as caller data, such as session.entry_topic. Treat caller data from a browser as unverified. When the route has business impact, send the value from your own server. Every HANDOFF target must be a local agent that the entry agent declares in its HANDOFF: section. Every target must exist in the project.

What happens at session start

  • Eager start: no user message exists yet, for example when a Web SDK client connects. The welcome shows. The specialist becomes active but does not run. The user’s first message goes to the specialist.
  • Lazy start: the first user message starts the session, for example over HTTP chat. The welcome does not show. The runtime forwards that first message to the specialist.
  • Realtime speech-to-speech sessions never run the start-time handoff. The entry agent keeps the session.
  • A matched branch welcome owns the start. In a FLOW entry agent, the entry step runs on the first user message.
  • The specialist’s own ON_START never runs. ON_START runs once per session, for the entry agent only.
  • The route options come from the declared HANDOFF entry, such as RETURN, PASS, SUMMARY, and ON_FAILURE. The DO: line names only the target.
  • A route without HISTORY passes the full conversation history by default.

Minimal working example

This example routes by entry topic at session start. Every case reaches a specialist, so no user is left without a route.
entry_topic is project-local. Your channel must send it as caller data. The compiler reports ON_START_BRANCH_DO_ACTIVATED as an informational warning. It confirms that each DO: list runs at session start.

How it works

The runtime checks the branches in order. The first matching branch supplies the welcome and the DO: list. The ELSE branch matches when no earlier branch does. The welcome renders first. The HANDOFF then runs through the normal handoff path. The specialist Claims_Agent shows its first reply only after the user sends a message. On a lazy start, that message is the one that started the session.

Common variations

Route from a menu choice

Use this when no start data exists and the user picks an option. The enum field accepts only the listed values. Other text fails validation.
This example reuses Billing_Agent from the minimal example. A button press with no matching handler becomes the user’s input. The input is the button VALUE, or the button id when VALUE is empty. The runtime checks a route WHEN after the user’s input, not during the startup steps.

Route with a condition on start data

Use a top-level HANDOFF when one route depends on one start value. The route WHEN decides. It runs once at start, when no branch matched.
The WHEN must be decidable from start data. A natural language condition or an intent.* value never matches at start. The same WHEN stays true for the whole session. A later turn can route to the specialist again. To make the route start-only, put the condition in a branch IF: and leave the route WHEN unset.

Verification

  1. Start a session with entry_topic set to claims. Expect the claims welcome. In the trace, dsl_on_start_branch shows the matched branch, then handoff, then dsl_on_start_handoff with outcome: executed, activation: awaiting_user, and startMode: eager.
  2. Send a first message. Expect Claims_Agent to answer it.
  3. Repeat with billing. Then repeat with no entry_topic. Expect General_Service_Agent.
  4. For the menu, click each button. Then type billing. Then type other. Expect the validation message for other.
  5. For a blocked route, make the route WHEN false. Expect the entry agent to keep the session, with outcome: blocked and reason: condition_false.

Production readiness checklist

  • Define every target agent and declare it in the entry agent’s HANDOFF: section.
  • Send start data from your server when the route has business impact.
  • Keep an ELSE branch or a fallback agent for unknown values.
  • Set ON_FAILURE on each route so a refused handoff shows the message you intend.
  • Use ESCALATE in ON_FAILURE only when the project defines an ESCALATE block with a human-agent connection and routing. Without it, no person is reached.
  • Pass only the fields the specialist needs.
  • Test each start value, each button, an unknown value, and a blocked route.
  • Confirm the target channel delivers the ON_START welcome. The handoff still runs when the welcome is suppressed.

Common mistakes

Troubleshooting