Search documentation

Search for pages in the documentation

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

VariableDescription
forloop.indexCurrent iteration (1-based)
forloop.index0Current iteration (0-based)
forloop.firstTrue if first iteration
forloop.lastTrue if last iteration
forloop.lengthTotal 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

FilterDescriptionExample
upcaseUPPERCASE{{ "hello" | upcase }} → "HELLO"
downcaselowercase{{ "HELLO" | downcase }} → "hello"
capitalizeFirst letter caps{{ "hello" | capitalize }} → "Hello"
stripRemove whitespace{{ " hi " | strip }} → "hi"
truncateLimit length{{ "hello world" | truncate: 8 }} → "hello..."
truncatewordsLimit words{{ "hello world" | truncatewords: 1 }} → "hello..."
replaceReplace text{{ "hello" | replace: "e", "a" }} → "hallo"
removeRemove text{{ "hello" | remove: "l" }} → "heo"
appendAdd to end{{ "hello" | append: "!" }} → "hello!"
prependAdd to start{{ "world" | prepend: "hello " }} → "hello world"
splitSplit 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

FilterDescriptionExample
sizeArray length{{ array | size }}
firstFirst element{{ array | first }}
lastLast element{{ array | last }}
joinJoin with separator{{ array | join: ", " }}
sortSort array{{ array | sort }}
reverseReverse order{{ array | reverse }}
uniqRemove duplicates{{ array | uniq }}
mapExtract property{{ objects | map: "name" }}
whereFilter by property{{ array | where: "active", true }}
compactRemove 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

FilterDescriptionExample
plusAdd{{ 1 | plus: 1 }} → 2
minusSubtract{{ 5 | minus: 2 }} → 3
timesMultiply{{ 3 | times: 4 }} → 12
divided_byDivide{{ 10 | divided_by: 2 }} → 5
moduloRemainder{{ 10 | modulo: 3 }} → 1
roundRound{{ 3.7 | round }} → 4
ceilRound up{{ 3.1 | ceil }} → 4
floorRound down{{ 3.9 | floor }} → 3
absAbsolute value{{ -5 | abs }} → 5

Date Filters

FilterDescriptionExample
dateFormat date{{ date | date: "%B %d, %Y" }}

Format Codes:

CodeOutputExample
%Y4-digit year2024
%mMonth (01-12)01
%dDay (01-31)15
%HHour 24h (00-23)14
%MMinute (00-59)30
%SSecond (00-59)45
%IHour 12h (01-12)02
%pAM/PMPM
%BFull monthJanuary
%bShort monthJan
%AFull weekdayMonday
%aShort weekdayMon

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

FilterDescription
defaultDefault if empty/null
escapeHTML escape
jsonConvert 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 %}