---
title: "Variables"
description: "Liquid templates and path bindings that pass dynamic data through the workspace."
canonical_url: "https://docs.vettero.com/concepts/variables"
---
# Variables

> Liquid templates and path bindings that pass dynamic data through the workspace.

**Variables** in Vettero are how you pass dynamic data through the workspace. You use two related patterns for values that change at runtime, plus workspace [environment variables](https://docs.vettero.com/configuration/environment-variables) for shared config and secrets:

<table>
<thead>
  <tr>
    <th>
      Pattern
    </th>
    
    <th>
      What it is
    </th>
    
    <th>
      How you write it
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/configuration/environment-variables">
          Environment variables
        </a>
      </strong>
    </td>
    
    <td>
      Workspace key/value config and secrets
    </td>
    
    <td>
      <code>
        env.API_KEY
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Liquid templates
      </strong>
    </td>
    
    <td>
      <a href="https://liquidjs.com/" rel="nofollow">
        LiquidJS
      </a>
      
       text rendered against the execution context
    </td>
    
    <td>
      <code>
        {{ args.name }}
      </code>
      
      , <code>
        {% if %}
      </code>
      
      , filters
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Path bindings
      </strong>
    </td>
    
    <td>
      Point a builder field at a runtime value instead of a literal
    </td>
    
    <td>
      <code>
        args.email
      </code>
      
      , <code>
        pipe.value
      </code>
      
      , <code>
        myVar
      </code>
    </td>
  </tr>
</tbody>
</table>

Use them whenever a field or template needs values from inputs, session context, upstream steps, or shared secrets — without hardcoding them.

## When to use

- Store API keys and shared config once under [Environment Variables](https://docs.vettero.com/configuration/environment-variables) and reference them as `env.*`
- Render dynamic text with Liquid wherever templates are supported
- Wire structured builder fields to dynamic data with path bindings
- Hold intermediate values in a workflow with **Set Variables** / **Update Variables**

## Write Liquid templates

Vettero renders text fields with **LiquidJS** — the same templating language used across many surfaces (message bodies, agent Task/Input, chat widgets, templates, **Create Text**, calendar/email fields, and other Liquid-enabled block inputs). Editors that support it highlight Liquid and often autocomplete when you type `{{`.

The runtime resolves variables from the **current execution context** (the same namespaces as path bindings: `args`, `env`, `session`, `pipe`, named vars, and so on — what is in scope depends on where the template runs).

### Output

Interpolate a value with double curly braces:

```liquid
Hello {{ args.name }}
Order {{ args.order.id }} — status {{ args.order.status }}
Key: {{ env.API_KEY }}
```

Missing variables render empty (strict variables are off). Dot paths and array indexes work the same way as elsewhere in Vettero (`items.0.title`).

### Tags

Use `{% … %}` for control flow, loops, and assignment. Common tags:

<table>
<thead>
  <tr>
    <th>
      Tag
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        {% if %}
      </code>
      
       / <code>
        {% elsif %}
      </code>
      
       / <code>
        {% else %}
      </code>
      
       / <code>
        {% endif %}
      </code>
    </td>
    
    <td>
      Conditional branches
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% unless %}
      </code>
      
       / <code>
        {% endunless %}
      </code>
    </td>
    
    <td>
      Inverse condition
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% case %}
      </code>
      
       / <code>
        {% when %}
      </code>
      
       / <code>
        {% else %}
      </code>
      
       / <code>
        {% endcase %}
      </code>
    </td>
    
    <td>
      Switch-style branches
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% for item in collection %}
      </code>
      
       / <code>
        {% endfor %}
      </code>
    </td>
    
    <td>
      Iterate arrays/collections (<code>
        forloop
      </code>
      
       helpers available)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% assign name = value %}
      </code>
    </td>
    
    <td>
      Set a local template variable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% capture name %}…{% endcapture %}
      </code>
    </td>
    
    <td>
      Capture a string into a variable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% comment %}…{% endcomment %}
      </code>
    </td>
    
    <td>
      Block comments
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        {% raw %}…{% endraw %}
      </code>
    </td>
    
    <td>
      Leave Liquid syntax unparsed
    </td>
  </tr>
</tbody>
</table>

Example:

```liquid
{% if args.vip %}
Welcome back, {{ args.name }}.
{% else %}
Hello {{ args.name }}.
{% endif %}

{% for item in args.items %}
- {{ item.title }} ({{ item.qty }})
{% endfor %}
```

### Filters

Pipe values through filters with `|`. Unknown filters fail at render time (`strictFilters` is on). LiquidJS ships the usual filter set — for example:

```liquid
{{ args.name | upcase }}
{{ args.name | downcase | strip }}
{{ args.price | plus: 10 }}
{{ args.items | size }}
{{ args.tags | join: ", " }}
{{ args.createdAt | date: "%Y-%m-%d" }}
{{ args.bio | default: "No bio" }}
{{ args.html | escape }}
```

Chain filters left to right: `{{ args.title | strip | truncate: 40 }}`.

### Includes (templates)

Workspace [templates](https://docs.vettero.com/templates/templates) can embed another template by key:

```liquid
{% include "header_partial" %}
```

That `include` path is specific to the template renderer. Elsewhere, stick to output, tags, and filters against the local context.

WhatsApp template placeholders (`{{1}}`, `{{2}}`) are **not** Liquid — see [WhatsApp Templates](https://docs.vettero.com/templates/whatsapp-templates).

### Limits and behavior

- Rendered against the **active context** only — do not invent paths that are not in scope.
- Standard LiquidJS tags and filters are supported; prefer documented LiquidJS syntax over custom dialects.
- Engine safeguards apply (parse/render/memory limits). Relative file includes are not a general filesystem feature outside email-template `include`.
- WhatsApp template placeholders (`{{1}}`, `{{2}}`) are Meta-style slots, **not** Liquid — do not mix them with named Liquid variables.

For the full language reference, see [LiquidJS](https://liquidjs.com/).

## Bind fields to variable paths

In workflows, queries, mappings, and many block fields, you choose a **literal** or a **variable path**. Paths are dotted strings resolved against the current execution context — for example `args.email` or `items.0.name`. Do **not** wrap path bindings in `{{ }}`.

<table>
<thead>
  <tr>
    <th>
      Prefix / form
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        args.*
      </code>
    </td>
    
    <td>
      Inputs for the current agent, workflow, query, event, or callback scope
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        env.*
      </code>
    </td>
    
    <td>
      Workspace <a href="https://docs.vettero.com/configuration/environment-variables">
        environment variables
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pipe.value
      </code>
      
       / <code>
        pipe.*
      </code>
    </td>
    
    <td>
      Output of the upstream block on the data pipe
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ctx.*
      </code>
    </td>
    
    <td>
      Extra context for a single resolve or template render — not loop item/index.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        session.*
      </code>
    </td>
    
    <td>
      Chat session fields in conversational flows
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        global.now
      </code>
    </td>
    
    <td>
      Built-in current date/time
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ctx.prompts.*
      </code>
    </td>
    
    <td>
      Built-in channel prompt snippets in agent Task/Input (<code>
        ctx.prompts.voice
      </code>
      
      , <code>
        ctx.prompts.whatsapp
      </code>
      
      , <code>
        ctx.prompts.webChat
      </code>
      
      , <code>
        ctx.prompts.email
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      Bare key (for example <code>
        myVar
      </code>
      
      )
    </td>
    
    <td>
      Named variable defined earlier in the same run
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        res.*
      </code>
    </td>
    
    <td>
      Mapped resource output in some mapping UIs
    </td>
  </tr>
</tbody>
</table>

Which namespaces are valid depends on the parent block or resource. Missing paths resolve to empty/`undefined`.

Array elements use numeric segments: `rows.2.status`.

## Set variables in workflows

In the workflow builder, under **basic → context**:

<table>
<thead>
  <tr>
    <th>
      Block
    </th>
    
    <th>
      What it does
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Set Variables
      </strong>
    </td>
    
    <td>
      Create named keys in the current (local) scope
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Update Variables
      </strong>
    </td>
    
    <td>
      Change existing named keys wherever they already live
    </td>
  </tr>
</tbody>
</table>

You can also set starting names on [Start](https://docs.vettero.com/build/workflows/blocks/module/start) and [Lambda](https://docs.vettero.com/build/workflows/blocks/module/lambda).

Names must be valid **Liquid** and **JavaScript** identifiers: start with a letter or underscore, then only letters, digits, and underscores (`total`, `order_id`). Do not use hyphens, dots, spaces, or reserved roots such as `args`, `env`, `session`, `pipe`, `ctx`, `global`, and `error`.

Downstream steps can read those keys as bare paths (`myVar`, `myVar.items.0.id`) or inside Liquid (`{{ myVar }}`). They stay in the run context; they are not workspace resources like env vars.

## Liquid vs path bindings

<table>
<thead>
  <tr>
    <th>
      Context
    </th>
    
    <th>
      Syntax
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Template / text
      </strong>
      
       fields
    </td>
    
    <td>
      Full Liquid: <code>
        {{ … }}
      </code>
      
      , <code>
        {% … %}
      </code>
      
      , filters
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Structured
      </strong>
      
       builder fields
    </td>
    
    <td>
      Path only: <code>
        args.field
      </code>
      
      , <code>
        env.KEY
      </code>
      
       (literal vs variable toggle)
    </td>
  </tr>
</tbody>
</table>

Mixing them breaks resolution — a path field whose value is `{{ args.field }}` will not run as Liquid.

## Where variables are used

<table>
<thead>
  <tr>
    <th>
      Place
    </th>
    
    <th>
      How
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Liquid-enabled text
      </strong>
    </td>
    
    <td>
      Message bodies, Task/Input, <strong>
        Create Text
      </strong>
      
      , chat widgets, templates, calendar/email fields, and similar
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/build/agents">
          Agents
        </a>
      </strong>
    </td>
    
    <td>
      Liquid in Task/Input; <code>
        args
      </code>
      
       schema; <code>
        env.*
      </code>
      
      ; <code>
        ctx.prompts.*
      </code>
      
       channel snippets
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/build/workflows">
          Workflows
        </a>
      </strong>
    </td>
    
    <td>
      Path bindings on blocks; Set / Update Variables; Liquid on text outputs
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/build/queries">
          Queries
        </a>
        
         & mappings
      </strong>
    </td>
    
    <td>
      Filters and field bindings as literals or paths
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/build/chat-widgets">
          Chat widgets
        </a>
      </strong>
    </td>
    
    <td>
      Liquid HTML templates
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/build/functions">
          Functions
        </a>
      </strong>
    </td>
    
    <td>
      Receive structured <code>
        args
      </code>
      
      ; bind resources separately
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/templates/templates">
          Templates
        </a>
      </strong>
    </td>
    
    <td>
      Liquid bodies; <code>
        env.*
      </code>
      
       and <code>
        {% include %}
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        <a href="https://docs.vettero.com/configuration/environment-variables">
          Environment variables
        </a>
      </strong>
    </td>
    
    <td>
      Create and manage <code>
        env.*
      </code>
      
       keys
    </td>
  </tr>
</tbody>
</table>

## Limits

- Prefer **Secret** env vars and `env.*` references for credentials — avoid literals in shared configs. See [Environment Variables](https://docs.vettero.com/configuration/environment-variables).
- `pipe.*` is the current block’s data pipe. `ctx.*` is extra context for one resolve/render — not persisted.
- Liquid templates and path bindings are different surfaces; WhatsApp `{{1}}` is a third, separate system.


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
