Loop Mode
Process multiple items with loop-based workflows
Loop Mode
Loop Mode allows you to process multiple items in a single workflow run. Instead of running your workflow once with a single input, you can run it multiple times with different data - like processing a list of emails, generating content for multiple topics, or transforming an array of values.
Understanding Loop Mode
When you enable Loop Mode on a node, that node (and all nodes after it) will execute once for each item in your input data.
Without Loop Mode
Your workflow processes one item:
Input: "Write a story"
Output: One storyWith Loop Mode
Your workflow processes multiple items:
Input: ["Write a story", "Write a poem", "Write a song"]
Output: [Story, Poem, Song]When to Use Loop Mode
Loop Mode is perfect for:
- Processing lists of items (emails, names, products, etc.)
- Generating multiple variations of content
- Performing the same operation on different inputs
- Batch processing data
Setting Up Loop Mode
Step 1: Prepare Your Data
Your input data should be in an array (list) format. For example:
- A list of topics:
["AI", "Robots", "Space"] - A list of names:
["Alice", "Bob", "Charlie"] - A list of numbers:
[1, 2, 3, 4, 5]
Step 2: Enable Loop Mode
- Select the node where you want loop processing to begin
- In the Configuration Panel, look for "Loop Mode" or "Enable Loop"
- Toggle it ON
All nodes connected after this point will execute in loop mode.
Step 3: Configure Your Loop
Make sure your node is configured to accept array input:
- If using a Router node, it should receive an array
- If using other nodes, connect them to receive looped data
The Duplication Node
The Duplication Node is a special helper node designed specifically for loop mode. It solves a common problem: what if you want to use the same value for every iteration of your loop?
The Problem
Imagine you want to:
- Process 5 different topics
- Use the same AI model for all topics
- Use the same template for all topics
Without the Duplication Node, you'd need to create 5 separate connections for each fixed value.
The Solution
The Duplication Node takes a single value and creates multiple copies to match your loop size.
How it works:
Input Value: "gpt-4"
Reference Array: ["Topic 1", "Topic 2", "Topic 3"]
Output: ["gpt-4", "gpt-4", "gpt-4"]Using the Duplication Node
- Add the Duplication Node to your workflow
- Connect your reference array: This tells the node how many copies to make
- Usually connected to your main loop data
- Set the value to duplicate: This is the single value you want repeated
- Could be a model name, a template, a setting, etc.
- Connect to your target node: Use the duplicated output in your loop
Example Workflow:
Topics Array → Duplicate Node (duplicates "gpt-4") → LLM Chat Node
↘ ↗
(Topics feed directly to LLM Chat)In this example:
- Topics array:
["AI", "Robots", "Space"] - Duplicate Node output:
["gpt-4", "gpt-4", "gpt-4"] - LLM Chat receives both arrays and processes each topic with GPT-4
Real-World Examples
Example 1: Generate Multiple Articles
Goal: Generate articles for 3 different topics
Setup:
- Start with topics:
["Artificial Intelligence", "Machine Learning", "Neural Networks"] - Use Duplication Node to duplicate your prompt template for all 3 topics
- Enable Loop Mode on your LLM Chat node
- Get 3 different articles as output
Result:
Topic 1 + Template → Article about AI
Topic 2 + Template → Article about ML
Topic 3 + Template → Article about Neural NetworksExample 2: Process Emails with Same Settings
Goal: Process 10 emails using the same AI model and instructions
Setup:
- Start with email list:
[Email 1, Email 2, ..., Email 10] - Use Duplication Node to duplicate:
- Model name: "claude-3-sonnet"
- Instructions: "Summarize this email"
- Enable Loop Mode
- Get 10 summaries
Result: Each email gets processed with identical settings.
Example 3: Transform Data List
Goal: Convert a list of prices from USD to EUR
Setup:
- Start with prices:
[100, 200, 300] - Use Duplication Node to duplicate exchange rate:
1.1 - Use a Math node in loop mode to multiply each price
- Get converted prices:
[110, 220, 330]
Tips for Loop Mode
Keep It Simple
Start with small arrays (3-5 items) when testing. Once it works, scale up to larger datasets.
Watch Your Credits
Remember that loop mode runs nodes multiple times. If you're using AI models, this will consume more credits.
- 1 item × 1 LLM call = 1 credit cost
- 10 items × 1 LLM call = 10× credit cost
Use Duplication Wisely
The Duplication Node is essential when you have:
- Fixed values (model names, templates, settings)
- Single values that need to be used across all loop iterations
- Constants that don't change per item
Check Array Lengths
If you're connecting multiple arrays to a loop node, make sure they're the same length. For example:
- ✅ Array A: 5 items, Array B: 5 items
- ❌ Array A: 5 items, Array B: 3 items (this will cause an error)
Use the Duplication Node to make single values match your array length.
Debug One Item First
Before running a large loop, test with just 1-2 items to make sure your logic works correctly.
Viewing Loop Results
After running a loop-based workflow:
- Go to Execution Details
- You'll see results for each iteration
- Each node will show multiple outputs (one per loop iteration)
- Failed items will be highlighted so you can identify issues
Limitations
- No nested loops: You can't have a loop inside another loop (yet)
- Array length matching: All input arrays to a looped node must be the same length (or use Duplication Node)
- Memory usage: Very large loops (1000+ items) may consume significant resources
Common Errors
"Array length mismatch"
Cause: You're connecting arrays of different lengths to a loop node
Solution: Use the Duplication Node to make single values match your array length
"Cannot loop over non-array"
Cause: You're trying to enable loop mode on a node that isn't receiving array input
Solution: Make sure your input data is formatted as an array: [item1, item2, ...]
"Node not configured for loop mode"
Cause: The node type doesn't support loop mode
Solution: Check that you're using a compatible node type. Most nodes support loops, but some control flow nodes may not.
Next Steps
- Learn more about Available Nodes
- Understand Execution Details to analyze loop results
- Explore the Builder to create your first loop workflow