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

# Batch

> Fan a workflow out over prompts, models, parameters, or files—with explicit Set and Explode behavior for file groups.

The Batch node turns one downstream field into several values. Connect its output to an editable field, add values, and the downstream chain runs once for each emitted item.

For scalar fields, each row is normally one item. For file fields, each row is a **set** of files and you choose whether to keep that set together or **Explode** it into one item per file.

## How fan-out works

<Steps>
  <Step title="Connect Batch to a field">
    Drag the Batch output to an editable field on a downstream node, such as an LLM prompt, model selector, generation parameter, or file upload. Batch copies that field's label, type, and control.
  </Step>

  <Step title="Add values">
    Add scalar rows, or choose files for a file row. The node's badge shows the current row count or that it is using a dynamic list.
  </Step>

  <Step title="Choose Set or Explode for files">
    A file row defaults to **Set**, which keeps all files together in one item. Switch it to **Explode** to emit one item per file.
  </Step>

  <Step title="Run">
    Each emitted item runs the connected node and its downstream chain once.
  </Step>
</Steps>

**Scalar example.** Three prompt rows—`a cat`, `a dog`, and `a fox`—make the connected LLM run three times.

**File example.** One row containing ten product images behaves differently by mode:

| File mode   | Emitted items                   | Downstream runs |
| ----------- | ------------------------------- | --------------- |
| **Set**     | 1 item containing 10 file parts | 1               |
| **Explode** | 10 items containing 1 file each | 10              |

<Note>
  Batch stays one node on the canvas. It is the output items—not the number of visible nodes—that multiply downstream runs.
</Note>

## Set vs. Explode

Set and Explode are available on file rows when the row contains multiple files or receives files from an upstream connection.

* **Set** keeps every file in the row together. Use it when a model should see the whole reference set in one call.
* **Explode** separates the files. Use it when the same chain should process each file independently.
* Each file row makes its own choice, so one row can remain a set while another explodes.

To run once per file from a [Collection](/workflow/nodes/collection-read), connect the Collection's **Files** output to a Batch file row and enable **Explode**. A Collection by itself, or a Batch row left in Set mode, remains one bundled item.

## Static and dynamic lists

A scalar Batch can get its values in two ways:

* **Static rows** — enter values directly in the Batch node with **Add one more**.
* **Dynamic list** — connect a [User Input](/workflow/nodes/input) to the Batch's **User input** handle. The User Input becomes a repeated list editor used by the canvas, published Runner, and API.

Dynamic User Input lists can contain up to **25 items**. The caller can add and remove items without changing the workflow graph.

File batches keep per-row input handles because every row represents its own file set. Scalar batches use the whole-list **User input** handle; old workflows with legacy scalar row connections continue to work.

## Cartesian products

When independent lists reach different fields on the same downstream node, the run count is their Cartesian product.

**Example: compare models across prompts.**

* Batch A → Model with 3 models.
* Batch B → Prompt with 2 prompts.
* The LLM runs **3 × 2 = 6** times, once for every model-and-prompt pairing.

| First list | Second list | Runs |
| ---------- | ----------- | ---- |
| 3          | —           | 3    |
| 3          | 2           | 6    |
| 4          | 5           | 20   |

<Warning>
  Combinations grow quickly. Three lists of 10 reaching one node create 10 × 10 × 10 = **1,000 runs**. Review the displayed run count and price estimate before starting.
</Warning>

## Inputs

| Handle                  | Type                                 | Required | Notes                                                                                                      |
| ----------------------- | ------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------- |
| User input              | adapts to the bound scalar field     | No       | Supplies the whole scalar list from one User Input. It is available while unbound and for scalar batches.  |
| One handle per file row | `image`, `video`, `audio`, or `file` | No       | Supplies the file set for that row. The row's Set/Explode choice controls whether the files stay together. |

## Outputs

| Handle  | Type                      | Notes                                                                                                                                       |
| ------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `value` | adapts to the bound field | Emits the Batch items. Before binding, it is labeled **Value** and typed `any`; after binding, it adopts the target field's label and type. |

The output binds to an editable downstream **field**. It does not connect to arbitrary structural handles such as an Agent's tool list.

## Supported field types

Batch supports:

* Text input and text area
* Select and tabs
* Model selector
* Range and number
* File/upload fields, including image, video, and audio

Boolean toggles and collection selectors are not batchable. To batch a collection's files, connect the Collection output to a Batch **file row** instead of batching the collection selector.

## Published workflows and API inputs

Batch is internal workflow logic. It becomes caller-editable only when a [User Input](/workflow/nodes/input) is connected to its **User input** handle.

That User Input appears as a repeated field in the published Runner and as an array in the API `inputs` object. The Batch emits one item per supplied scalar value, up to the 25-item limit.

File sets configured directly on Batch remain part of the saved workflow. Their Set/Explode choices are saved with each row.

## Results and cost

* User Result preserves one output item per successful iteration.
* Failures are tracked per item, so successful iterations can still complete.
* Cost scales with emitted items and with downstream Cartesian products.
* For files, Set counts as one item per row; Explode counts one item per file.

## Next steps

<CardGroup cols={2}>
  <Card title="Lists & single values" icon="list-tree" href="/concepts/lists-and-values">
    Understand items, file parts, fan-out, and Cartesian products.
  </Card>

  <Card title="Collection node" icon="folder" href="/workflow/nodes/collection-read">
    Supply a reusable file bundle and optionally explode it with Batch.
  </Card>
</CardGroup>
