Skip to main content

Understanding Flow Loops

A comprehensive guide to processing multiple items automatically in elvex flows

Updated today

What are flow loops?

Flow loops allow you to process multiple items through the same series of steps automatically. Think of a loop as a container that takes a list of items—like rows in a spreadsheet or sentences in a document—and runs each item through the steps you've placed inside.

Real-world analogy: It's like having an assembly line worker who processes each item from a batch using the same procedure.

Key capabilities

  • Automatic splitting: Convert files, text, or data into individual items

  • Parallel or sequential processing: Process all items at once, or one-by-one with feedback

  • Flexible input: Works with spreadsheets, text files, comma-separated values, and more

  • Configurable limits: Control how many iterations run (1-20)

When to use loops

Use loops when you need to:

Process multiple items

  • Analyze each row in a spreadsheet

  • Translate multiple sentences

  • Generate summaries for multiple documents

  • Process a list of customer names or IDs

Iterate and improve

  • Refine a result based on previous attempts

  • Build upon previous outputs (e.g., write a story chapter-by-chapter)

  • Implement retry logic with learning

Batch operations

  • Send personalized emails to a list

  • Generate reports for multiple data points

  • Transform data in bulk

How loops work

The basic structure

A loop consists of three main components:

1. Input and splitting

The loop takes input data and splits it into individual items based on your chosen strategy (comma, rows, sentences, or paragraphs).

2. Processing steps

You add steps inside the loop container. Each item passes through these steps in sequence.

3. Output

The loop collects results and outputs them either all together (parallel processing) or one at a time with feedback (sequential processing).

Two types of processing

Flow loops support two fundamentally different processing modes:

Parallel processing (standard output)

  • How it works: All items are processed simultaneously

  • Speed: Fast—items don't wait for each other

  • Context: Each item is processed independently

  • Best for: Independent tasks where items don't need to know about each other

  • Example: Translating 10 sentences—each translation is independent

Sequential processing (feedback output)

  • How it works: Items are processed one at a time, in order

  • Speed: Slower—each item waits for the previous one to complete

  • Context: Each item can see results from all previous items

  • Best for: Tasks where later items build on earlier results

  • Example: Writing story chapters where each chapter references previous ones

Splitting strategies

The splitting strategy determines how your input data is divided into individual items for processing.

Comma

Use for: Comma-separated lists, CSV data

How it works: Parses input as comma-separated values and handles quoted values correctly (e.g., "Last, First", Email, Phone). Each value becomes one item.

Example input:

Apple, Banana, Cherry, Date

Results in 4 items:

  1. Apple

  2. Banana

  3. Cherry

  4. Date

Rows

Use for: Spreadsheets, CSV files, line-separated text

How it works:

  • For spreadsheets/CSV: Splits by rows, preserving column structure. Includes sheet names for multi-sheet files. Each row becomes one item with all its columns.

  • For text files: Splits by newline characters (\n). Each line becomes one item.

Example input (spreadsheet):

Name

Email

Status

Alice

Active

Bob

Active

Results in 2 items:

  1. Sheet1: Name: Alice, Email: [email protected], Status: Active

  2. Sheet1: Name: Bob, Email: [email protected], Status: Active

Sentences

Use for: Natural language processing, text analysis, translation

How it works: Splits text by sentence-ending punctuation (., !, ?). Each sentence becomes one item. Falls back to newlines if the text is just one long sentence.

Example input:

The quick brown fox jumps. It lands safely. The dog barks!

Results in 3 items:

  1. The quick brown fox jumps.

  2. It lands safely.

  3. The dog barks!

Paragraphs

Use for: Document processing, long-form content analysis

How it works: Splits text by paragraph breaks (double newlines: \n\n). Each paragraph becomes one item while preserving paragraph structure.

Example input:

This is the first paragraph. It has multiple sentences.  This is the second paragraph. It also has content.  Final paragraph here.

Results in 3 items:

  1. This is the first paragraph.\nIt has multiple sentences.

  2. This is the second paragraph.\nIt also has content.

  3. Final paragraph here.

Understanding loop outputs

Every loop has two output handles that you can connect to other steps:

Loop output (standard)

Location: Bottom-right of the loop container

What it does:

  • Waits for ALL items to finish processing

  • Combines all results into a single output

  • Each result is labeled with its item name

Format:

**Item 1:** Result for item 1  **Item 2:** Result for item 2  **Item 3:** Result for item 3

When to use:

  • You need all results collected together

  • Processing items independently (no dependencies between items)

  • Creating summaries or reports

Processing mode: Items are processed in parallel (all at once) for maximum speed.

Iteration output (feedback)

Location: Bottom-left of the loop container (larger handle with yellow/warning color)

What it does:

  • Feeds each result back into the loop for the next iteration

  • Processes items sequentially (one at a time, in order)

  • Each iteration can see all previous results

When to use:

  • Building upon previous results

  • Iterative improvement or refinement

  • Accumulation patterns (e.g., writing a story paragraph by paragraph)

  • When each iteration depends on what came before

Processing mode: Items are processed sequentially (one after another) to enable feedback.

Advanced: feedback loops

Feedback loops enable powerful iterative and accumulation patterns.

How feedback works

  1. First iteration: Processes the first item with no previous context

  2. Second iteration: Processes the second item with access to the result from iteration 1

  3. Third iteration: Processes the third item with access to results from iterations 1 and 2

  4. And so on...

Creating a feedback loop

Step 1: Create a loop with steps inside

Step 2: Connect the iteration output handle (bottom-left, yellow) to a step inside the loop

Step 3: That step now receives previous results as input

Visual indicator: When feedback is configured, you'll see:

  • A yellow "Reduce" chip showing the number of feedback connections

  • A yellow banner inside the loop container

Example: iterative story writing

Goal: Write a story one paragraph at a time, with each paragraph building on previous ones.

Setup:

  1. Input: Paragraph 1, Paragraph 2, Paragraph 3, Paragraph 4

  2. Splitting strategy: Comma

  3. Loop contains: One AI step with prompt: "Write this story paragraph, considering what came before: {previous_results}"

  4. Connect iteration output back to the AI step

What happens:

  • Iteration 1: Writes paragraph 1 (no previous context)

  • Iteration 2: Writes paragraph 2, seeing paragraph 1's content

  • Iteration 3: Writes paragraph 3, seeing paragraphs 1 and 2

  • Iteration 4: Writes paragraph 4, seeing paragraphs 1, 2, and 3

Result: A coherent story where each paragraph builds naturally on previous ones.

Example: iterative refinement

Goal: Refine a business plan through multiple review cycles.

Setup:

  1. Input: Initial business plan document

  2. Splitting strategy: Paragraphs

  3. Loop contains: AI step with prompt: "Review and improve this paragraph based on previous improvements"

  4. Connect iteration output back to the AI step

What happens:

  • Each paragraph is reviewed and improved

  • Later paragraphs benefit from lessons learned in earlier reviews

  • The refinement compounds across the document

Important notes on feedback

  • Sequential processing: Feedback loops process items one at a time (slower but enables context)

  • Context window: Each iteration receives ALL previous results (can be large)

  • Max iterations still applies: The loop stops after max_iterations items regardless

Common use cases

Spreadsheet processing

Scenario: Analyze each customer in a spreadsheet

Configuration:

  • Input: Customer spreadsheet with columns: Name, Email, Purchase History

  • Splitting strategy: Rows

  • Loop output: Loop output (standard)

  • Steps inside: AI step to analyze customer and suggest personalized offer

Result: One analysis per customer, all combined in final output

Email personalization

Scenario: Generate personalized emails for a list of recipients

Configuration:

  • Input: CSV with names and details: John Doe, Sales, Q4 2024

  • Splitting strategy: Rows or Comma

  • Loop output: Loop output (standard)

  • Steps inside: AI step to generate personalized email content

Result: Personalized email for each recipient

Data validation and correction

Scenario: Validate data entries and fix errors iteratively

Configuration:

  • Input: List of addresses with potential errors

  • Splitting strategy: Rows

  • Loop output: Iteration output (feedback)

  • Steps inside:

    • Step 1: Validate address format

    • Step 2: Correct if invalid, learning from previous corrections

Result: Cleaned dataset with consistent error correction

Best practices

Choose the right splitting strategy

  • Use Rows for structured data (spreadsheets, CSV)

  • Use Sentences for natural language processing

  • Use Comma for simple lists

  • Use Paragraphs for document analysis

Set appropriate max iterations

  • Start with a low number (5-10) for testing

  • Increase only if you need to process more items

  • Consider costs: more iterations = more AI calls

Use standard output for independent items

  • If items don't depend on each other, use loop output (standard)

  • Parallel processing is much faster

  • Examples: translating sentences, analyzing separate customers

Use feedback output for sequential dependencies

  • Only use iteration output (feedback) when items need previous results

  • Examples: writing chapters, iterative refinement, building on context

  • Expect slower processing due to sequential execution

Keep steps inside simple

  • Avoid complex multi-step chains inside loops

  • Each iteration should complete quickly (under 1 minute ideal)

  • Break complex workflows into multiple loops if needed

Handle errors gracefully

  • If one item fails, the loop continues with other items

  • Failed items are marked with an error in the output

  • Check final results for any error markers

Monitor costs

  • Each iteration inside a loop counts as a separate AI call

  • 10 items × 3 steps inside loop = 30 AI calls

  • Use max_iterations to cap costs

Test with small inputs first

  • Start with 2-3 items to verify your loop works correctly

  • Increase to full dataset once validated

  • Check both successful and error cases

Troubleshooting

Loop never completes

Possible causes:

  • One step inside is timing out (5-minute limit per iteration)

  • Complex prompt taking too long to process

Solutions:

  • Simplify steps inside the loop

  • Reduce max_iterations

  • Check for infinite loops in feedback connections

Results are incomplete

Possible causes:

  • Input exceeded max_iterations limit

  • Some items failed processing

Solutions:

  • Check final output for error messages

  • Increase max_iterations if needed (up to 20)

  • Review failed items and fix input data

Feedback not working

Possible causes:

  • Connected wrong output handle

  • Steps inside not configured to receive feedback

Solutions:

  • Ensure iteration output (bottom-left, yellow handle) is connected

  • Verify step inside references previous results in its prompt/config

  • Look for yellow "Reduce" indicator to confirm feedback is active

Items not splitting correctly

Possible causes:

  • Wrong splitting strategy for data format

  • Input file format not recognized

Solutions:

  • Try different splitting strategy

  • Check input file format (CSV vs text vs spreadsheet)

  • For CSV, ensure proper quoting of fields with commas

What's next?

Did this answer your question?