Skip to main content
A loop edge connecting a node's output back to an upstream input
Loops let you pass data upstream to define recursive workflows. They are useful for generate-and-critique cycles, paginated API calls, website crawling, task orchestration, and chat memory.
Most of the time you don’t need a loop. Runchat already iterates over each input to a parameter and runs calculations in parallel. Reach for a loop edge only when you genuinely need a recursive flow where the next iteration depends on the previous one.
You create a loop by connecting an output parameter back to an input on an upstream node. The maximum number of iterations is 100, regardless of loop type.

How loops update the canvas

Diagram showing which nodes execute on each loop iteration
Nodes between the loop’s source and target run on every iteration. Their immediate children also run, which lets you incrementally build a list during the loop without threading it through every node. Nodes further downstream from those children only run once, after the loop completes.

For loops

A for-loop runs a fixed number of times. Click the blue loop tag in the centre of a loop edge to set the count, up to 100.

While loops

A while loop using a referenced output as the stop condition
A while-loop runs until a condition becomes false. Reference an output parameter from your workflow as the loop’s stop condition. While that parameter evaluates to true, the loop continues. When it evaluates to false, the loop stops. Still capped at 100 iterations.

Loops as memory

A zero-iteration loop edge used to pass an output directly to an input on the next run
A loop edge set to zero iterations doesn’t loop, but it still passes the output value back to the input on the next run. This gives a node memory of its previous output. Useful for:
  • Building chat history that continues across runs
  • Adding to a list over time
  • Running counters
  • Anything that needs to know what happened on the previous run

Next steps