Skip to content
TriedDocs
Build agents

Dynamic variables

Personalise every call with {{variables}}, use the built-in system variables, pass values through the API, and capture new values during the call.

Dynamic variables are placeholders written as {{name}}. Tried replaces them with string values at run time, so one agent can greet each caller by name, quote their appointment time or call a different API per customer.

Hi {{first_name}}, this is Ava from {{business_name}}. I'm calling about your appointment on {{appointment_date}}.

Syntax#

  • Write {{name}}. Spaces inside the braces are allowed: {{ name }}.
  • Names can use letters, numbers, _, ., +, / and -.
  • Values are strings. Numbers and booleans you pass are converted to text.
  • A variable with no value is left as written, braces included. The agent would read "{{first_name}}" aloud, so always set a default for variables a prompt depends on.
  • Variables are not nested: a value that itself contains {{...}} is not expanded again.

In the prompt editor, type {{ to open Insert variable.

Where variables work#

Place Examples
Prompts General prompt, state prompts, flow global prompt and node instructions
Messages Static welcome message, voicemail message, guardrail fallback message
Functions URLs, headers, query parameters, parameter descriptions, transfer numbers, SMS text
Flow conditions Equation edges compare variables, for example {{tier}} == gold
Transcription Boosted Keywords
Telephony Custom SIP headers on create-phone-call
Webhooks The agent webhook URL
Workflows Step URLs, bodies, arguments and conditions

Set values#

Defaults on the agent#

Security & Fallback Settings, Default Dynamic Variables sets values used when a call does not provide one. They are stored in default_dynamic_variables on the Retell LLM or conversation flow.

Default Dynamic Variables under Security & Fallback Settings

Per call through the API#

Pass retell_llm_dynamic_variables when you start a call:

curl https://api.tried.com.au/v2/create-phone-call \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from_number": "+61355505030",
    "to_number": "+61412555019",
    "retell_llm_dynamic_variables": { "first_name": "Sam", "appointment_date": "Tuesday the 21st at 4pm" }
  }'
await fetch("https://api.tried.com.au/v2/create-phone-call", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    from_number: "+61355505030",
    to_number: "+61412555019",
    retell_llm_dynamic_variables: { first_name: "Sam", appointment_date: "Tuesday the 21st at 4pm" },
  }),
});
import os, requests

requests.post(
    "https://api.tried.com.au/v2/create-phone-call",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={
        "from_number": "+61355505030",
        "to_number": "+61412555019",
        "retell_llm_dynamic_variables": {"first_name": "Sam", "appointment_date": "Tuesday the 21st at 4pm"},
    },
)

The same field is accepted by Create web call, Register phone call, each task of a batch call, and chats. In a batch CSV, every column after the phone number becomes a variable.

Inbound calls#

For inbound calls, the number's inbound webhook can return variables before the agent answers, and a pre-call workflow can fetch them. Inbound SIP headers that start with X-, plus Diversion, History-Info, P-Asserted-Identity and User-to-User, become variables named after the header in lower case, such as {{x-customer-id}}.

Contacts#

Phone calls are linked to a contact. The contact's fields become variables: {{first_name}}, {{last_name}}, {{contact_email}}, {{do_not_call}} and every custom field. With contact memory reading on, {{contact_memory}} holds the memory brief. See Contact memory.

Environment tags#

Each environment tag (such as prod or staging) can carry its own variable values, used by calls that run through that tag. See Versions and environments.

During the call#

Values collected during the call are added as they arrive:

  • The Extract Dynamic Variable function, and extract nodes in flows.
  • response_variables on custom, code, MCP and integration app functions, which copy fields from the result.
  • Values passed with a multi-prompt transition.
  • Replies to an SMS sent with an info-collection template.

They are stored on the call in collected_dynamic_variables.

On a live call#

Update live call sets override_dynamic_variables on an ongoing call. The agent sees them from the next turn.

curl -X PATCH https://api.tried.com.au/update-live-call/call_8d2f0c1e9b7a6543210fedcb \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "override_dynamic_variables": { "order_status": "shipped" } }'

Precedence#

When the same name is set in several places, the later source in this list wins:

  1. Agent defaults (default_dynamic_variables)
  2. Environment tag values
  3. Contact fields
  4. Values passed when the call was created (retell_llm_dynamic_variables, inbound webhook, pre-call workflow)
  5. Values collected during the call
  6. Live overrides from update-live-call

System variables are filled by the runtime and are always available.

System variables#

Variable Value
{{current_time}} Now in the agent's timezone, for example Tuesday, October 21, 2026 at 04:05 PM AEDT
{{current_time_<zone>}} Now in any IANA zone, for example {{current_time_America/New_York}}
{{current_hour}}, {{current_hour_<zone>}} The hour, 00 to 23
{{current_calendar}}, {{current_calendar_<zone>}} The next 14 dates, one per line, starting today
{{current_time_ms}} Now as Unix epoch milliseconds
{{system_timezone}} The agent's timezone
{{call_id}} The call ID
{{call_type}} phone_call or web_call
{{session_type}} voice, or chat in chats
{{chat_id}} The chat ID, in chats
{{direction}} inbound or outbound
{{user_number}} The caller's number (the callee on outbound calls)
{{agent_number}} The agent's number
{{session_duration}} Time since the call started, for example 3 minutes 12 seconds
{{session_duration_ms}} The same in milliseconds
{{current_agent_state}}, {{previous_agent_state}} Multi-prompt state names
{{current_node}}, {{previous_node}} Current and previous conversation flow node

The timezone comes from the agent's Timezone under Agent Settings (default Australia/Sydney).

Read values after the call#

The call object has:

  • retell_llm_dynamic_variables: the values the call started with.
  • collected_dynamic_variables: the values captured during the call.

Use them in webhooks, analytics filters and QA cohorts. List calls can filter on variables with filter_criteria.fields and source: "dynamic_variable".

Test with variables#

The { } button in the test panel opens Dynamic variables. Values set there are used by Test LLM, Test Audio and the simulated caller.