Concept
Personalization at startup has two parts: a source of user context and anON_START welcome that uses it. Choose the source first.
Use only low-risk personalization in the welcome, such as a first name or a plan name. Do not show account details until the user proves identity. Values that a browser sends are not verified, so do not base access decisions on them.
Every source can be missing. A
{{placeholder}} that has no value renders as empty text, so a missing name gives “Welcome back . You are on the plan.” Guard each personalized welcome with a branch that tests IS SET, and end with a generic ELSE branch.
Do not guard with != "". On a missing value that test returns true.
The welcome reaches the user only on channels that allow it, and only when the session starts before the first message. The ON_START tool call and SET run either way.
Minimal working example
This agent looks up the member profile when the host application suppliesmember_id. It greets the member by name. It falls back to a generic welcome.
The example assumes two project-local resources. The host application sends member_id when it creates the session. The project binds lookup_profile to a real backend.
How it works
TheWHEN guard under CALL gates only the tool call. If member_id is missing, the runtime skips the call and still selects a branch. A guard that cannot evaluate also skips the call.
The runtime stores the tool result under profile because the call uses AS: profile. The first branch tests profile.first_name. It matches only when the lookup returned a name.
When the lookup fails, the welcome still renders. profile.first_name stays unset, so the ELSE branch runs. The runtime logs the failure and continues with the rest of ON_START.
The tool declares side_effects: false and confirm: never. A profile lookup at startup should not ask the user to approve a side effect.
The runtime applies session privacy protection to the welcome text before it sends the text and stores it in history. If your project redacts personal data, test the personalized welcome.
Common variations
Personalize from host application data
When the host application already knows the user, skip the tool. The host application sends values when it creates the session. The agent reads them assession.<key>. The key plan_tier below is an example.
session and tenant_id. It ignores them when the host application sends them.
Personalize from saved memory
Asession:start recall loads persistent memory before ON_START runs. The welcome can then read the value. The project needs a stored user.first_name for this user.
Let the tool write the welcome
WhenON_START has no RESPOND and the startup tool returns a non-empty content string, the runtime sends that text as the welcome. A RESPOND always takes precedence. The tool must return content as a string.
Verification
- Start a session with
member_idset. Confirmdsl_lifecycle_call_conditionshowsmatched: trueand atool_call_startevent follows. - Confirm the welcome shows the returned first name and plan. Check
dsl_on_start_branchfor the matched branch index. - Start a session without
member_id. Confirmmatched: falseand the generic welcome. - Make the lookup fail, for example with an unknown member. Confirm the generic welcome appears.
- For the memory variation, confirm a
memory_recallevent listsuser.first_nameininjectedKeys. - For the tool text variation, confirm
dsl_respondshowssource: on_start_tool_result. - Test the welcome on a channel that allows it. A suppressing channel or a lazy start does not show the text.
Production readiness checklist
- Personalize with non-sensitive fields only.
- Make the startup lookup tool read-only, and bind it to a real backend.
- Define a description for every tool parameter.
- State where each personalized value comes from: tool result, host application data, or memory.
- Guard each personalized branch with
IS SET, and keep a genericELSEbranch. - Test three cases: value present, value missing, and lookup failure.
- Do not treat browser-supplied values as verified identity.
- Check how your project redacts personal data in the welcome.