Concept
Authentication and profile lookup are separate jobs. The channel authenticates the user before the session starts. A profile lookup reads business data for that identity.ON_START can call a read-only lookup tool before the welcome renders.
The runtime puts the authentication result in the session namespace when the channel supplies it.
Treat caller data from a browser as unverified. Use
session.identityTier for decisions that need a verified identity. Do not reveal sensitive data before identity is verified. Greet generically when the identity is missing.
ON_START runs these steps in order:
SETassignments.- The top-level
CALL, only when itsWHENguard is true. - Interaction language directives.
BRANCHESconditions. The first match supplies the welcome.- The welcome
RESPOND. - The matched branch
DO:list.
CALL finishes before the branch conditions and the welcome. Both can read its result. A CALL inside a branch DO: list runs after the welcome, so the welcome cannot use its result.
The welcome waits for the tool. Keep the tool fast and set hints.timeout as a number of milliseconds.
Minimal working example
This example calls a profile tool only for a signed-in customer. It shows a generic welcome in every other case.How it works
WHEN: session.customerId IS SETskips the lookup for anonymous users. IndentWHENunderCALL. A siblingWHENis ignored and the parser warns.AS: accountProfilestores the tool result. If the tool fails or does not run,accountProfile.display_namestays unset.- The first branch matches only when
display_nameis set. Otherwise theELSEbranch shows a generic welcome. - Without the branch guard, a missing field renders as empty text, for example “Hello . Your account is .”.
- A matched branch owns the startup turn. In a FLOW agent, the entry step runs on the first user message instead of at start.
Common variations
Gate on identity without a lookup
Use this when the welcome only needs to know whether the user is verified.Prefetch the profile after the welcome
Use a branchDO: list when the welcome does not need the profile. The welcome renders first. The call then fills accountProfile for the first turn.
ON_START_BRANCH_DO_ACTIVATED as an informational warning. It confirms that the list runs at session start.
Look up by a channel-supplied identifier
If the channel passes an account ID as caller data, usesession.account_id in both WITH and WHEN. Check the exact key name your channel sends.
Verification
Run three sessions and inspect the trace for each.- Start as a verified user. Expect the personalized welcome. In the trace,
dsl_lifecycle_call_conditionshowsmatched: true, anddsl_callshowssource: on_start_with. Thentool_call_start,tool_result,dsl_on_start_branch, anddsl_respondappear. - Start anonymously. Expect the generic welcome.
dsl_lifecycle_call_conditionshowsmatched: false, and nodsl_callevent appears. - Start as a verified user while the tool fails. Expect the generic welcome.
dsl_on_start_branchshows theELSEbranch.
Production readiness checklist
- Bind
get_account_profileto a read-only endpoint in the project. - Return only the fields the welcome needs.
- Set
hints.timeoutas a plain number of milliseconds. - Keep a generic
ELSEwelcome for anonymous users and tool failures. - Test verified, anonymous, tool failure, and tool timeout sessions.
- Confirm the target channel delivers the
ON_STARTwelcome. - Trace the startup tool call and review lookup failures.