Sparround

Loops, Wait and sub-workflows

You rarely need to build a loop in n8n. Nodes automatically run over every incoming item: five items into a Slack node means five messages. The most common beginner mistake is building loops by hand without knowing this.

An explicit loop is only needed in a few cases:

  • Loop Over Items — splitting items into batches and processing each batch separately. It is the main tool for staying within API rate limits. Set Batch Size = 1 when each item must be handled on its own.
  • Pagination — with the HTTP Request node you have to build the loop yourself to walk through a paginated response
  • Repeat until a condition holds — connect a node's output back to an earlier node's input and stop it with an IF

If you want a node to work on only the first item, no loop is needed — turning on Execute Once in the node's Settings tab is enough.

ToolWhat forWatch out for
Automatic iterationThe node runs once per item — nothing to buildSome nodes are exceptions (the Code node in "Run Once for All Items" mode, for one)
Loop Over ItemsBatching; staying inside API rate limitsThe node stops itself once every batch is processed — no IF needed
WaitWaiting for a duration or until a point in timeFor rate limits, the wait goes between batches
Execute Sub-workflowExtracting logic into a separate workflow and reusing itIf the sub-workflow has errors, the parent cannot trigger it
MergeCombining branches or streams from different sourcesChoose the right mode (append vs a join key)

A sub-workflow is a separate workflow called by another one. It is built from a pair of nodes: Execute Sub-workflow on the calling side and the Execute Sub-workflow Trigger on the called side (it also appears in node search as "When Executed by Another Workflow").

The called workflow accepts incoming data in one of three modes:

  • Define using fields below — you declare the expected field names and types; the calling node picks them up automatically
  • Define using JSON example — you supply an example object showing the expected shape
  • Accept all data — no requirements at all; the sub-workflow must handle any inconsistency itself

Sub-workflows solve three problems: reuse (the same logic in several places), readability (splitting a huge canvas) and memory (reducing the memory pressure of one enormous workflow). They are also the only form of "your own logic" that can be handed to an AI agent as a tool.

Sub-workflow executions do not count towards a plan's monthly execution limit or active-workflow limit. That makes splitting logic into small modules economical on n8n Cloud too — the split does not raise the bill.

📚 Sources and documentation