Syntax
The platform supports three variable substitution formats. Each behaves differently when a variable is missing and supports different features.| Syntax | When variable exists | When variable is missing | Default value |
|---|---|---|---|
{variable} | Replaced with value | Left as literal {variable} | No |
${variable} | Replaced with value | Replaced with empty string | Yes: ${var=fallback} or ${var=$other} |
{{ variable }} | Replaced with value | Replaced with empty string | No |
{{ variable }}, spaces around the variable name are ignored, so {{ x }} and {{x}} are equivalent.
${variable} and spaces: Unlike {{ variable }}, ${...} does not trim or ignore spaces inside the braces. ${ agent_name } will not resolve; use ${agent_name} with no spaces around the name.
Choosing the right syntax
-
{{ variable }}— Default for most cases: greetings, tool descriptions, tool static parameters. When the variable is missing, it becomes an empty string. Use this when you want missing values to disappear from the output. -
{variable}— Use when you want the model to see the placeholder if the variable is missing. For example,Hello {name}keepsHello {name}in the prompt whennameis not set, so the model can adapt instead of seeingHellowith no indication a name was expected. -
${variable=fallback}— Use when a missing value should resolve to a specific default value. You can use a static default (e.g.${vars.provider_name=your provider}) or another variable (e.g.${vars.provider_name=$vars.pcp}). Only${...}supports resolving to a specific default value,{{ variable=default }}is invalid and will not provide a fallback.
Variable Types
System Variables
System variables provide access to platform-managed data and session context. Use thevars.session.* path for these values (for example {{ vars.session.agent.name }}). Shorter forms such as {{ vars.agent_name }} do not resolve session fields—even when a similarly named custom variable exists, they resolve to empty.
{{ vars.session.id }}- Unique identifier for the current session{{ vars.session.agent.name }}- Name of the current agent{{ vars.session.datetime }}- Current timestamp, e.g.,2025-01-02 12:00{{ vars.session.date }}- Current date, e.g.,2025-01-02{{ vars.session.day_of_week}}- Current day of week, e.g.,Tuesday{{ vars.session.timezone}}- Agent’s timezone, e.g.,America/Los_Angeles{{ vars.session.language }}- Current language code for the session, e.g.en-US{{ vars.session.source }}- ANI, e.g., “+14085555555”{{ vars.session.target }}- DNIS, e.g., “+16505555555”
Custom Variables
Custom variables are the values you configure on the agent (for example company name, customer name, or other fields you define). Reference them by name with novars. prefix in templates—for example {{ agent_name }} or {{ customer_name }}.
Using {{ vars.<name> }} for a custom agent variable does not work as a shorthand: for example {{ vars.agent_name }} resolves to empty even when agent_name is set. Use {{ agent_name }} instead.
{{ custom_field }}— A user-defined variable configured on the agent (bare name, notvars.custom_fieldfor substitution in prompts and messages)
Usage Examples
In Prompts
Variables can be used within prompt content to create dynamic, personalized instructions:customer_name is not set, {{ customer_name }} becomes Hello (empty string)—the model never sees the double-curly placeholder. With {customer_name}, the placeholder stays literal in the prompt when the value is missing, so the model can see Hello {customer_name} and adapt.
Messages
Create dynamic greeting messages that adapt to different contexts:Tool Descriptions
Make tool descriptions more contextual and informative:Tool Static Parameters
Use variables to set dynamic default values for tool parameters:Best Practices
Choose the right syntax for the context
- Use
{{ variable }}for greetings, tool descriptions, and static parameters when missing values should become empty. - Use
{variable}in prompts when you want the model to see the placeholder when the variable is missing. - Use
${variable=fallback}when you need a default value. Common pitfall:{{foo=bar}}does not work as a default—only${foo=bar}supports default values.
Variable Naming
- Use descriptive, lowercase names with underscores for readability
- Custom agent variables: use the bare name in templates (
{{ customer_name }}), not{{ vars.customer_name }} - System/session fields: always use
vars.session.*(for example{{ vars.session.date }}) - Avoid spaces and special characters in variable names
{{ customer_name }}(custom variable configured on the agent){{ vars.session.agent.name }}(system variable){{ order_number }}(custom variable)
{{ Customer Name }}(spaces){{ vars.customer-name }}(hyphens){{ CUSTOMER_ID }}(all caps)
Error Handling
Variables that cannot be resolved will typically:- Be replaced with blank values when using
{{ variable }}or${variable}(e.g.,Welcome, {{ unknown_var }}!becomesWelcome, !) - Be left as literal text when using
{variable}(e.g.,Hello {name}staysHello {name}ifnameis missing) - Not break the overall functionality
Security Considerations
- Never expose sensitive information through variables
- Validate custom variable values before use
- Be cautious when using variables in tool parameters that make external API calls
Troubleshooting
Variable Not Resolving
If a variable is not replaced or replaced with a blank string instead of its expected value:- Check spelling - Variable names are case-sensitive
- Verify scope - Ensure the variable is available in the current context, for example, a prompt can only reference variables that are available at the start of the session
- Check syntax - Confirm you’re using the intended format:
{{ }},${}, or{}depending on the behavior you want - Validate data source - For custom variables, ensure the data source is properly configured
Variable appears as literal {variable} in output
If you see the placeholder (e.g. {customer_name}) in the final text instead of a value, you are using the {variable} syntax and the variable is missing. That format intentionally leaves the placeholder in place. With {{ customer_name }}, a missing value becomes an empty string—you would not see {{ customer_name }} literally in the output. To get an empty string when the variable is missing, use {{ variable }} or ${variable} instead—or ensure the variable is set.
Syntax comparison and equivalents
{{ variable }}and${variable}both yield an empty string when the variable is missing. Use either when you want missing values to disappear.{variable}is the only format that leaves the placeholder in the text when the variable is missing—useful in prompts where the model should see the placeholder.- Default values are only available with
${variable=default_value}; the{{ }}syntax does not support=default.

