Skip to content
Agentic Workflowdocs
v0.8.2Install free

concepts / flow

Looping

Why a step already runs once per item, and when to repeat steps yourself with Loop, Split in Batches or Poll Until.

Split in Batches receives seven rows with Batch size 3. The steps in the loop run three times, with rows 1–3, 4–6 and 7. Each pass hands them one item holding the batch list.

Example run: Read rows, 1 item → Split in Batches, ran 4 times, 3 passes, then Done → Http Request, ran 3 times, one request per batch. Illustration of a run. The fourth pass finds no rows left and leaves through Done.

Output of Split in Batches
#donebatchbatchIndexisLast
0false["r1","r2","r3"]0false
1false["r4","r5","r6"]1false
2false["r7"]2true
Illustration of a run. The fourth pass finds no rows left and leaves through Done.

When a step receives a list of items, it runs once for each, so a workflow that collects ten links can fetch ten pages without a loop. To do something once for the whole list instead, put Aggregate in front of the step. See Items.

Loop and Split in Batches are wired the same way:

flowchart LR
  A[Previous step] --> L{Loop or Split in Batches}
  L -->|Loop| B[Steps to repeat] --> C[Last repeated step]
  C -->|back to Loop Back| L
  L -->|Done| D[What comes after]
  class L awf-flow
  class B,C awf-data
  class D awf-ok
  1. Connect the Loop node’s Loop output to the first step you want to repeat.
  2. Connect the last repeated step back to the Loop node’s Loop Back input (the bottom one).
  3. Connect Done to what should happen after the loop.
  4. In Conditions, describe when to keep going.

Each pass, Loop checks its conditions. When they no longer hold, or when it reaches Max Iterations (100 by default, up to 1,000), the data leaves through Done. The output includes currentIndex, the number of the current pass.

  1. In Split in Batches, set Items to the list, for example {{ $input.rows }}.
  2. Set Batch size: how many items each pass gets (1 by default).
  3. Wire it like Loop: Loop to the repeated steps, the last of them back to Loop Back, and Done to what comes next.

Each pass sends one item with batch (this pass’s items), batchIndex (counting from 0) and isLast. Read the list with {{ $input.batch }}, or add Split Out on batch to run the next steps once per item. An empty list goes straight to Done.

To pause between batches, add a Wait node at the end of the repeated steps.

The loop stopped after 100 passes

It reached Max Iterations, a safety limit. Raise it (up to 1,000) if you really need more passes, or check that the condition can become false.

The repeated steps ran once, then the run went to Done

The last repeated step isn’t connected back to Loop Back, or the conditions were false on the first check. Follow the wire from the end of the repeated part back to the bottom input.

A step inside the batch loop ran once per pass, not once per row

Each pass is a single item holding the batch list. Add Split Out on batch if each row needs its own run.

An approval or a long wait inside a loop pauses everything

Wait and Wait For Approval pause once for everything they receive. To pause per item, place them inside a Loop or after Split in Batches with a batch size of 1.

Ask Aria