Type Alias: DispatchExecutorFn
ts
type DispatchExecutorFn = (
ctx: DispatchContext,
helpers: DispatchExecutorHelpers,
) => void | Promise<void>;The user-supplied callback that performs the actual LLM API call within a dispatch.
Parameters
| Parameter | Type |
|---|---|
ctx | DispatchContext |
helpers | DispatchExecutorHelpers |
Returns
void | Promise<void>
Remarks
Invoked between the input and output middleware pipelines on every iteration. Receives the active @nhtio/adk!DispatchContext and an DispatchExecutorHelpers object that manages per-id streaming state for the dispatch. The executor's responsibilities:
- Make the actual LLM API / SDK call (the ADK has no opinion on which provider).
- Normalise streaming responses into
TurnStreamableContent/TurnToolCallContentshapes and report them via the helpers. - Persist the resulting
Message/Thought/ToolCallrecords viactx.storeMessage/ctx.storeThought/ctx.storeToolCallonce the implementation-specific fields are known. - Decide when the loop is done — typically
ctx.ack()after a response with no further tool calls, orctx.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.