Liquid Template Reference
Complete reference for Liquid templating syntax
Liquid is the templating language used throughout Agents for generating dynamic text content, messages, and formatted outputs.
Basic Syntax
Output Tags
Output tags insert values into text:
liquid
{{ variable }}
{{ object.property }}
{{ array[0] }}
Examples:
liquid
Meeting: {{ json.meeting.title }}
Score: {{ json.value }}
First attendee: {{ json.meeting.attendees[0].name }}
Logic Tags
Logic tags control flow without outputting text:
liquid
{% if condition %}...{% endif %}
{% for item in array %}...{% endfor %}
{% assign variable = value %}
Available Objects
json
Output from the upstream node:
liquid
{{ json }} // Full output
{{ json.meeting }} // Meeting object
{{ json.meeting.title }} // Meeting title
{{ json.meeting.startTime }} // Start time
{{ json.meeting.attendees }} // Attendees array
{{ json.callRecording.transcriptSummary }} // Transcript
{{ json.value }} // AI output
trigger
Event trigger data:
liquid
{{ trigger.eventType }} // Event type
{{ trigger.meetingId }} // Meeting ID
{{ trigger.timestamp }} // Event time
author
Current user information:
liquid
{{ author.name }} // User's name
{{ author.email }} // User's email
organization
Organization information:
liquid
{{ organization.name }} // Org name
{{ organization.id }} // Org ID
steps (Multi-node Workflows)
Access output from named steps:
liquid
{{ steps.summary.value }} // Output from "summary" step
{{ steps.actionItems.value }} // Output from "actionItems" step
Control Flow
If / Else
liquid
{% if condition %}
Show this
{% elsif other_condition %}
Show this instead
{% else %}
Default content
{% endif %}
Examples:
liquid
{% if json.urgent %}
šØ *URGENT*
{% endif %}
{% if json.score >= 7 %}
ā
Positive meeting
{% elsif json.score >= 4 %}
š Neutral meeting
{% else %}
ā ļø Concerning signals
{% endif %}
Unless
liquid
{% unless condition %}
Show if condition is false
{% endunless %}
Example:
liquid
{% unless json.callRecording %}
No recording available for this meeting.
{% endunless %}
Case / When
liquid
{% case variable %}
{% when "value1" %}
Content for value1
{% when "value2" %}
Content for value2
{% else %}
Default content
{% endcase %}
Example:
liquid
{% case json.meeting.type %}
{% when "discovery" %}
š Discovery Call
{% when "demo" %}
š¬ Product Demo
{% when "negotiation" %}
š° Negotiation
{% else %}
š
Meeting
{% endcase %}
Loops
For Loop
liquid
{% for item in array %}
{{ item }}
{% endfor %}
With index:
liquid
{% for item in array %}
{{ forloop.index }}. {{ item }}
{% endfor %}
For Loop Variables
| Variable | Description |
|---|---|
forloop.index | Current iteration (1-based) |
forloop.index0 | Current iteration (0-based) |
forloop.first | True if first iteration |
forloop.last | True if last iteration |
forloop.length | Total iterations |
Examples:
liquid
*Attendees:*
{% for attendee in json.meeting.attendees %}
{{ forloop.index }}. {{ attendee.name }}{% unless forloop.last %}, {% endunless %}
{% endfor %}
*Action Items:*
{% for item in json.value %}
⢠{{ item }}
{% endfor %}
Loop Controls
liquid
{% for item in array limit: 5 %} // Limit iterations
{% for item in array offset: 2 %} // Skip first 2
{% for item in array reversed %} // Reverse order
Example:
liquid
*Top 3 Priorities:*
{% for item in json.priorities limit: 3 %}
{{ forloop.index }}. {{ item }}
{% endfor %}
Filters
Filters transform values using the pipe (|) syntax:
liquid
{{ value | filter }}
{{ value | filter: argument }}
{{ value | filter1 | filter2 }}
String Filters
| Filter | Description | Example |
|---|---|---|
upcase | UPPERCASE | {{ "hello" | upcase }} ā "HELLO" |
downcase | lowercase | {{ "HELLO" | downcase }} ā "hello" |
capitalize | First letter caps | {{ "hello" | capitalize }} ā "Hello" |
strip | Remove whitespace | {{ " hi " | strip }} ā "hi" |
truncate | Limit length | {{ "hello world" | truncate: 8 }} ā "hello..." |
truncatewords | Limit words | {{ "hello world" | truncatewords: 1 }} ā "hello..." |
replace | Replace text | {{ "hello" | replace: "e", "a" }} ā "hallo" |
remove | Remove text | {{ "hello" | remove: "l" }} ā "heo" |
append | Add to end | {{ "hello" | append: "!" }} ā "hello!" |
prepend | Add to start | {{ "world" | prepend: "hello " }} ā "hello world" |
split | Split to array | {{ "a,b,c" | split: "," }} ā ["a","b","c"] |
Examples:
liquid
{{ json.meeting.title | upcase }}
{{ json.notes | truncate: 100 }}
{{ json.summary | replace: "\n", " " }}
Array Filters
| Filter | Description | Example |
|---|---|---|
size | Array length | {{ array | size }} |
first | First element | {{ array | first }} |
last | Last element | {{ array | last }} |
join | Join with separator | {{ array | join: ", " }} |
sort | Sort array | {{ array | sort }} |
reverse | Reverse order | {{ array | reverse }} |
uniq | Remove duplicates | {{ array | uniq }} |
map | Extract property | {{ objects | map: "name" }} |
where | Filter by property | {{ array | where: "active", true }} |
compact | Remove nulls | {{ array | compact }} |
Examples:
liquid
Attendees: {{ json.meeting.attendees | map: "name" | join: ", " }}
Count: {{ json.items | size }}
External: {% assign external = json.meeting.attendees | where: "internal", false %}
{{ external | map: "name" | join: ", " }}
Number Filters
| Filter | Description | Example |
|---|---|---|
plus | Add | {{ 1 | plus: 1 }} ā 2 |
minus | Subtract | {{ 5 | minus: 2 }} ā 3 |
times | Multiply | {{ 3 | times: 4 }} ā 12 |
divided_by | Divide | {{ 10 | divided_by: 2 }} ā 5 |
modulo | Remainder | {{ 10 | modulo: 3 }} ā 1 |
round | Round | {{ 3.7 | round }} ā 4 |
ceil | Round up | {{ 3.1 | ceil }} ā 4 |
floor | Round down | {{ 3.9 | floor }} ā 3 |
abs | Absolute value | {{ -5 | abs }} ā 5 |
Date Filters
| Filter | Description | Example |
|---|---|---|
date | Format date | {{ date | date: "%B %d, %Y" }} |
Format Codes:
| Code | Output | Example |
|---|---|---|
%Y | 4-digit year | 2024 |
%m | Month (01-12) | 01 |
%d | Day (01-31) | 15 |
%H | Hour 24h (00-23) | 14 |
%M | Minute (00-59) | 30 |
%S | Second (00-59) | 45 |
%I | Hour 12h (01-12) | 02 |
%p | AM/PM | PM |
%B | Full month | January |
%b | Short month | Jan |
%A | Full weekday | Monday |
%a | Short weekday | Mon |
Examples:
liquid
{{ json.meeting.startTime | date: "%B %d, %Y" }}
// January 15, 2024
{{ json.meeting.startTime | date: "%I:%M %p" }}
// 02:30 PM
{{ json.meeting.startTime | date: "%A, %B %d at %I:%M %p" }}
// Monday, January 15 at 02:30 PM
Other Filters
| Filter | Description |
|---|---|
default | Default if empty/null |
escape | HTML escape |
json | Convert to JSON |
Examples:
liquid
{{ json.notes | default: "No notes provided" }}
{{ json.content | escape }}
{{ json.data | json }}
Variables
Assign
liquid
{% assign variable = value %}
{% assign name = json.meeting.title %}
{% assign count = json.items | size %}
Capture
Capture blocks of text:
liquid
{% capture summary %}
Meeting: {{ json.meeting.title }}
Date: {{ json.meeting.startTime | date: "%B %d" }}
{% endcapture %}
{{ summary }}
Common Patterns
Conditional Display
liquid
{% if json.callRecording %}
š¹ Recording available
{{ json.callRecording.transcriptSummary }}
{% else %}
No recording for this meeting
{% endif %}
List Formatting
liquid
*Attendees ({{ json.meeting.attendees | size }}):*
{% for attendee in json.meeting.attendees %}
⢠{{ attendee.name }}{% if attendee.title %} - {{ attendee.title }}{% endif %}
{% endfor %}
Inline Lists
liquid
Attendees: {{ json.meeting.attendees | map: "name" | join: ", " }}
Numbered Lists
liquid
{% for item in json.value %}
{{ forloop.index }}. {{ item }}
{% endfor %}
Filtering Arrays
liquid
{% assign external = json.meeting.attendees | where: "internal", false %}
{% if external.size > 0 %}
*External Attendees:*
{% for person in external %}
⢠{{ person.name }} ({{ person.company }})
{% endfor %}
{% endif %}
Safe Property Access
liquid
{% if json.callRecording and json.callRecording.transcriptSummary %}
{{ json.callRecording.transcriptSummary }}
{% else %}
No transcript available
{% endif %}
Formatted Dates
liquid
*Meeting Details*
Date: {{ json.meeting.startTime | date: "%A, %B %d, %Y" }}
Time: {{ json.meeting.startTime | date: "%I:%M %p" }}
Duration: {{ json.meeting.durationMinutes }} minutes
Slack Formatting
Slack uses mrkdwn format:
text
*Bold text*
_Italic text_
~Strikethrough~
`Code`
> Quote
<url|link text>
<@userid> (mention user)
<#channelid> (mention channel)
Example Slack Message:
liquid
š *Meeting Summary: {{ json.meeting.title }}*
*Date:* {{ json.meeting.startTime | date: "%B %d at %I:%M %p" }}
*Attendees:* {{ json.meeting.attendees | map: "name" | join: ", " }}
> {{ json.value }}
{% if json.actionItems.size > 0 %}
*Action Items:*
{% for item in json.actionItems %}
⢠{{ item }}
{% endfor %}
{% endif %}
Debugging Tips
Check for Null
liquid
{% if json.callRecording %}
Has recording: {{ json.callRecording.transcriptSummary }}
{% else %}
No recording
{% endif %}
Output Raw JSON
liquid
Debug: {{ json | json }}
Check Array Size
liquid
Items: {{ json.items | size }}
{% if json.items.size > 0 %}
Has items
{% endif %}