Documentation is being updated. Some sections may not reflect the latest features.
Looking for step-by-step guides? Explore Tutorials →

Variables Overview

Understanding how data flows through your workflows.

What are Variables?

Variables are containers that hold data as it moves through your workflow. Each node can read from and write to variables, creating a data pipeline that transforms and enriches information at each step.

Template Engine

Ubex uses Pongo2, a powerful Django/Jinja2-style template engine. This means you get more than simple variable substitution - you can use conditionals, loops, and filters directly in your prompts and configurations.

{% for item in items %}
  {{ item.name | upper }}: {{ item.value }}
{% endfor %}

See Template Syntax for the full reference.

Variable Types

Type Description Example
String Text data "Hello world"
Number Integers and decimals 42, 3.14
Boolean True/false values true, false
Array Lists of items ["a", "b", "c"]
Object Key-value pairs (JSON) {"name": "John", "age": 30}

How Variables Flow

  1. Trigger - Initial data enters the workflow (API payload, chat message, etc.)
  2. Nodes - Each node can read input variables and produce output variables
  3. Output - Final variables are returned or stored
[Trigger] → input_data
    ↓
[Model Node] → reads input_data, outputs llm_response
    ↓
[HTTP Node] → reads llm_response, outputs api_result
    ↓
[Output] → returns api_result

Accessing Variables

Use double curly braces to reference variables:

{{ variable_name }}
{{ user.profile.name }}
{{ items[0].title }}

Built-in Variables

These variables are automatically available in every workflow:

Variable Description
{{ execution_id }} Unique ID for this execution
{{ timestamp }} Current UTC timestamp
{{ workflow_id }} ID of the current workflow
{{ trigger_type }} How the workflow was triggered

Output Variables

Each node stores its result in an output variable. You define the variable name in the node configuration:

  • Model Node → {{ llm_response }}
  • HTTP Node → {{ api_response }}
  • Database Node → {{ query_result }}
  • Code Node → {{ code_output }}

Tips

  • Use descriptive variable names: customer_data not data1
  • Check the output of previous nodes in the execution log
  • Use {{ variable | default:"fallback" }} to handle missing values
  • Arrays from database queries can be looped with {% for row in results %}
AI AssistantPowered by Ubex
Beta
Ask me anything about Ubex workflows, nodes, or the API.