Skip to main content

What are session variables?

Session variables let you personalize your agent’s behavior for each call by injecting dynamic values into the system prompt. Use them to pass caller-specific data like names, order numbers, or account details.

Syntax

Use double curly braces in your instructions to define variables:
Hello {{ customer_name }}, I'm calling about your order {{ order_id }}.
Your account status is {{ account_status }}.

How it works

1

Define variables in instructions

Write your system prompt using {{ variable_name }} placeholders wherever you want dynamic data.
2

Variables are auto-detected

Sonara automatically detects all {{ }} placeholders in your instructions and lists them in the Session Variables section.
3

Set values

You can set default values for each variable in the configuration. When making calls via API or batch calling, you can override these values per call.
4

Values are injected at runtime

When a call starts, Sonara replaces all variable placeholders with their actual values before sending the prompt to the LLM.

Use cases

VariableExample valueUse case
{{ customer_name }}”Sarah”Personalized greetings
{{ order_id }}”ORD-12345”Order-specific support
{{ company_name }}”Acme Corp”Multi-tenant agent
{{ appointment_date }}”March 15, 2025”Appointment reminders
{{ language }}”Spanish”Language preference

Example

You are a support agent for {{ company_name }}.

The caller is {{ customer_name }} with account #{{ account_id }}.
Their current plan is {{ plan_name }}.

Help them with any questions about their account. If they want to
upgrade, explain the benefits of the next tier up.
Session variables are especially powerful when combined with batch calling, where each row in your CSV can supply different values for each call.