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

# Loop

> Run a set of actions repeatedly over a list of items — process each item individually then combine the results.

Run a set of actions over each item in a list. Use this to process multiple records, URLs, files, or any collection of data — each item goes through the same sequence of actions, and the results are combined at the end.

<Info>Loop is an advanced feature. If you need help setting it up for your use case, reach out to our team at [support@cassidyai.com](mailto:support@cassidyai.com).</Info>

## Prerequisites

You need a list variable to loop over. You can get one from:

* **Extract Information** with the "List" option checked
* Trigger inputs with **Allow multiple values** enabled
* **Run Code** actions that output lists
* Structured outputs from other actions
* Actions that return multiple records (like CRM lookups)

Or you can enter hardcoded items directly.

<Steps>
  <Step title="Add the action">
    In the Workflow builder, click **+** between blocks and select **Loop** from the action library.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-0.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=de4eaa146d06e9c568266b855dd6dfcb" alt="Plus button between Workflow blocks" width="741" height="417" data-path="images/reference/loop-img-0.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-1.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=e69a406b841a2b8049c35b0a58fdfbe8" alt="Loop action selected from the action library" width="975" height="582" data-path="images/reference/loop-img-1.png" />
    </Frame>

    Once added, the Loop appears in your Workflow with a dedicated area for inner actions:

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-2.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=3264dacbbd6430303d293ff9a05f1204" alt="Loop action interface in the Workflow builder" width="975" height="451" data-path="images/reference/loop-img-2.png" />
    </Frame>
  </Step>

  <Step title="Select the list to loop over">
    In **List of Items to Loop Over**, choose how to provide the list:

    1. **Select an existing list variable** — Click the field, choose **Select a variable**, and pick a list variable from a previous step or trigger.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-5.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=02daf7d6b7c2137a0318a9af5b9f61b6" alt="Select a variable option in the list field" width="564" height="134" data-path="images/reference/loop-img-5.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-6.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=3999aa7869da2c3c03f003b485eaa8d5" alt="Variable selector showing available list variables" width="1370" height="590" data-path="images/reference/loop-img-6.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-7.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=abdc3e2a686a7f27ed0089e4935bcb77" alt="List variable selected and displayed" width="786" height="303" data-path="images/reference/loop-img-7.png" />
    </Frame>

    2. **Enter hardcoded items** — Click the pencil icon to switch to manual entry. Type an item or click **#** to reference a variable, then click **Add**. Repeat for each item.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-8.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=8507c1a2ab608f2031bbc47c0173f304" alt="Manual item entry with hardcoded values and variables" width="598" height="232" data-path="images/reference/loop-img-8.png" />
    </Frame>
  </Step>

  <Step title="Add actions inside the loop">
    Click **+** inside the Loop to add actions that run for each item. For each item in the list, these actions run once — so if your list contains 3 items, the Loop runs 3 times.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-9.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=2f129c80e5ddc2da8668a1bc6fb64a2c" alt="Adding an action inside the Loop" width="1226" height="460" data-path="images/reference/loop-img-9.png" />
    </Frame>

    To pass the current item to an action, select the **Current item** variable from the **Loop** section of the variable selector.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-10.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=add42e0282051059bcbc756327e3cd6f" alt="Current item variable selected from the Loop section" width="2482" height="1024" data-path="images/reference/loop-img-10.png" />
    </Frame>

    You can add multiple actions inside the Loop — each item goes through the full sequence.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-11.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=a5290b3e79c7b4264f964e1da3697e5b" alt="Multiple actions configured inside the Loop" width="1206" height="2462" data-path="images/reference/loop-img-11.png" />
    </Frame>
  </Step>

  <Step title="Configure the loop output">
    Choose how results from each iteration are combined:

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-12.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=ac336eac39a55e3fa1802edeaa0063b7" alt="Loop Output configuration options" width="770" height="344" data-path="images/reference/loop-img-12.png" />
    </Frame>

    * **Default** — Concatenates all outputs from each iteration into a single merged result.

    * **Custom Text** — Define a template for how each iteration's output is formatted. Use **#** to reference variables from the loop's inner actions.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-13.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=8c71f3d52e5738ff555e5c2ecf6b4ed6" alt="Custom Text output template with variables" width="758" height="600" data-path="images/reference/loop-img-13.png" />
    </Frame>

    Choose a **separator** to place between individual loop results when merging: **New Line**, **Dashed Line**, or **Comma-Separated**.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-14.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=8f262b8569ed52079e951c6f6bfb0dad" alt="Separator options: New Line, Dashed Line, Comma-Separated" width="1138" height="386" data-path="images/reference/loop-img-14.png" />
    </Frame>

    * **Select Specific Variables** — Choose which variables to return as lists, with one value per iteration (in order). Useful when you need a clean list of outputs for later steps (e.g., titles, URLs, IDs, or files).

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-15.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=46c195eaad66116bd7c767c26c56eda1" alt="Select Specific Variables output configuration" width="568" height="328" data-path="images/reference/loop-img-15.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-16.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=925868f4f787955d01ab2c254d7f5a4b" alt="Selected variables returned as lists" width="1600" height="1009" data-path="images/reference/loop-img-16.png" />
    </Frame>
  </Step>

  <Step title="Use the loop output">
    After the Loop, reference its output in subsequent actions. The combined output is available as a single variable.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-17.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=bd5b6767556dca2d231252669fb2b560" alt="Action after Loop referencing the Loop output variable" width="2416" height="1616" data-path="images/reference/loop-img-17.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-18.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=d20a2afa624d68f6c4a6632ad19bd5b2" alt="Combine Text action using the Loop output" width="2398" height="1274" data-path="images/reference/loop-img-18.png" />
    </Frame>
  </Step>

  <Step title="Inspect individual loop iterations">
    After running the Workflow, click the numbered icon on the Loop step to inspect each iteration. Open any individual loop to see the result and output of each action within that iteration.

    <Frame>
      <img src="https://mintcdn.com/cassidy/KPnIokfoTlpXCsBG/images/reference/loop-img-22.png?fit=max&auto=format&n=KPnIokfoTlpXCsBG&q=85&s=0ee7463ff34c0ce9908d51b81770b630" alt="Inspecting individual loop iterations in the run results" width="992" height="1918" data-path="images/reference/loop-img-22.png" />
    </Frame>
  </Step>
</Steps>

## Related

* [Extract Information](/reference/actions/extract-information)
* [Get Knowledge Base Folder Contents](/reference/actions/get-knowledge-base-folder-contents)
* [Build and configure Workflows](/workflows/building)
