---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/tools/_shared/functions/runOutputPipeline.md
---

# Function: runOutputPipeline()

```ts
function runOutputPipeline<C>(
  mw: Middleware<MiddlewareFn<C>>,
  ctx: C,
  label: string,
): Promise<void>;
```

Defined in: [batteries/tools/\_shared/index.ts:246](https://github.com/NHTIO/ADK/blob/v1.20260609.1/src/batteries/tools/_shared/index.ts#L246)

Run an output pipeline over `ctx`; rethrow any stage error to the caller's try/catch. A
non-terminal pipeline (no `next()`) throws.

## Type Parameters

| Type Parameter |
| -------------- |
| `C`            |

## Parameters

| Parameter | Type                                                                     | Description                                                                        |
| --------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| `mw`      | `Middleware`<[`MiddlewareFn`](../type-aliases/MiddlewareFn.md)<`C`>> | The `Middleware` instance holding the stages (a fresh `.runner()` is minted here). |
| `ctx`     | `C`                                                                      | The mutable output context handed to each stage.                                   |
| `label`   | `string`                                                                 | Battery name, used in the non-terminal error message.                              |

## Returns

`Promise`<`void`>
