Workflow variables

Move data between blocks and build dynamic automations

What variables are for

Variables shuttle information between blocks while a workflow executes. They let you personalize copy, perform math, and stash intermediate results until you need them again.

Why they matter

Store user-specific facts, pass payloads across stages, compute derived values, and craft responses that adapt to each run.

Variable kinds

Persistent variables

Available across workflows and keep their values between runs

Stored in the Storage resource, which you purchase with credits

Typical uses: Long-lived counters, preferences, or state you must remember

Temporary variables

Exist only while a single workflow execution is running

They are discarded as soon as the workflow finishes

Typical uses: Short-term data such as IDs, text buffers, intermediate math, counters, etc.

Temporary variable limits

  • Up to 30 temporary variables per workflow
  • Each temporary variable may hold any serializable payload
  • Combined footprint during a run must stay under 100 MB
  • When the limit is exceeded, new values cannot be written to temporary storage

Syntax

Reference variables inside block fields using:

{{variable_name}}

At runtime the engine swaps in the live value automatically.

Quick examples

Hello, ! {{username}}
Your ID: {{user_id}}

Naming rules

Allowed characters

  • Latin letters (a–z, A–Z)
  • Digits (0–9) anywhere except the first character
  • Underscores (_)

Invalid examples

  • 1var(starts with a digit)
  • user-name(contains a hyphen)
  • message text(contains a space)
  • @id(contains a special character)

Valid examples

  • counter
  • message_id
  • temp2
  • session_token

Arithmetic

Expressions inside {{ }} follow Python semantics.

Addition

Increase a value by 1
{{a + 1}}

Subtraction

Decrease a value by 3
{{b - 3}}

Multiplication

Double a value
{{count * 2}}

Floor division

Integer division
{{items // 2}}

Modulo

Useful for even/odd checks
{{index % 2}}

String concatenation

Join strings together
{{prefix + "_" + suffix}}

More ideas

Attempt count: {{tries + 1}}
Minutes elapsed: {{duration // 60}}
Message: {{message_text + "!"}}

Note: If a variable holds a string, + performs concatenation instead of numeric addition.

Built-in helper functions

Beyond arithmetic you can call helpers for math, casting, regex utilities, and randomness—all directly inside {{ }} expressions.

max()
max(value1, value2)

Returns the larger of two numbers.

Parameters:

  • value1 — first operand
  • value2 — second operand

Returns:

number (the maximum of the two)

Examples:

{{max(5, 10)}}

Result: 10

{{max(score1, score2)}}

If score1 = 85 and score2 = 92, result: 92

min()
min(value1, value2)

Returns the smaller of two numbers.

Parameters:

  • docs.variables.functions.min.param1
  • docs.variables.functions.min.param2

Returns:

number (the minimum of the two)

Examples:

{{min(5, 10)}}

Result: 5

{{min(price1, price2)}}

If price1 = 500 and price2 = 300, result: 300

round()
round(number, digits)

Rounds a number to the given number of fractional digits.

Parameters:

  • number — value to round
  • digits — decimal places (defaults to 0)

Returns:

floating-point number

Examples:

{{round(3.14159, 2)}}

Result: 3.14

{{round(5.678)}}

Result: 6.0

{{round(price, 2)}}

Round price to two decimals

abs()
abs(number)

Returns the absolute value (magnitude) of a number.

Parameters:

  • number — input value

Returns:

non-negative int or float

Examples:

{{abs(-5)}}

Result: 5

{{abs(3.14)}}

Result: 3.14

{{abs(temperature)}}

If temperature = -15, result: 15

int()
int(value)

Coerces a value to an integer.

Parameters:

  • value — string or number to convert

Returns:

int

Examples:

{{int("42")}}

Result: 42

{{int(3.14)}}

Result: 3

{{int(user_input)}}

Turns the string "100" into 100

str()
str(value)

Coerces a value to a string.

Parameters:

  • value — any input

Returns:

str

Examples:

{{str(123)}}

Result: "123"

{{str(3.14)}}

Result: "3.14"

{{"ID: " + str(order_number)}}

Concatenate text with a number

float()
float(value)

Coerces a value to a floating-point number.

Parameters:

  • value — string or number to convert

Returns:

float

Examples:

{{float("3.14")}}

Result: 3.14

{{float(42)}}

Result: 42.0

{{float(user_input) * 1.2}}

Parse a string, then multiply by 1.2

regex_match()
regex_match(text, pattern)

Returns whether text matches a regular expression.

Parameters:

  • text — string to test
  • pattern — regex string

Returns:

boolean (True or False)

Examples:

{{regex_match("test123", "\d+")}}

Result: True (digits present)

{{regex_match("hello", "^[a-z]+$")}}

Result: True (lowercase letters only)

{{regex_match("123", "[a-z]")}}

Result: False (no letters)

regex_replace()
regex_replace(text, pattern, replacement)

Replaces every regex match in text with replacement.

Parameters:

  • text — source string
  • pattern — regex to find
  • replacement — substitution string

Returns:

updated string

Examples:

{{regex_replace("abc123", "\d+", "456")}}

Result: "abc456"

{{regex_replace("hello world", "\s", "_")}}

Result: "hello_world"

{{regex_replace("test123test", "test", "demo")}}

Result: "demo123demo"

random_number()
random_number(minimum, maximum)

Returns a random integer between minimum and maximum (inclusive).

Parameters:

  • minimum — lower bound (int)
  • maximum — upper bound (int)

Returns:

int

Examples:

{{random_number(1, 10)}}

Random value from 1 through 10

{{random_number(0, 100)}}

Random value from 0 through 100

{{random_number(min_val, max_val)}}

Random value between two variables

random_choice()
random_choice(sequence)

Returns a random element from a sequence (for example a list).

Parameters:

  • sequence — list or other iterable

Returns:

one element from the sequence

Examples:

{{random_choice(["apple", "banana", "orange"])}}

Random fruit from the list

{{random_choice(options)}}

Random item from variable options

{{random_choice([1, 2, 3, 4, 5])}}

Random pick from a numeric set

random_shuffle()
random_shuffle(sequence)

Returns a new list with the same elements in random order (does not modify the original).

Parameters:

  • sequence — list or other iterable

Returns:

list with shuffled elements

Examples:

{{random_shuffle([1, 2, 3, 4, 5])}}

Shuffled numeric list

{{random_shuffle(account_list)}}

Shuffled account list from a variable

{{random_shuffle(["a", "b", "c"])}}

Shuffled string list

Chaining helpers

Nest functions with arithmetic for richer one-liners:

{{abs(balance) + 100}}

Absolute balance plus a hundred

{{round(price * 1.2)}}

Add 20% markup, then round

{{"Max: " + str(max(a, b))}}

Format the larger of two values as text

Variables in Neurallux

Mix persistent and temporary storage depending on the lifetime you need, keep names ASCII-safe, and lean on helpers whenever logic outgrows simple arithmetic.