Skip to main content
Beta
Loops are in beta and require the Developer Toolkit. To join the beta, email [email protected].

Loops

A loop is a record that stays open for as long as a piece of work does: a bill waiting to be paid, a sales conversation, a vendor, or a PSA ticket you are tracking. Most automations finish in minutes. A loop can sit untouched for months, check itself on a schedule, and receive updates from any other automation.

When your PSA can track the state of the work, it stays the system of record. Use a loop when the work goes beyond what your PSA can track, such as keeping two PSAs in sync, following a sales conversation that does not need a ticket, or running a process with many steps over several weeks. The loop then becomes the system of record. It also keeps all of the process's logic on one loop type instead of spreading it across several automations.

Think of a loop as a case file with a checklist for each phase of the work. The file records where the work stands (its stage), the facts you track about it (its fields), and a short log of what happened (its timeline). Your automations open the file, update it, and move it from phase to phase.

For examples of what you can build with loops, such as onboarding a client from a form or keeping two PSAs in sync, see What You Can Build With Loops.

Loop Types and Stages​

Every loop belongs to a loop type, for example "Inside Sales" or "Bills". The loop type defines:

  • Stages: the phases a loop moves through, such as Waiting for customer, Customer replied, and Won. Every loop type has at least one stage.
  • Fields: the facts you keep on each loop, such as the customer's email address or the amount due.
  • Events: things other automations can tell a loop about, such as "Email received". See Events.

Each stage has two lists of action steps:

ListWhen it runs
When enteredEach time the loop enters the stage.
When wokenEach time the loop is re-checked while it sits in the stage.

Stages can use the loop actions in this section and the same actions that Scheduled Tasks can use.

Every time a list runs, it appears in History as its own run of the loop. A stage with an empty list still shows a run that says nothing ran.

How Loops Move​

A loop changes stage only when an action or a person moves it. Time alone never moves a loop. When a loop enters a stage, even the one it is already in, the When entered actions run and a new visit to that stage begins.

When an automation moves a loop, the move goes on a waiting list and the loop enters the new stage as soon as it finishes what it is doing. A loop runs one thing at a time, so a stage's actions never overlap with the actions of the stage before it. The order between several waiting requests, such as moves and events, is not guaranteed.

A new loop starts in the first stage of its loop type unless the action that opens it names another stage.

Wakes​

A wake re-checks a loop in the stage where it sits and runs that stage's When woken actions. Two things cause a wake:

  • A schedule on the stage. Each stage can wake its loops every number of hours, days, weeks, or months. The first wake comes one interval after the loop enters the stage, the next one an interval later, and so on. A stage with no schedule never wakes on its own.
  • A request. An automation can wake a loop right away or at a time it chooses with Wake Loop.

A loop has one pending wake at a time, and the stage's schedule always counts from when the loop entered the stage:

  • Waking now keeps the schedule. If a loop wakes every 7 days and an automation wakes it now on day 3, the scheduled wakes still come on days 7, 14, and 21.
  • A later wake replaces the next scheduled one. If, on day 3, an automation asks for a wake on day 10, that wake replaces the day 7 wake. The schedule then continues on day 14. To keep every scheduled wake, wake the loop now or choose a time before the next scheduled wake.
  • The last request wins. Several wake requests made before a wake starts produce one wake, at the time of the last request.

Leaving a stage cancels its pending wake. The next stage's schedule starts when the loop enters it. Moving a loop into the stage it is already in starts a new visit, so the schedule starts over from that moment.

Guard against endless loops​

Two stages that move the loop to each other without any condition run over and over, and every run counts as a run in History. Add a condition that stops the cycle. For example, check {{meta.loop.visit.scheduled_wake_count}} in the When woken actions and move the loop to a Gone cold stage after 4 follow-ups.

Events​

An event is a message you can send to a loop, defined on its loop type. An event has:

  • A name, such as Email received or Ticket created.
  • Inputs: the values that come with it, such as from_address and message. Each input has a name, a type (the same types as fields), and can be required.
  • Actions: the steps that run when the event reaches a loop.

Events let you keep all the handling logic on the loop type. For example, a sales loop type can have an Email received event with the inputs from_address and message. The mailbox rule only finds the loop with Find or Open Loop and sends the event with Send Loop Event. The event's actions decide what the email means for the sale: add a note, move the loop to Customer replied, or draft a response. A PSA sync works the same way: a loop tracks a pair of tickets, and events such as Ticket created and Note added, sent from either side, do the syncing.

You can also send an event by hand with the Send event button on a loop's page.

When an event reaches a loop:

  • Its actions run later as their own run, which appears in History. The automation that sent it does not wait and gets no result back.
  • The loop runs one thing at a time, so the event waits until the loop is free.
  • The actions run in the stage the loop is in when the event runs, which may differ from the stage it was in when the event was sent. Check {{meta.loop.stage.name}} if the actions should behave differently per stage.
  • The loop's stage, visit, and wake schedule do not change. An event does not count as a wake or a stage entry.
  • A missing required input, an input that does not exist, or a value that does not fit its type is rejected and nothing is sent. Each text input can hold up to 262,144 characters. File inputs are not supported; save files to the loop first with Save File to Loop.

The event's actions can use the same variables as a stage's actions, plus:

VariableDescription
{{input.from_address}}The value of the input named from_address. An optional input that was not sent is empty.
{{meta.loop.event.name}}The name of the event. {{meta.loop.event.id}} is its ID.

Each event run counts as a run in History.

Events and closed loops​

Closed loops never run actions. Send Loop Event has an If the loop is closed option to fail, continue, stop, or reopen the loop first. Events still waiting when a loop is closed are removed, and a note on the timeline says so. If you delete an event from the loop type while it waits, it is dropped with a note too.

Closing and Reopening​

Use Close Loop when the work is finished. A closed loop stays in your account with its data, timeline, and files, but it:

  • Does not wake.
  • Has its waiting moves, wakes, and events removed.
  • Rejects moves, wakes, events, and data updates until you reopen it.

Reopen Loop reopens the loop and enters a stage, by default the stage it was closed in. A loop that must never finish, such as a vendor record, can stay open permanently.

Fields​

Fields hold the facts you track on each loop. Each loop type has:

  • Its own fields, which belong to that loop type only.
  • Global fields, which you define once for your account. A loop type opts in to the global fields it wants, and can narrow the allowed options of a choice field.

A field has a name (lowercase letters, numbers, and underscores, starting with a letter and up to 64 characters, for example customer_email), a display label, and a type: Text, Long text, Date, Time, Date and time, Number, Whole number, Yes / no, Choice, List of text, or List of choices. You can rename a field or change its label without losing the values already stored. You cannot change a field's type after you create it.

Indexed fields​

Mark a field Indexed so automations can find loops by its value. Find or Open Loop matches on indexed fields only. Only fields that hold a single value can be indexed, not list fields, and an indexed value can be at most 191 characters long. Matching is exact, including upper and lower case.

Hidden fields​

Mark a field Hidden to keep a bookkeeping value (such as a counter) out of the console while automations can still read and change it.

What Your Actions Can See​

Inside a stage's actions, the loop's fields are available by field name, and information about the loop and its current visit is available under meta.loop. An event's actions also see the event's inputs (see Events).

VariableDescription
{{loop.customer_email}}The value of the field named customer_email. Fields with no value are empty.
{{meta.loop.id}}The ID of the loop.
{{meta.loop.title}}The title of the loop.
{{meta.loop.open}}True when the loop is open.
{{meta.loop.type.name}}The name of the loop type. {{meta.loop.type.id}} is its ID.
{{meta.loop.stage.name}}The name of the current stage. {{meta.loop.stage.id}} is its ID.
{{meta.loop.stage.wake_every.count}}How many units pass between scheduled wakes in this stage, for example 7. {{meta.loop.stage.wake_every.unit}} is hour, day, week, or month. Both are empty when the stage has no wake schedule.
{{meta.loop.visit.number}}How many times the loop has entered this stage.
{{meta.loop.visit.entered_at}}When the loop entered the stage this time.
{{meta.loop.visit.elapsed.days}}Whole days in the stage this time. hours, minutes, and seconds give the same time in other units.
{{meta.loop.visit.wake_count}}How many wakes the loop has had during this visit.
{{meta.loop.visit.scheduled_wake_count}}How many of those wakes came from the stage's schedule.
{{meta.loop.wake.reason}}schedule or request in a When woken run. Empty in a When entered run and in an event run.

Update Loop Data also updates loop for the actions that follow it in the same run. A macro you call from a stage does not see loop; pass the values it needs as macro inputs.

Actions in other automations, such as an email rule, can reach a loop by its ID. Use Find or Open Loop to get the ID from a field value you already know, such as the sender's email address.

The Loop Actions​

ActionWhat it does
Find or Open LoopFinds a loop by its indexed fields, or opens a new one when none matches.
Update Loop DataSets field values and the title.
Move Loop to StageMoves a loop to a stage.
Wake LoopRe-checks a loop now or at a time you choose.
Send Loop EventSends an event to a loop so its loop type's event actions run.
Close LoopCloses a loop.
Reopen LoopReopens a closed loop in a stage.
Add Loop NoteAdds a note to the loop's timeline.
Save File to LoopKeeps files from the current run with the loop.
Load Loop FilesBrings the loop's files into the current run.

Every action except Find or Open Loop has a Loop field. In a loop stage you can leave it empty to use the loop the current run belongs to, or fill it in with a loop ID to act on another loop. Everywhere else, the field is required. This includes a macro or AI action called from a loop stage, because a macro or AI action does not see the loop that called it. Pass the loop ID to the macro as an input instead, for example {{meta.loop.id}}.

Timeline and History​

Each loop has a timeline that records when it opened, entered a stage (including re-entering the stage it was already in), closed, or reopened, plus the notes your automations add. Wakes, data updates, and events do not add timeline entries, so a loop that wakes daily does not fill its own timeline. Add a note from an event's actions if you want it recorded. The timeline stays for as long as the loop exists.

History records each run. A run is purged on the same schedule as the rest of your history. Open a run to see what each action did and why.

Where to Find Things in the Console​

Click Apps in the top bar, then click Loops. The sidebar has:

Sidebar itemWhat it shows
All LoopsYour loops, filtered by loop type, stage, and open or closed. Open a loop to see its data, timeline, files, and recent runs, and to move, wake, send an event to, close, or reopen it by hand.
Loop TypesWhere you create and edit loop types: fields, stages, wake schedules, events, and the action lists.
Global FieldsThe fields shared by all your loop types.
Loop HistoryThe history of every loop run.

See Loops in the Console for how to build a loop type.

FAQs​

Is a loop the same as Iterate?​

No. Iterate repeats steps for each item in a list, such as each ticket number in an email, and finishes within one run. A loop is a record that tracks one piece of work, such as one customer conversation or one backup job, across many runs over days or months.

Who can use loops?​

Loops are in beta and require the Developer Toolkit. To join the beta, email [email protected]. If you do not see Loops under Apps in the top bar, your account is not in the beta yet.

Can I delete a stage or a loop type?​

You can delete a stage only when no loop is in it, open or closed. You can delete a loop type only when it has no loops. Delete or move the loops first. Deleting a loop removes its data, timeline, and files for good.

Can I delete a global field?​

Not while a loop type still uses it. Remove it from those loop types first. Values already stored on loops are kept but no longer shown.

How do I stop a loop from waking?​

Remove the wake schedule from its stage, move the loop to a stage without one, or close the loop.

Does a loop count as a run every time it wakes?​

Yes. Every time a stage's actions run, they count as a run in History, the same as any other automation run. Choose wake intervals that fit the work. Every event you send also runs as its own run.

Can I delete an event?​

Yes, at any time. Events that were sent but have not run yet are dropped, and the loop's timeline gets a note.