---
url: >-
  https://adk.nht.io/api/@nhtio/adk/dispatch_runner/type-aliases/DispatchExecutorFn.md
description: >-
  The user-supplied callback that performs the actual LLM API call within a
  dispatch.
---

# Type Alias: DispatchExecutorFn

```ts
type DispatchExecutorFn = (
  ctx: DispatchContext,
  helpers: DispatchExecutorHelpers,
) => void | Promise<void>;
```

Defined in: [lib/types/dispatch\_runner.ts:238](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/types/dispatch_runner.ts#L238)

The user-supplied callback that performs the actual LLM API call within a dispatch.

## Parameters

| Parameter | Type                                                                  |
| --------- | --------------------------------------------------------------------- |
| `ctx`     | [`DispatchContext`](../../types/interfaces/DispatchContext.md)        |
| `helpers` | [`DispatchExecutorHelpers`](../interfaces/DispatchExecutorHelpers.md) |

## Returns

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

## Remarks

Invoked between the input and output middleware pipelines on every iteration. Receives the
active [@nhtio/adk!DispatchContext](../../types/interfaces/DispatchContext.md) and an [DispatchExecutorHelpers](../interfaces/DispatchExecutorHelpers.md) object that manages
per-id streaming state for the dispatch. The executor's responsibilities:

1. Make the actual LLM API / SDK call (the ADK has no opinion on which provider).
2. Normalise streaming responses into `TurnStreamableContent` / `TurnToolCallContent` shapes
   and report them via the helpers.
3. Persist the resulting `Message` / `Thought` / `ToolCall` records via `ctx.storeMessage` /
   `ctx.storeThought` / `ctx.storeToolCall` once the implementation-specific fields are
   known.
4. Decide when the loop is done — typically `ctx.ack()` after a response with no further
   tool calls, or `ctx.nack(err)` on failure. The runner will loop again if neither signal
   nor abort fires.

Wired into a `TurnRunner` via `TurnRunnerConfig.executorCallback`. Invoked once per
iteration inside `DispatchRunner.dispatch()`, between the input and output middleware
pipelines.
