Loop
The Loop block allows you to repeat a set of workflow steps for each item in an array.
Use a Loop when you have multiple items—such as files, records, or other values—and want to apply the same workflow logic to each item individually.
When a Start Loop block is added to the Canvas, an End Loop block is automatically added. Place the blocks that should be repeated between the Start Loop and End Loop blocks.

When to Use a Loop
Use a Loop whenever the same set of actions needs to be performed for multiple items.
Common use cases include:
Processing multiple uploaded files
Summarizing multiple documents individually
Analyzing a list of records
Processing multiple items returned by a previous block
Performing the same AI operation for every item in an array
For example, if a user uploads multiple documents through a Form Trigger, a Loop can process each uploaded document separately:
Form Trigger → Start Loop → Agent → End Loop → Output
The Agent inside the Loop runs once for each file being processed.
How a Loop Works
A Loop consists of two blocks:
Start Loop Defines the array that should be processed and controls the number of iterations.
End Loop Marks the end of the steps that should be repeated.
When you add a Start Loop block to the Canvas, EmpowerGPT automatically adds the corresponding End Loop block.
Any blocks placed between these two blocks become part of the Loop.
For example:
Start Loop ↓ Agent ↓ End Loop
If the selected array contains five items, the blocks inside the Loop are executed for each item in the array, subject to the configured maximum number of iterations.
Configuration
The Start Loop block contains two main configuration fields:

Field
Description
Array to Loop Over
Selects the array containing the items that should be processed by the Loop.
Max Iterations
Defines the maximum number of times the Loop is allowed to execute.
Array to Loop Over
Use Array to Loop Over to select the collection of items that the Loop should process.
The array is typically provided by a previous block in the workflow.
For example, a Form Trigger with Allow Multiple Files enabled can provide multiple uploaded files. This array can then be selected in Array to Loop Over.
The Loop processes the items individually:
Array
If we have a field in the form trigger named as 'File' which allows multiple uploads and user wants to loop an agent through all the files, he can use loop array as:
{{form-trigger.file}}
Loop execution
Iteration 1 → File 1
Iteration 2 → File 2
Iteration 3 → File 3
Blocks inside the Loop can use the current item being processed during each iteration.
Max Iterations
Max Iterations defines the maximum number of items that the Loop can process during a workflow run.
This acts as a limit on the number of times the blocks inside the Loop can execute.
For example, suppose:
The selected array contains 20 items
Max Iterations is set to 10
The Loop will execute for a maximum of 10 iterations.
Set Max Iterations according to the expected size of your input array and the amount of processing required for each item.
Tip: Use an appropriate Max Iterations value to prevent unexpectedly large arrays from causing unnecessary workflow executions.
Example: Summarize Multiple Files
Suppose you want users to upload multiple documents and generate a summary for each document.
The workflow can be configured as:
Form Trigger → Start Loop → Agent → End Loop → Output
1. Form Trigger
Add a File field and enable:
Allow Multiple Files: Enabled
The uploaded files are provided to the workflow as an array.
2. Start Loop
Configure:
Array to Loop Over: Select the file field from the Form Trigger by pressing {{}}.
Max Iterations: Set the maximum number of files that should be processed.
3. Agent
Place an Agent between the Start Loop and End Loop blocks.
Provide the current file from the Loop to the Agent and configure instructions such as:
Review the current document and provide a concise summary of its main topics and key information.
The Agent executes for each item processed by the Loop.
4. End Loop
The End Loop marks the end of the repeated workflow steps.
Once the Loop has finished processing the required items, the workflow continues to the next connected block.
The resulting structure is:
Form Trigger ↓ Start Loop – Uploaded Files ↓ Agent – Summarize Current File ↓ End Loop ↓ Output
Example: Multiple Steps Inside a Loop
A Loop is not limited to a single block. Multiple blocks can be placed between Start Loop and End Loop when each item requires several processing steps.
For example:
Start Loop ↓ Agent – Analyze Document ↓ Condition – Check Document Type ↓ Additional Processing ↓ End Loop
Each item passes through the workflow logic contained within the Loop before the next item is processed.
Best Practices
Select an array as the input The value configured in Array to Loop Over should contain multiple items that can be processed individually.
Set an appropriate Max Iterations value Choose a limit appropriate for your workflow to prevent unexpectedly large inputs from creating excessive iterations.
Keep repeated processing focused Only place blocks inside the Loop when they need to execute for every item.
Consider AI usage If an Agent is placed inside a Loop, the Agent may execute once for every processed item. A workflow processing many items can therefore consume significantly more AI credits than a single Agent execution.
Test with a small array first When building a Loop, test it with a small number of items before running it against larger arrays. This makes it easier to verify that each item is being processed as expected.
Last updated
Was this helpful?
