Skip to main content
Loop

Overview

The Loop node processes arrays of data - iterate through lists of customers, orders, files, or any collection, applying the same logic to each item.
Best for: Batch processing, processing multiple records, generating individual reports, and iterating over lists.

Configuration

Input Array: Select the array to loop over
{{trigger.customers}}
{{api_response.items}}
{{google_sheets.rows}}
Loop Variable Name: Name for current item (e.g., customer, item, record) Max Iterations: Safety limit (default: 100)

Inside the Loop

Access current item with your loop variable name:
{{customer.name}}
{{customer.email}}
{{customer.status}}

Example Use Cases

Process Customer List

Loop over {{trigger.customers}}
  Variable: customer

  → Agent: Analyze {{customer.feedback}}
  → Condition: Check {{customer.score}}
    → High: Send thank you email
    → Low: Create follow-up task

Batch Update Records

Loop over {{api_response.records}}
  Variable: record

  → Code: Transform {{record.data}}
  → HTTP Request: Update record {{record.id}}

Generate Individual Reports

Loop over {{trigger.team_members}}
  Variable: member

  → HTTP Request: Fetch {{member.id}} data
  → Agent: Generate report for {{member.name}}
  → Action: Email report to {{member.email}}

Best Practices

Prevent infinite loops and runaway costs. Set a reasonable maximum.
Instead of 100 individual agent calls, batch items into groups of 10.
Add a condition before the loop to check if array has items.
Loops with AI agents can be expensive. Calculate: cost per item × number of items.

Cost Warning

Loops can consume significant credits when processing many items with AI agents. A loop with 100 items and an agent call at 0.10each=0.10 each = 10 per run.

Next Steps