Loop Block
Execute workflow blocks in a loop iteration
Container block that executes child workflow blocks in a loop. Supports both count-based loops (for) and collection-based loops (forEach). Child blocks placed inside the loop container will be executed for each iteration — reach for it whenever you need to process a list of items or repeat an action a fixed number of times.
Overview
| Property | Value |
|---|---|
| Type | loop |
| Category | blocks |
| Color | #F97316 |
When to Use
- Process every item in an array (emails, records, API results) with a forEach loop
- Repeat an action a fixed number of times with a count-based for loop
- Batch-send messages or notifications to multiple recipients
- Iterate over pages of API results one at a time
- Run a sub-workflow step for each element in a structured output from an Agent block
- Apply a transformation or enrichment to each row in a data collection
Configuration
Loop Type
A dropdown that selects the iteration strategy. Required to determine which additional fields appear.
| Option | id |
|---|---|
| For Loop (Count) | for |
| For Each (Collection) | forEach |
Iterations
A short-input field (id: count) that specifies how many times the loop should run. Only shown when Loop Type is for.
- Placeholder:
5 - Required when
loopType=for
Collection Items
A long-input field (id: collection) for the array or object to iterate over. Only shown when Loop Type is forEach.
- Placeholder:
['item1', 'item2', 'item3'] or {{previous_block.output}} - Description: Array or object to iterate over. Use
{{block_id.output}}to reference other blocks. - Required when
loopType=forEach
Max Iterations
A slider (id: maxIterations) that sets a safety ceiling on the number of iterations to prevent runaway loops.
- Range: 1 – 100
- Description: Safety limit to prevent infinite loops
Parallel Execution
A switch (id: parallelExecution) that controls whether iterations run concurrently.
- Description: Execute iterations in parallel (faster but uses more resources)
Stop on Error
A switch (id: stopOnError) that controls whether a failing iteration halts the entire loop.
- Description: Stop loop execution if any iteration fails
Inputs & Outputs
Inputs:
collection(json) — Collection of items to iterate over (for forEach loops)count(number) — Number of iterations (for count-based loops)
Outputs:
iterations(number) — Total number of iterations completedresults(json) — Array of results from each iterationexecutionTime(number) — Total execution time in millisecondsstatus(string) — Loop execution status (completed,error, orcancelled)currentIteration(number) — Current iteration number (available during execution)currentItem(json) — Current item being processed (for forEach loops, available during execution)
Tools
This block has no external tool integrations. It is a container block handled directly by the loop executor — no tools.access entries are needed.
YAML Example
loop_1:
type: loop
name: "Loop"
inputs:
loopType: "forEach"
collection: "{{api_fetch_1.response.items}}"
maxIterations: 50
parallelExecution: false
stopOnError: true
connections:
outgoing:
- target: next-block-id