Iterator
Description
The Iterator node routes incoming data to a different output anchor on each workflow restart, cycling sequentially through its outputs. It is the primary tool for orchestrating multi-step pipelines where each step must execute in a specific order (e.g., "Step 1: fetch data", "Step 2: process data", "Step 3: export results").
Unlike the Sequencer node (which splits a single text into chunks), the Iterator does not modify the data — it simply redirects the same input to output 0, then output 1, then output 2, and so on, wrapping back to 0 after reaching the last output.
Configuration Properties
🔢 Output Count Section
NumericUpDown (default: 1)
Defines the number of output anchors. Each output represents one "step" in the iteration cycle. The node cycles through them sequentially: 0 → 1 → 2 → ... → N-1 → 0 → ...
⚙️ Options Section
Auto Restart
When checked, the node automatically enables the workflow's Auto Restart mode (equivalent to an AutomateNode with AutoRestart: Enable). This is a convenience option: it lets the Iterator drive the loop itself without needing a separate AutomateNode downstream.
💡 Tip: Use this for simple self-contained loops. For more complex workflows (where you need to stop the loop conditionally), leave this unchecked and use an
AutomateNodeinstead.
Stop On Complete (default: checked)
When checked, the node requests a workflow stop as soon as the iteration completes a full cycle (i.e., when it wraps from the last output back to output 0). This is the standard "run once through all steps, then stop" behavior.
When unchecked, the iteration continues indefinitely (useful for permanent background loops).
Advance On Signal
When unchecked (default), the node advances to the next output on every execution, regardless of the input content.
When checked, the node only advances when it receives non-empty input. If the input is empty, the node stays on the current output and waits. This is used to synchronize the Iterator with external signals (e.g., a MemoryRead + Switch chain that confirms a step is complete before moving on).
Resend Last Data
Only relevant when Advance On Signal is checked.
When checked, if the node receives an empty input (meaning "wait"), it resends the last non-empty data it received on the current output, instead of sending an empty string. This keeps downstream nodes fed with valid data while waiting for the next real signal.
When unchecked, an empty input produces an empty output.
Usage Example
"Three-step content pipeline":
- An Input node receives a topic.
- An Iterator node with:
- Output Count:
3 - Stop On Complete: checked
- Advance On Signal: unchecked
- Auto Restart: checked
- Output Count:
- Three Agent nodes, each connected to one output:
- Output 0 → "Research Agent" (gathers facts)
- Output 1 → "Writer Agent" (drafts content)
- Output 2 → "Editor Agent" (polishes the draft)
- The workflow runs three times automatically, each Agent executing in sequence, then stops.
"Wait-for-confirmation pipeline":
- An Iterator with Advance On Signal: checked and Resend Last Data: checked.
- Output 0 sends a task to an Agent.
- The Agent's result is saved to memory via a MemoryWrite node.
- A MemoryRead + Switch chain checks if the task is done.
- While the task is not done, the chain sends empty input back to the Iterator, which stays on output 0 and resends the last task.
- Once done, the chain sends a non-empty signal, and the Iterator advances to output 1.
⚠️ Pitfalls to Avoid
One input, many outputs: The Iterator has only ONE input anchor but N output anchors. All outputs receive the same data, just at different iterations. Do not confuse it with the Dispatch node, which splits different content to different outputs in a single pass.
Auto Restart without Stop On Complete: If you check Auto Restart but uncheck Stop On Complete, the workflow will loop forever. Always pair them carefully, or provide an external stop mechanism (e.g., an AutomateNode with AutoRestart: Disable triggered by a condition).
Advance On Signal + empty input loop: If Advance On Signal is checked and no upstream node ever sends a non-empty signal, the Iterator will stay stuck on the current output forever (or until TimeoutSeconds is reached, if applicable). Always ensure there is a path that eventually produces a non-empty signal.
Resend Last Data on first iteration: On the very first execution, if the input is empty and Resend Last Data is checked, the node has no "last data" to resend yet — it will send an empty string. Make sure the first iteration receives valid data.
Output Count = 1: With a single output, the Iterator behaves like a simple passthrough that optionally stops the workflow after one cycle. This is rarely useful — consider using an AutomateNode instead for single-step workflows.
Iteration state is not persisted: The current iteration index is held in memory and resets when the workflow is reloaded from disk. If you save and reload a .tzuflow file, the Iterator always starts at output 0.