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

# Loop

> Repeat a set of steps until a condition is met or an array is fully iterated.

The **Loop** node repeats a set of workflow steps based on a condition or until an array is fully processed. It produces two output branches on the canvas: **Loop** (steps that execute on each iteration) and **Done** (steps that run after the loop completes). The final step in the loop chain should connect back to the loop node's input to create the iteration cycle.

## Configuration

### Loop Condition

| Field              | Required | Description                                                                                             |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------- |
| **Condition Type** | Yes      | Determines how the loop iterates. See options below.                                                    |
| **Continue Loop**  | Yes      | Controls when the loop continues. Options are `True (continue looping)` and `False (stop immediately)`. |

### Condition Types

| Type                   | Description                                                    |
| ---------------------- | -------------------------------------------------------------- |
| **Array Iteration**    | Iterates over each item in an array.                           |
| **Boolean Conditions** | Continues looping while a boolean condition evaluates to true. |
| **Iteration Count**    | Loops a fixed number of times.                                 |
| **Expression**         | Continues looping while a custom expression evaluates to true. |
| **Simple True/False**  | A basic true/false value for testing loop behavior.            |

### Safety Settings

| Field              | Description                                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
| **Max Iterations** | The maximum number of times the loop can execute. Default is `10`. Acts as a safety limit to prevent infinite loops. |

### Loop Structure

The Loop node produces two output branches on the canvas:

| Branch   | Description                                          |
| -------- | ---------------------------------------------------- |
| **Loop** | Connects to steps that execute on each iteration.    |
| **Done** | Connects to steps that run after the loop completes. |

## Results

The **Results** tab shows the loop execution details after the node runs.

<Note>
  The final step in the loop chain must connect back to the loop node's input to create the iteration cycle. The loop continues while the condition evaluates to true.
</Note>
