Iteration
Learn about iteration and how to implement it effectively.
3 min read
🆕Recently updated
Last updated: 12/9/2025
Iteration (Agentflow Node)
The Iteration node in InnoSynth-Forjinn's Agentflow provides powerful looping capabilities, allowing you to execute a block of nodes repeatedly for each item in an input array. This is essential for automating tasks that involve processing multiple pieces of data sequentially.
Purpose
The Iteration node is designed for:
- Batch Processing: Performing the same set of operations on each item in a list (e.g., summarizing multiple documents, generating responses for multiple prompts).
- Data Transformation: Applying a series of transformations to each element of an array.
- Dynamic Task Generation: Creating and executing sub-tasks for each item in a collection.
Appearance on Canvas
(Image: Placeholder for the Iteration node icon/appearance on the canvas)
Configuration Parameters
The Iteration node has a single primary configuration parameter:
1. Array Input (Required)
- Label: Array Input
- Type:
string - Description: The input array over which the iteration will occur. This should be a JSON string representing an array (e.g.,
["item1", "item2"]or[{"key": "value"}, {"key": "value2"}]). Supports variables. - Important: Ensure the input is a valid JSON array string.
Inputs & Outputs
- Input: Receives the array (as a string) that will be iterated over.
- Output: The Iteration node itself does not have a direct output port for the results of each iteration. Instead, the nodes connected within the iteration block will execute for each item. The results of these internal nodes can then be collected or processed by subsequent nodes outside the iteration block, or by updating the flow state.
How it Works During Execution
When the workflow reaches an Iteration node:
- The node parses the
Array Inputinto a list of items. - For each item in the array:
- The nodes connected downstream from the Iteration node (within its conceptual block) are executed.
- The current item being processed in the loop is typically available as a variable (e.g.,
{{item}}or{{loop.item}}) to the internal nodes, allowing them to operate on that specific data.
- Once all items in the array have been processed, the workflow continues to any nodes connected after the iteration block.
Example Usage: Summarizing Multiple Articles
Imagine you have a list of article URLs and you want to summarize each one.
- Connect a node that provides a list of URLs (as a JSON array string) to the input of an
Iterationnode. - Configure Array Input: Set this to the variable containing your list of URLs (e.g.,
{{articleUrls}}). - Inside the Iteration Block:
- Connect the
Iterationnode to anHTTPnode (to fetch the article content, using{{item}}as the URL). - Connect the
HTTPnode to anLLMnode (configured to summarize the fetched content). - Connect the
LLMnode to acustom functionnode (to collect all summaries into a single array in the flow state).
- Connect the
- After the Iteration Block: Connect the
custom functionnode to aChat Outputnode to display the collected summaries.
This setup will fetch, summarize, and collect the results for each article URL in your input array.