Skip to Content

Instructions & variables

Write the prompt that drives the conversation, and drop call-specific values into it with {{variables}}.

The prompt is the agent. It's what the agent knows, how it behaves, what it collects, and when it should stop. Everything else is configuration around it.

Templates let one agent handle every caller: write {{lead_name}} in the prompt and we fill in the name at call time, so you don't need a separate agent per customer or campaign.

Greet {{lead_name}}. Confirm policy {{vars.policy_id}}.
Today is {{system.timezone.lead}}.

A reference is {{scope.name}}. A reference with no value renders as an empty string, so write prompts that still read correctly when optional context is missing.

Where values come from

ScopeWhat it holdsExample
(unscoped)Per-call variables and a few built-ins{{lead_name}}, {{caller_phone}}
varsThe per-call variables you supplied{{vars.policy_id}}
systemCall identity, agent identity, and time{{system.call_id}}
slotsValues captured earlier in this call{{slots.claim_type}}
toolsResults from tools that ran before the agent spoke{{tools.crm.account_tier}}
paramsArguments the model passed to a tool{{params.policy_number}}
secretsWorkspace secrets, inside tool calls only{{secrets.crm_token}}

Different fields accept different scopes:

SurfaceAllowed scopes
Agent promptunscoped, vars, system, tools
Greeting instructions (generate mode)unscoped, vars, system, tools
Warm transfer briefing_promptunscoped, vars, system, tools, slots, plus briefing-only transfer and call (Briefing instructions)
Tool headers and bodyall scopes
Tool URL path/query and async ack_responseparams, slots, system, vars — never secrets
Pre-call tool templatessystem, vars, secrets (no model involvement yet)

A tool URL can template its path and query, never its scheme, host or port. URL substitution does not percent-encode values, so encode values that need it.

Secrets never appear in prompt text — only inside a tool's own request. A secret reference anywhere the agent could say out loud is rejected when you save.

Fixed greetings, inactivity lines, and end-call farewells are spoken verbatim: template syntax in those fields is rejected. To greet someone by name, use a generated greeting instead of a fixed one.

Passing values in

When you place an outbound call, send a variables object:

{
  "agent_id": "AGENT_ID",
  "to_number": "+12025550100",
  "variables": {
    "lead_name": "Maya",
    "policy_id": "POL-9"
  }
}

Up to 50 variables per call. Names are plain identifiers, values are strings of up to 2,000 bytes. The same object works on browser calls.

Never pass credentials as variables — they're visible in the call record. Use Secrets.

Values captured during the call

A slot is something the call learned. When a tool returns data, you can map a field of its response into a named slot, and from then on {{slots.name}} resolves to it wherever that field accepts slots, such as later tool requests and warm-transfer briefings. The value is captured once and reused exactly, so the agent never has to ask twice.

Slots live for the duration of the call and render empty until something writes them.

Useful system values

VariableWhat it is
call_id, session_idThis call
agent_slug, agent_version_idThe agent that's running
caller_phoneThe caller's number
localeDefaults to en-US
timezone.leadThe current time where the caller is
timestamp_isoThe current time, UTC

For calendar arithmetic, enable Resolve date. The agent should extract the caller's date fields and let the tool calculate, then reuse its exact result. Timestamp variables establish the current time; they do not perform date arithmetic.

Any timezone is available as {{system.timezone.<zone>}}, lowercased with separators as hyphens — {{system.timezone.asia-dubai}}.

Values from SIP headers

If your carrier sends context in SIP headers, you can turn those into variables. Set what the trunk imports on the trunk and reference them as {{system.sip.h.x-customer-id}}, or map a header to a friendlier name:

{
  "inbound_advanced_settings": {
    "include_headers": "x",
    "headers_to_attributes": {
      "X-Customer-ID": "customer_id"
    }
  }
}

Over the API: PATCH /v1/sip-trunks/{id}.

That header is then available as {{customer_id}}.

SIP headers come from outside — the caller or the carrier controls them. Treat the values as untrusted data, never as authorization or as instructions to the agent, and validate anything you forward to your own systems.

Guardrails are not templated

Guardrail rules are literal policy text. Template syntax there is never expanded, so one saved rule means the same thing for every caller and no call data can change the safety rule itself.

That includes an LLM rule's instruction and a static rule's phrases array; variables and secrets are never expanded in either.

Do not use variables or SIP headers as authorization. Header maps replace the whole map on save; resend values you intend to keep. headers_to_attributes imports received headers as values; attributes_to_headers exports values back into SIP signaling and does not create prompt variables.

Writing prompts that hold up

  • Say what to collect, in order. "Get the policy number before incident details" beats a paragraph describing the ideal conversation.
  • Give it an out. Tell the agent what to do when it can't help — transfer, book a callback, or end the call.
  • Test templates on a staging call. Prompt text is rendered, not schema-checked, so a typo in a variable name shows up as a blank rather than an error.
  • Keep it tight. Everything in the prompt costs context on every call; see the baseline check.

See also

Agents · Tools · Outbound calls · Guardrails

On this page