Loops & Iteration
Repeat one Step for every item in a list with Run for each item, or repeat a multi-step circuit with Repeater.
- Use it to
- Process a list item by item, run a fixed number of passes, or loop until a condition is met
- Find it
- Step Settings → Run for each item, or Tools → Flow → Repeater
- Cost
- Free for the Repeater Step itself (each repeated Step inside uses its normal rate per pass)
- Limits
- Concurrency 1–10 items at once · Stop or Continue on item error
- Output
- {{ N.results }} (succeeded outputs), {{ N.items }}, {{ N.stats }} · Inside loop: {{ item }}
- Instead
- Inline list pipes ({{ 1.orders | where:"status":"paid" | pluck:amount | total }}) when computing one value
Configure list iteration explicitly
Passing a list to an app action does not automatically run that action once per record. Enable Run for each item on an eligible Step, or use Repeater for a body of Steps.
The repeat badge or Repeater connections show where list iteration is configured. Review the selected list, body, concurrency and failure policy before running it. AI Agent tool loops are separate from list iteration and use the agent’s execution budgets.
Which one? Count the steps
How many steps does the work take per item? That one question decides it.
| Use | When |
|---|---|
| Run for each item (a setting) | One step needs to run once per item. Most cases. |
| Repeater (a step on the canvas) | Several steps run together per item, for a fixed count, or until a rule is met. |
Repeater also covers work with no known list. A fixed number of times runs the body N times (including successful calls; it is not a retry policy). Until a rule is met checks the completed pass and runs again only when its rule is still false. Both expose {{ item.$index }} as the pass counter.
Worked examples of each
| You want to | Use | Read the current item as |
|---|---|---|
| Send one Slack message or email per row | Run for each item on that Step | {{ item.name }}, {{ item.email }} |
| Classify each email with an AI Agent, then save it | Repeater (AI Agent does not use Run for each item) | {{ item }} |
| For each lead: look up the company, score it, and update the CRM | Repeater (3 Steps per lead) | {{ item.company }} |
| For each invoice: read the PDF, check the total, and branch | Repeater (the loop body branches) | {{ item }} |
| Fetch pages 0 to 9 of a zero-based API | Repeater, mode A fixed number of times | {{ item.$index }} (zero-based pass) |
| Poll an API until a job is done | Repeater, mode Until a rule is met | {{ item.$total }} (passes so far) |
How to wire a Repeater loop in three connections
- Connect the Step before the loop into the Repeater.
- Connect Each time to the first Step of the loop body, and connect the last Step of the loop body back into the Repeater.
- Connect When finished to the Step that should run after all passes finish. It receives
{{ N.results }},{{ N.items }},{{ N.stats }}, and{{ N.message }}.
Canvas layout tip: Place loop body Steps to the right of the Repeater. The Each time pass and return line then read left to right.
What they share
Both bind the current item to {{ item }}, so what you write inside the loop is the same either way.
| Reference | What it holds |
|---|---|
{{ item }} | The entry being processed |
{{ item.$index }} | Input position for Each item, or Repeater pass position, counting from 0 |
{{ item.$total }} | Total planned passes; in Until mode, passes started so far |
Both also collect what every pass produced into {{ N.results }}, with {{ N.items }} carrying per-item detail and {{ N.stats }} the totals.
Filter uses a different form. Its
rules take {{ $item }} and {{ $itemIndex }}, with the dollar sign at the
front. Filter evaluates its rules itself rather than running a pass per item,
which is why the two look alike but are not interchangeable.
One mechanism per list, never both
A Step inside a closed Repeater body cannot turn on its own Each item mode (a 50-item Each item step inside a 50-pass Repeater would run 2,500 times). Leave body Steps set to Once so the Repeater drives each pass.
For a list inside a list (such as every order for every customer), use nested Repeaters: {{ item }} reads the innermost loop’s item, while referencing the outer Repeater by Step number reads its active item. (Combine joins two lists; it does not flatten nested lists.)
Plan for loop usage
Usage depends on the steps that run and the work they perform on each pass. Standard action steps consume 1 Step credit per item pass, while control steps are free. See Step Credits, Tokens & Storage for how repeated work and failed attempts are counted.
Use Repeater’s Safety limit to bound the number of passes. A list or fixed count requiring more passes fails before the body starts; Until mode fails if the rule is still false at the limit. This is a failure boundary, not a way to shorten the list. Repeater accepts up to 10,000 source items before batching, with at most 10,000 passes.
A Filter can remove items that do not meet your rules, but filtering alone does not guarantee a maximum item count. See System Limits for the concurrency your plan allows.
- Run
- Enable Run for each item on an action Step (or wire a Repeater) and click Run step in Test & Debug
- You should see
- The Step processes up to 3 sample items in Test & Debug (or all items in a full Run) and returns { results, items, stats }.