Skip to content

Fan-out

Fan-out means running the same steps once for every item in a list. For example, a workflow reads ten tickets and then runs an AI step on each ticket. This page explains when fan-out happens and how to collect the results.

Fan-out is automatic. You don’t write a keyword for it. It happens when both of these are true:

  • A step’s output is a JSON list with at least one item.
  • At least one more step follows.

Anthara then creates one child run for each item. The original run is the parent run. The parent waits until every child has finished.

If the list is empty, the run ends as Completed and the later steps are skipped.

name: Summarize Open Stories
slug: summarize-open-stories
trigger:
type: manual
steps:
- name: fetch-stories
type: read_data
provider: jira
connection: Jira
config:
query: project = DEMO AND status = "To Do"
- name: summarize-story
type: ai_task
config:
prompt: |
You receive ONE Jira story as JSON:
{{steps.fetch-stories.output}}
Summarize it in two sentences.

fetch-stories returns a list. Each child run then runs summarize-story for one story.

Inside a child run, {{steps.fetch-stories.output}} is a single item, not the whole list. Write the prompt for one item.

To run a step once after all the children finish, mark it with fan_in: wait_all_collect.

- name: collect
type: echo
fan_in: wait_all_collect
- name: write-digest
type: ai_task
config:
prompt: |
Here are the summaries as a JSON list:
{{steps.collect.output}}
Write a short digest.

With a fan_in step, the work is split like this:

Steps Run in
Steps between the fan-out step and the fan_in step Each child run
The fan_in step and the steps after it The parent run, once

The fan_in step does not do its own work. Its type and config are ignored. Its output is a JSON list that holds the last output of every child that completed.

Workflow shape Result
No fan_in step If any child fails, the parent run fails.
With a fan_in step Failed children are left out of the collected list and recorded in the audit log. The parent run continues.

Open the parent run and go to the Steps tab. The fan-out step expands to show Child Runs. Each child has its own steps, logs, and status.

There is no cap on the number of child runs. A list of 200 items creates 200 child runs, and each AI step starts its own worker. Keep the query in the first step narrow.