Reference · Tools
Loop
Repeatedly execute a chain of downstream nodes (the loop body) for each item, a fixed number of times, or while a condition is true.
The Loop node repeatedly runs the chain of nodes between it and a Loop End, in forEach, fixed-count or while-condition mode. It needs no credentials. A typical build is paging through an API until there are no more results, running the same fetch-and-store body on each round.
- Node type
- Action
- Parameters
- 9
- Outputs
- Done, Error
- Credentials
- None required
Loop
Iterate through body nodes multiple times
Overview
Iteratively executes a sub-workflow defined by all nodes between this Loop node and its paired Loop End node. Supports three iteration modes: forEach (once per input item), fixedCount (N iterations), and whileCondition (repeat while an expression evaluates to truthy). Each iteration runs the body as a nested workflow execution. The loop body’s output can be accumulated across iterations or passed through independently. In forEach mode, optional batching groups input items into chunks with a configurable delay between batches for rate limiting. A Loop never creates a graph cycle — the body runs as a nested execution rather than a backward edge on the canvas.
Category: Core Nodes
Tool Name: loop
Version: 1
Appearance: Icon: loop | Color: #8b5cf6
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | Input |
| Output | Done, Error |
Credentials
This tool does not require any credentials.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Mode | options | Yes | forEach | How the loop determines when to iterate. |
Options: forEach (execute the loop body once for each input item), fixedCount (execute the loop body a fixed number of times), whileCondition (execute the loop body while a condition is true) | ||||
| Iterations | number | Yes | 10 | Number of times to execute the loop body. (shown when Mode is fixedCount) |
| Condition | string | Yes | {{ $json.continue === true }} | Expression that is evaluated after each iteration. The loop continues while this evaluates to a truthy value. Has access to $json (current item), $iteration (0-based index), and $accumulator (array of all prior outputs). (shown when Mode is whileCondition) |
| Max Iterations (Safety Limit) | number | No | 100 | Maximum number of iterations allowed, regardless of mode. Prevents runaway loops. Applies to all modes as a safety ceiling. |
| Accumulation Strategy | options | No | lastOnly | How iteration results are accumulated for the final output. |
Options: lastOnly (output only the final iteration’s results), all (concatenate outputs from every iteration) | ||||
| Max Concurrency | number | No | 1 | Max concurrent items to process. Default is 1 (sequential iteration). Values > 1 are only meaningful in forEach mode with independent iterations. |
| Enable Batching | boolean | No | false | Group input items into batches. Each iteration processes a batch instead of a single item. (shown when Mode is forEach) |
| Batch Size | number | Yes | 10 | Number of items per batch. (shown when Mode is forEach and Enable Batching is true) |
| Delay Between Batches (ms) | number | No | 0 | Milliseconds to wait between batches. Useful for rate limiting. No delay is applied before the first batch. Set to 0 for no delay. (shown when Mode is forEach and Enable Batching is true) |
Output Data
The Done port emits the accumulated results of the loop: the last iteration’s items when Accumulation Strategy is lastOnly, or every iteration’s items concatenated when it is all. The items are whatever the last node of the loop body produced, so their shape is defined by the body, not by this node. When the error mode is errorPort, an iteration that fails emits an error item on the Error port and the loop carries on with the next iteration.
Every item handed to the loop body carries a _loopMeta object alongside its own JSON:
iteration— 0-based index of the current iterationitemIndex— position of the item within this iteration’s inputmode— the iteration mode in usebatchIndex,batchSize,batchItemIndex,totalBatches— added only when batching is enabled
Read it inside the body with expressions such as {{ $json._loopMeta.iteration }}.
If there are no nodes between the Loop and its Loop End, the node passes its input straight through to Done.
Usage Examples
- Loop through each item and enrich with API calls
- Repeat a transformation 5 times to refine output
- Keep calling an LLM until the output passes validation
Example Configuration
Run the body once per input item, with a safety ceiling:
{ "type": "loop", "parameters": { "mode": "forEach", "maxIterations": 100 } }
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
Iteratively executes body nodes between Loop and Loop End — supports forEach, fixedCount, and whileCondition modes.
Behavior notes
- Pair every Loop with a Loop End. The nodes chained between the two are the loop body; the Loop End marks where the body stops.
- Max Iterations is a hard ceiling for every mode, including
fixedCount— raise it above the iteration count you actually want. whileConditionis evaluated after each iteration, so the body always runs at least once.- Batching changes what an iteration is. With batching on, one iteration processes a whole batch instead of a single item, and Delay Between Batches applies between iterations — never before the first one.
Frequently asked questions
Do I always need a Loop End?
Yes. The nodes chained between Loop and Loop End are the body, and the Loop End marks where the body stops. Without it the loop has no boundary.
Why did my loop stop early?
Max Iterations is a hard ceiling for every mode, including fixed count. Raise it above the number of iterations you actually want or the loop is cut short.
Does a while-condition loop ever skip the body entirely?
No. The condition is evaluated after each iteration, so the body always runs at least once — this is a do-while, not a while.
What counts as one iteration?
It depends on batching: with batching configured an iteration processes a batch rather than a single item, which changes both the item count per round and the total number of rounds.
Build with the Loop node
Drop it into a workflow, wire it to an agent, or call it on a schedule.
Open BusyBotLast updated . Spotted something wrong? Tell us.