> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heysonara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Variables

> Inject dynamic data into your agent's instructions at runtime.

## 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

<Steps>
  <Step title="Define variables in instructions">
    Write your system prompt using `{{ variable_name }}` placeholders wherever you want dynamic data.
  </Step>

  <Step title="Variables are auto-detected">
    Sonara automatically detects all `{{ }}` placeholders in your instructions and lists them in the **Session Variables** section.
  </Step>

  <Step title="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.
  </Step>

  <Step title="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.
  </Step>
</Steps>

## Use cases

| Variable                 | Example value    | Use 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.
```

<Info>
  Session variables are especially powerful when combined with **batch calling**, where each row in your CSV can supply different values for each call.
</Info>
