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 and the welcomeRESPOND.- The matched branch
DO:list.
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.
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.
Pin the reply language on a voice channel
SET_INTERACTION_LANGUAGE applies only on a voice channel that has a supported-language list. On other channels the override is not applied, and the trace shows the reason.
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. - 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.