> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryprofound.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add iterations to Workflows

> Loop a Workflow through a list and run the same steps for each item

## Overview

The Iteration node loops through a list within a Workflow, executing the same sequence of steps for each item automatically.

By default, a Workflow processes a single input and produces a single output. The Iteration node extends this by applying the same process across an entire list, taking multiple inputs and producing multiple outputs within a single Workflow run.

Use an Iteration node when a Workflow must perform a repeated action across multiple values, such as running an LLM prompt for each item in a list of keywords or URLs. Examples include:

* Analyzing a list of URLs to identify common themes in their content and structure, then optimizing an owned piece of content accordingly.
* Collecting prompt responses across multiple answer engines, regions, or topics and conducting bulk analysis on brand and product mentions to surface trends.
* Iterating over a list of Reddit threads to generate a clean report on top narratives and recurring themes.

## Add an Iteration node

Select the **+** icon in the Workflow Builder and select **Iteration**. Alternatively, drag **Iteration** from the node selection menu into the workflow.

![Workflow Builder with the add-node menu open and Iteration listed under Logic](https://mintcdn.com/profound-37face47/krg2axnqfW1y145P/images/agents/how-tos/add-iterations-1.png?fit=max\&auto=format\&n=krg2axnqfW1y145P\&q=85\&s=1cbd216e51655938d567b4d822124efb)

Iterations require a list of items as the input. The node loops through each item sequentially, passing the current item as a variable to the steps inside the loop.

## Configure an Iteration node

Configuring an Iteration node requires two things: passing in a list, and building the steps that execute on each iteration. The node contains its own self-contained editor, modeled after the broader Workflow Builder.

![Iteration node containing a Prompt LLM step, with a list variable selected under Iterate on](https://mintcdn.com/profound-37face47/krg2axnqfW1y145P/images/agents/how-tos/add-iterations-2.png?fit=max\&auto=format\&n=krg2axnqfW1y145P\&q=85\&s=93eb705488edc54dc19d59d36cf2945f)

### Iterate over a list

An Iteration node accepts any accessible list variable, including an earlier node's output. To use a Workflow input, select the input node, add a new input, and choose **List** from the dropdown.

![Add input field dialog with the type menu open and List highlighted](https://mintcdn.com/profound-37face47/krg2axnqfW1y145P/images/agents/how-tos/add-iterations-3.png?fit=max\&auto=format\&n=krg2axnqfW1y145P\&q=85\&s=66f45291d7e178e7bb8e236643ff4173)

### Configure your Iteration node

Select the node to open the node settings menu, then select the list variable as the value to iterate on.

The output of an Iteration node defaults to the outputs of the last node within it.

### Add your Iteration steps

Add nodes to the Iteration node the same way you add nodes to the Workflow Builder. Select the **+** icon in the Iteration editor and select a node, or drag a node in from the node selection menu.

> [!TIP]
>
> Each step repeats for every item in the list. Place any node that should run only once outside the Iteration editor.

### Structure your output

Add output fields to map your final results when using the Prompt LLM node. In your LLM prompt, specify what information should populate each field, for example, "*Return each URL in the* `urls` *output field.*" Then add those same fields as structured output fields in the node settings.

![Prompt LLM settings inside an Iteration node with a prompt and structured output fields for index and value](https://mintcdn.com/profound-37face47/krg2axnqfW1y145P/images/agents/how-tos/add-iterations-4.png?fit=max\&auto=format\&n=krg2axnqfW1y145P\&q=85\&s=05d7c5c272bc3d67c034c2b575c4471c)

## Iteration node requirements

There are several requirements to ensure a Workflow executes as expected:

* The input must be a list variable accessible to the Iteration node.
* The current item variable is only accessible within the steps inside the loop and cannot be referenced in steps outside the Iteration node.
* Steps inside the loop execute once per item in the list.
* The Iteration node must connect to an End step or additional steps to complete the Workflow run.
