---
url: >-
  https://adk.nht.io/api/@nhtio/adk/turn_runner/type-aliases/TurnPipelineMiddlewareFn.md
description: >-
  Middleware function signature for the input and output pipelines in a {@link
  @nhtio/adk!TurnRunner}.
---

# Type Alias: TurnPipelineMiddlewareFn

```ts
type TurnPipelineMiddlewareFn = (
  ctx: TurnContext,
  next: NextFn,
) => void | Promise<void>;
```

Defined in: [lib/types/turn\_runner.ts:21](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/types/turn_runner.ts#L21)

Middleware function signature for the input and output pipelines in a [@nhtio/adk!TurnRunner](../classes/TurnRunner.md).

## Parameters

| Parameter | Type                                                   | Description                                                                                       |
| --------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| `ctx`     | [`TurnContext`](../../types/interfaces/TurnContext.md) | The mutable [@nhtio/adk!TurnContext](../../types/interfaces/TurnContext.md) for the current turn. |
| `next`    | `NextFn`                                               | Callback to advance to the next middleware in the chain.                                          |

## Returns

`void` | `Promise`<`void`>
