Skip to main content
Back to how-to guides Use this pattern when the agent must run startup logic before the user sends the first turn.

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

Personalize the welcome with startup values

A startup response can include placeholders. The welcome renders with values that SET assigns earlier in the same ON_START block, so the user sees real session data in the first message rather than a generic greeting.
This works on every channel that triggers a welcome. On Kore Agent Assist, Agent AI triggers it when you select Use ‘Trigger Welcome message’ as the first request to Agentic. For details, see Agent AI integration.

Choose a branch at startup

Branches are evaluated in order. The first matching branch wins. An ELSE branch is the default branch.

Verification

Create sessions with different interaction language values and confirm the selected welcome changes. In traces, check dsl_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. For a personalized welcome, confirm the first message shows the assigned value rather than the raw placeholder.

Common mistakes

Troubleshooting

If a branch condition is malformed, the runtime fails closed and falls back to the top-level ON_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 run SET, CALL, or DELEGATE.
  • Use an ELSE branch 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, and dsl_on_start_branch.