Skip to content

Template variables

In a workflow's message body, prompt, execute-if condition, and similar fields, you can use template variables to embed results and run information from earlier steps. Select Insert variable in the input field to choose from the available variables.

The syntax is based on the Liquid template language. The maximum template string length depends on the field (up to 5,000 characters for body/prompt fields, and up to 100 characters for execute-if conditions).

Variables

Insert variable lets you choose from the following groups. You can only reference the output of steps before the current one. Templates wrap a path in double curly braces.

TIP

Example: the workflow run ID is {{ run.id }}, and the query's row count is {{ query.rowCount }}.

Workflow run

LabelPathDescription
Workflow Run IDrun.idThe ID of the run
Start Timerun.startedAtThe start time of the run
Trigger Typerun.triggerschedule or manual

Earlier steps

Suggested variables depend on the step type. The identifier is the step ID (for example, query, or query_1 if there are multiple).

StepKey variables
Run QueryRow count (rowCount), each column of the First Row, Rows (a loop over rows, up to 20)
Run ReportRun ID (runId)
ScreenshotFile URL (fileUrl), for attachments
SlackMessage Timestamp (messageTs), for specifying a thread
LLMText, and usage (prompt/completion/total tokens)

Column suggestions for Run Query's First Row appear if you've run the target query and saved it beforehand.

Example

An example that includes the row count and the first few rows of a query result in a message. You can insert similar content from Row count and Rows in Insert variable.

liquid
Count: {{ query.rowCount }}
{% for row in query.rows limit:5 %}
- {{ row.account_name }}
{% endfor -%}

Execute-if condition

Writing an expression in a step's optional Execute if field runs that step only when the condition is true. The placeholder example compares whether the row count is greater than 0 (you can enter this by choosing Row count in Insert variable).

The condition is evaluated after template variables are expanded. If left blank, the step runs when there's no failure in earlier steps, and is skipped otherwise (it runs only on implicit success).

You can use the following functions in a condition expression.

FunctionMeaning
success()True when there's no failure in earlier steps
failure()True when an earlier step failed. Useful for error-notification steps
always()Always true. Useful for steps you want to run even after a failure

You can combine these with AND / OR and comparisons (> / = and so on). A condition that doesn't include a status function is skipped if an earlier step failed.