Skip to main content
An agent’s published configuration is shared by every caller — dynamic variables personalize it per session. Write {{variable_name}} placeholders in your agent’s system prompt or first message and supply values when you create the session. Substitution happens once, when the published configuration is assembled for the session.
System prompt
Pass values as a flat object of strings, numbers, or booleans. Variable names must match [A-Za-z][A-Za-z0-9_]* (no hyphens or dots), string values are capped at 1,000 characters, and a request can carry at most 50 variables — violations reject session creation with 422:
Placeholders with no matching variable are not removed — the literal {{variable_name}} text stays in the prompt, visible to the model. Make sure every placeholder in your configuration has a value at session creation.
Session records never store dynamic variable values.
You don’t need a variable for the current date or time — the agent already knows both, in the session’s timezone. See Time & timezone.
Variables fill placeholders in the configured text. To replace whole configuration fields for a session — the prompt itself, the opener, voice, language — use overrides on the same request; {{placeholders}} render inside overridden text too.

Who supplies the values

Where variable values come from depends on the session’s access mode: In sessionToken mode the SDK’s dynamicVariables option has no effect — the session already exists by the time the token reaches the browser. Attach personalization server-side instead:
Backend (sessionToken mode)
In agentId mode, values arrive from the end user’s browser — treat them as untrusted input, and use sessionToken mode when personalization must come from data only your backend knows.

Going further

Agent configuration

The fields your placeholders act on.

Overrides

Replace whole configuration fields for one session.

Versions & publishing

Sessions assemble the published configuration.

Web SDK

Every AgentSession.start() option.