Concept
ON_START is the session-start lifecycle handler. It can set session values, call a tool, choose a response branch, return voice or rich payloads, and delegate to another agent. It runs once per initialized runtime session and is idempotent: if the session is already initialized, startup does not run again.
Use ON_START for work that belongs to session initialization: greeting, reading channel context, loading a profile, setting counters, or selecting a first-turn experience. Do not use it as a replacement for normal per-turn routing.
Minimal working example
How it works
SET executes before the response. That means values copied from runtime context can be interpolated into the welcome or into the first flow step. The runtime emits dsl_set traces for assignments and dsl_respond traces for the startup response.
Common variations
Choose a branch at startup
Branches are evaluated in order. The first matching branch wins. AnELSE branch is the default branch.
Verification
Create sessions with different interaction language values and confirm the selected welcome changes. In traces, checkdsl_on_start_branch for the matched branch index. Confirm ON_START runs once by sending a second message in the same session and checking that no second startup trace is emitted.
Common mistakes
Troubleshooting
If a branch condition is malformed, the runtime fails closed and falls back to the top-levelON_START response when one exists. If no startup response is returned, the flow can still run from its entry point.
Production readiness checklist
- Put side effects at top-level
ON_START; branches can choose responses but cannot runSET,CALL, orDELEGATE. - Use an
ELSEbranch or a top-level fallback response. - Keep branch conditions based on values that are present before the first user turn.
- Validate traces for
dsl_on_start,dsl_set, anddsl_on_start_branch.