Concept
ABL gives you several places to seed session values. Pick the one that matches where the value comes from.ON_START runs these steps in order:
SETassignments.- The top-level
CALL. - Interaction language directives.
BRANCHESconditions, which select the welcome.- The matched branch
DO:entries up to its last language directive. - The welcome
RESPOND. - The remaining branch
DO:entries.
ON_START runs once per session, for the entry agent only. A specialist reached by handoff never runs its own ON_START. ON_START also runs when the first user message starts the session, before the runtime processes that message. A reconnect to an initialized session does not run it again.
Keep initialization deterministic. Use it for values that exist at start. Collect values from the user with GATHER.
Values you can read at start
A path with no value resolves to nothing. A template then renders it as empty text. The runtime owns
session.languageDetection and sets it after a user message, so it is empty at start.
Minimal working example
How it works
SETassignments run beforeRESPOND, in the order you write them.- A numeric or boolean constant keeps its type.
0stays a number. - A top-level
RESPONDis a prelude. The entry flow step still runs at start and asks for the order number. - The flow reads the initialized values from the first step on.
SETruns on every channel. Some channels, such as Slack, WhatsApp, and API, do not deliver the welcome. The values are still set.- You can write several assignments under one
SET:line, one per line. - An unresolved path leaves the variable empty.
Common variations
Initialize constants
Quote text constants. An unquoted word that matches a session variable name reads that variable. An unquoted word with no match is stored as text.SET: campaign_id = session.campaign_id.
Declare a default with INITIAL
UseINITIAL for a fixed default. The runtime writes it when it creates the session. It also fills the variable when an agent activates and the variable is still missing.
INITIAL value and no other writer triggers the W801 warning. Write the variable somewhere, as the SET in show_attempt does.
Set a value for one branch
SET in a branch DO: list runs after the welcome, so the welcome cannot read it. The compiler reports ON_START_BRANCH_DO_ACTIVATED as an informational warning. A branch DO: list accepts only SET, CALL, HANDOFF, and the two language directives. The parser drops other entries with a warning.
Set the reply language at start
SET_INTERACTION_LANGUAGE accepts a language tag, a value path such as profile.language, or a template such as "{{profile.language}}". It applies in two cases:
- The channel has a supported-language list, and the language is on that list.
- The project turns on language detection in the Runtime Config settings. The runtime then accepts any valid tag, with no list.
DO: list moves the entries before it ahead of the welcome. This lets the welcome use a value that the list sets. CLEAR_INTERACTION_LANGUAGE: restores the configured default language.
Verification
- Start a session. In the trace, find one
dsl_setevent for each top-levelSET, withsource: on_start. - Answer the first question. Confirm the final reply shows the initialized values.
- Start a session on a second channel. Confirm
channel_namechanges. - For
SET_INTERACTION_LANGUAGE, look for theinteraction_language_override_changedevent. Checkappliedand, when it is false,reason. - Reconnect to the same session. Confirm
ON_STARTdoes not run again.
Production readiness checklist
- Initialize only values available before the first user turn.
- Quote text constants.
- Keep names consistent with later
WHEN,PASS, and template references. - Set shared values in the entry agent. Pass them to specialists with
PASS. - Avoid writing sensitive values unless the flow needs them.
- Trace every startup assignment during validation.
- Test each target channel, including channels that do not deliver the welcome.