Run a Workflow Step for Each Item

Call the same read-only tool once for each item in an upstream list: how to pick the list, how to use the current item and its position in the inputs, how failures are handled, and how to view per-item results and retry failed items in the run details

Last updated:

Run for Each Item Overview

A Run for Each Item step takes a list from the result of an upstream step, calls the same read-only tool for each item in turn, and passes the combined results, in the original order, to the next step. It suits "the previous step listed a batch of things and I need to look up details for each one", for example listing projects first and then fetching the details of each project.

How this differs from Call Tool: Call Tool calls a tool once, while Run for Each Item calls it once for every item in the list. How it differs from Hand Off to AI Employee: when each call is fully determined by its item, Run for Each Item is faster and the results are not paraphrased by AI. Hand the work to an AI employee only when the next call depends on the previous result, or when you need to write data.

Prerequisites and Rules

  • Only people who can edit the workflow can change it. For permissions, see Build a Workflow.
  • Which tools you can choose and whose authorization is used are exactly the same as for Call Tool: it uses the Personal Authorization of the person running the workflow (for scheduled runs, the person who created the schedule trigger), and you can only choose read-only tools whose permission is Allow. See Build a Workflow.
  • Items run one after another in list order, never at the same time.
  • At most 200 items per run. If the list is longer, the step fails and no item is run; split the list upstream.
  • If the selected value is not a list at run time, the step fails and no item is run. If the list is empty, the step succeeds and outputs an empty list. If the list contains duplicate items, each one still runs once.
  • The combined return data of the successful items can be at most 1 MB. When it goes over, the step stops and the remaining items are not run.
  • It cannot be placed inside a parallel branch. Put it before the split or after the merge; see Parallel Branches.

How to Configure It

  1. Click Add Step at the bottom of the canvas and choose Run for Each Item under Capability.
  2. List to Run for Each Item: first choose an upstream step, then enter the field path of the list in its output.
  3. For Each Item: choose the tool and fill in its inputs, as in Call Tool. Under Insert Variable in the inputs, besides the results of upstream steps, you can also insert:
    • Current Item: the item in the list that is currently running;
    • Insert Field: enter a field path (such as project_id) to insert one field of this item;
    • Item Number: the position of this item in the original list, starting from 1; it stays the same on retry.

These three only work in the inputs of this step. Referencing them from another step causes an error.

  1. You can also ask AI to help build it: click Ask AI to Help at the top left of the canvas and explain what to look up for each item of which list.

Two entries in the issue list relate to this step:

  • No list has been selected to run for each item.: marked Blocks Publishing; you cannot publish without choosing one.
  • The inputs do not use the current item, so the tool will be called with the same inputs for every item.: only a hint, it does not block publishing. Most likely you forgot to insert the current item; using only Item Number also counts as not using it.

When Something Fails

  • If an item times out or the connection fails, it is retried automatically once.
  • If a single item has its own problem (the tool returns an error, the item's return data exceeds 1 MB, or a field referenced in the inputs does not exist on that item): that item is recorded as failed and the next item runs. After all items have run, if any item failed, the step fails, the run stops at this step, and downstream steps do not run.
  • If 5 items in a row get no response from the other app: the step stops early and the remaining items are not run.
  • If the whole step cannot continue (the runner's authorization has expired or the app is not connected, the tool was deleted or its inputs changed, or the tool's permission was changed to Needs Review / Deny): it stops the first time this happens and the remaining items are not run.
  • When everything succeeds, the step outputs all results: one per list item, in the original order, and each contains the item itself (item) and the tool's return for it (result).

Viewing and Retrying in the Run Details

  • Click this step on the canvas. The top of Node Details shows a summary: while it runs, how many items have succeeded, failed or not run yet, refreshed automatically; after it finishes, how many succeeded, failed or were not executed.
  • Below the summary is a per-item list. Each item is marked Succeeded, Failed, Running, Not Run Yet or Not Executed. Open an item to see the item itself, the inputs actually used, and the tool's return or the original error message; for retried items you can also see the earlier attempts. Not Executed only appears after the step stopped early.
  • Retry Failed Items reruns only the failed items. If the step stopped early, the items that were not run are run as well. Items that already succeeded are not called again and keep their original return.
    • Only the person who started the run can click it, using their own authorization. Everyone else sees a grayed-out button with a note that only the runner can retry.
    • You can retry both test runs and live runs, with no limit on the number of retries or on time. A retry uses the list from that run and does not rerun upstream steps; even if a new version of the workflow has been published, it still uses the version that the run started with.
    • When you retry a test run, your other unfinished test runs of this workflow are stopped, the same as clicking Test Run again, so only one stays running at a time. While someone else is editing the workflow, a test run cannot be retried either (just as Test Run cannot be clicked then); you are told that the other person is editing, so try again after they leave edit mode. Live runs are not affected.
    • When everything succeeds, the run continues from this step; if some items still fail, it stays at this step and you can retry again. For a run that has been retried, Node Details shows how many times it was retried.
    • You cannot retry in these cases: the run was stopped before (This run has been stopped and cannot be retried. Start a new run.); and when the step stopped because the combined data exceeded 1 MB, the button is not shown, since a retry would exceed the limit as well.
  • If you click Stop Run while it runs: the item currently running finishes and nothing continues after it. The remaining items are marked Not Executed.

Run for Each Item FAQ

  • What if the list has more than 200 items? Split the list upstream, for example by fetching it in several time periods, and use one Run for Each Item step for each.
  • Retry Failed Items is grayed out? Only the person who started the run can retry, so ask them to click it. Or the run was stopped before; in that case, start a new run.
  • The step stopped because results exceeded 1 MB? Use a tool that returns less data, or split the list upstream.
  • How does the next step use the results of Run for Each Item? Reference all results (results) in this step's output. The result in each item is the tool's original return. Do a test run first to see what the return looks like, then configure the next step.