---
url: 'https://adk.nht.io/api/@nhtio/adk/types/interfaces/DispatchContext.md'
description: Context object for a single LLM execution call.
---

# Interface: DispatchContext

Defined in: [lib/contracts/dispatch\_context.ts:326](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L326)

Context object for a single LLM execution call.

## Remarks

Mirrors the surface of [@nhtio/adk!TurnContext](TurnContext.md) but is path-agnostic — it knows nothing about a
parent context. Mutations apply to local Sets immediately, call persistence callbacks
immediately, and fire the corresponding mutation hook (`storedMemory`, `mutatedMemory`,
`deletedMemory`, etc.) in both standalone and derived dispatches.

The [@nhtio/adk!DispatchRunner](../../dispatch_runner/classes/DispatchRunner.md) is the only thing that creates a context with a parent
relationship: when dispatched with a `source: TurnContext`, the runner subscribes to the
mutation hooks, queues deltas internally, and flushes them to the parent's Sets at the end of
each iteration. The context itself remains unaware of the parent.

Middleware/executor signals termination via [DispatchContext.ack](#ack) (clean completion)
or [DispatchContext.nack](#nack) (failure). Both set an internal flag the runner reads at
end-of-iteration to decide whether to loop or exit. [DispatchContext.isSignalled](#property-issignalled),
[DispatchContext.isAcked](#property-isacked), and [DispatchContext.nackError](#property-nackerror) are publicly
readable getters so middleware can inspect signal state and bail early.

## Properties

| Property                                                                        | Modifier   | Type                                                                                                                                                                                                                                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Defined in                                                                                                                            |
| ------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|  `abort`                                             | `readonly` | (`reason?`: `unknown`) => `void`                                                                                                                                                                                                                             | Aborts the dispatch's `AbortController` with the supplied reason. Middleware should call this when refusing to proceed — the runner short-circuits cleanly, `dispatchEnd.status` resolves to `'aborted'`, and no `error` event is emitted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | [lib/contracts/dispatch\_context.ts:1067](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1067) |
|  `aborted`                                         | `readonly` | `boolean`                                                                                                                                                                                                                                                    | `true` when the abort controller signal has fired.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | [lib/contracts/dispatch\_context.ts:1059](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1059) |
|  `abortSignal`                                 | `readonly` | `AbortSignal`                                                                                                                                                                                                                                                | The `AbortSignal` from the execution's `AbortController`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [lib/contracts/dispatch\_context.ts:1061](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1061) |
|  `deleteMemory`                               | `readonly` | (`id`: `string`) => `Promise`<`void`>                                                                                                                                                                                                                      | Removes a memory from the local Set and persistence layer by ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | [lib/contracts/dispatch\_context.ts:1119](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1119) |
|  `deleteMessage`                             | `readonly` | (`id`: `string`) => `Promise`<`void`>                                                                                                                                                                                                                      | Removes a message from the local Set and persistence layer by ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | [lib/contracts/dispatch\_context.ts:1131](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1131) |
|  `deleteRetrievable`                     | `readonly` | (`id`: `string`) => `Promise`<`void`>                                                                                                                                                                                                                      | Removes a retrievable record from the local Set and persistence layer by ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | [lib/contracts/dispatch\_context.ts:1125](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1125) |
|  `deleteStandingInstruction`     | `readonly` | (`v`: `string` | [`Tokenizable`](../../common/classes/Tokenizable.md)) => `Promise`<`void`>                                                                                                                                                               | Removes a standing instruction from the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | [lib/contracts/dispatch\_context.ts:1113](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1113) |
|  `deleteThought`                             | `readonly` | (`id`: `string`) => `Promise`<`void`>                                                                                                                                                                                                                      | Removes a thought from the local Set and persistence layer by ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | [lib/contracts/dispatch\_context.ts:1137](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1137) |
|  `deleteToolCall`                           | `readonly` | (`id`: `string`) => `Promise`<`void`>                                                                                                                                                                                                                      | Removes a tool call from the local Set and persistence layer by ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | [lib/contracts/dispatch\_context.ts:1143](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1143) |
|  `dispatchId`                                   | `readonly` | `string`                                                                                                                                                                                                                                                     | Stable identifier for the dispatch this context belongs to; set by `DispatchRunner`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | [lib/contracts/dispatch\_context.ts:1055](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1055) |
|  `emitMessage`                                 | `readonly` | [`EmitMessageFn`](../../turn_runner/type-aliases/EmitMessageFn.md)                                                                                                                                                                                           | Emits a `message` hook; fires registered handlers synchronously.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | [lib/contracts/dispatch\_context.ts:1173](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1173) |
|  `emitThought`                                 | `readonly` | [`EmitThoughtFn`](../../turn_runner/type-aliases/EmitThoughtFn.md)                                                                                                                                                                                           | Emits a `thought` hook; fires registered handlers synchronously.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | [lib/contracts/dispatch\_context.ts:1175](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1175) |
|  `emitToolCall`                               | `readonly` | [`EmitToolCallFn`](../../turn_runner/type-aliases/EmitToolCallFn.md)                                                                                                                                                                                         | Emits a `toolCall` hook; fires registered handlers synchronously.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | [lib/contracts/dispatch\_context.ts:1177](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1177) |
|  `emitToolExecutionEnd`               | `readonly` | [`EmitToolExecutionEndFn`](../../turn_runner/type-aliases/EmitToolExecutionEndFn.md)                                                                                                                                                                         | Emits a `toolExecutionEnd` hook; fires registered handlers synchronously.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [lib/contracts/dispatch\_context.ts:1181](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1181) |
|  `emitToolExecutionStart`           | `readonly` | [`EmitToolExecutionStartFn`](../../turn_runner/type-aliases/EmitToolExecutionStartFn.md)                                                                                                                                                                     | Emits a `toolExecutionStart` hook; fires registered handlers synchronously.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | [lib/contracts/dispatch\_context.ts:1179](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1179) |
|  `fetchMemories`                             | `readonly` | () => | [`Memory`](../../common/classes/Memory.md)\[] | `Promise`<[`Memory`](../../common/classes/Memory.md)\[]>                                                                                                                                           | Fetches memories; delegates to the callback supplied at construction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [lib/contracts/dispatch\_context.ts:1093](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1093) |
|  `fetchMessages`                             | `readonly` | () => | [`Message`](../../common/classes/Message.md)\[] | `Promise`<[`Message`](../../common/classes/Message.md)\[]>                                                                                                                                       | Fetches messages; delegates to the callback supplied at construction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [lib/contracts/dispatch\_context.ts:1097](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1097) |
|  `fetchRetrievables`                     | `readonly` | () => | [`Retrievable`](../../common/classes/Retrievable.md)\[] | `Promise`<[`Retrievable`](../../common/classes/Retrievable.md)\[]>                                                                                                                       | Fetches retrievable records; delegates to the callback supplied at construction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | [lib/contracts/dispatch\_context.ts:1095](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1095) |
|  `fetchThoughts`                             | `readonly` | () => | [`Thought`](../../common/classes/Thought.md)\[] | `Promise`<[`Thought`](../../common/classes/Thought.md)\[]>                                                                                                                                       | Fetches thoughts; delegates to the callback supplied at construction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [lib/contracts/dispatch\_context.ts:1099](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1099) |
|  `fetchToolCalls`                           | `readonly` | () => | [`ToolCall`](../../forge/classes/ToolCall.md)\[] | `Promise`<[`ToolCall`](../../forge/classes/ToolCall.md)\[]>                                                                                                                                     | Fetches tool calls; delegates to the callback supplied at construction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | [lib/contracts/dispatch\_context.ts:1101](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1101) |
|  `fetchTools`                                   | `readonly` | () => | [`Tool`](../../forge/classes/Tool.md)<[`SpooledArtifact`](../../spooled_artifact/classes/SpooledArtifact.md)>\[] | `Promise`<[`Tool`](../../forge/classes/Tool.md)<[`SpooledArtifact`](../../spooled_artifact/classes/SpooledArtifact.md)>\[]> | Fetches tools; delegates to the callback supplied at construction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | [lib/contracts/dispatch\_context.ts:1103](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1103) |
|  `id`                                                   | `readonly` | `string`                                                                                                                                                                                                                                                     | Unique identifier for this execution context, generated as UUIDv6 at construction time.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | [lib/contracts/dispatch\_context.ts:1053](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1053) |
|  `isAcked`                                         | `readonly` | `boolean`                                                                                                                                                                                                                                                    | `true` when the context was signalled via [DispatchContext.ack](#ack).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | [lib/contracts/dispatch\_context.ts:1071](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1071) |
|  `isSignalled`                                 | `readonly` | `boolean`                                                                                                                                                                                                                                                    | `true` once [DispatchContext.ack](#ack) or [DispatchContext.nack](#nack) has been called.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [lib/contracts/dispatch\_context.ts:1069](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1069) |
|  `iteration`                                     | `readonly` | `number`                                                                                                                                                                                                                                                     | 0-based iteration count within the current dispatch; updated by `DispatchRunner`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | [lib/contracts/dispatch\_context.ts:1057](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1057) |
|  `mutateMemory`                               | `readonly` | (`v`: [`Memory`](../../common/classes/Memory.md)) => `Promise`<`void`>                                                                                                                                                                                     | Updates an existing memory in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | [lib/contracts/dispatch\_context.ts:1117](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1117) |
|  `mutateMessage`                             | `readonly` | (`v`: [`Message`](../../common/classes/Message.md)) => `Promise`<`void`>                                                                                                                                                                                   | Updates an existing message in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | [lib/contracts/dispatch\_context.ts:1129](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1129) |
|  `mutateRetrievable`                     | `readonly` | (`v`: [`Retrievable`](../../common/classes/Retrievable.md)) => `Promise`<`void`>                                                                                                                                                                           | Updates an existing retrievable record in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | [lib/contracts/dispatch\_context.ts:1123](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1123) |
|  `mutateStandingInstruction`     | `readonly` | (`v`: `string` | [`Tokenizable`](../../common/classes/Tokenizable.md)) => `Promise`<`void`>                                                                                                                                                               | Updates an existing standing instruction in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | [lib/contracts/dispatch\_context.ts:1111](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1111) |
|  `mutateThought`                             | `readonly` | (`v`: [`Thought`](../../common/classes/Thought.md)) => `Promise`<`void`>                                                                                                                                                                                   | Updates an existing thought in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | [lib/contracts/dispatch\_context.ts:1135](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1135) |
|  `mutateToolCall`                           | `readonly` | (`v`: [`ToolCall`](../../forge/classes/ToolCall.md)) => `Promise`<`void`>                                                                                                                                                                                  | Updates an existing tool call in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [lib/contracts/dispatch\_context.ts:1141](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1141) |
|  `nackError`                                     | `readonly` | `Error` | `undefined`                                                                                                                                                                                                                                       | The error stored by [DispatchContext.nack](#nack), or `undefined` if not nacked.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | [lib/contracts/dispatch\_context.ts:1073](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1073) |
|  `refreshStandingInstructions` | `readonly` | () => | (`string` | [`Tokenizable`](../../common/classes/Tokenizable.md))\[] | `Promise`<(`string` | [`Tokenizable`](../../common/classes/Tokenizable.md))\[]>                                                                                           | Refreshes and returns standing instructions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | [lib/contracts/dispatch\_context.ts:1105](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1105) |
|  `standingInstructions`               | `readonly` | `Set`<[`Tokenizable`](../../common/classes/Tokenizable.md)>                                                                                                                                                                                                | Standing instructions for this execution, in insertion order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | [lib/contracts/dispatch\_context.ts:1079](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1079) |
|  `stash`                                             | `readonly` | [`Registry`](../../common/classes/Registry.md)                                                                                                                                                                                                               | Arbitrary key-value store for cross-step state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | [lib/contracts/dispatch\_context.ts:1075](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1075) |
|  `storeMediaBytes`                         | `readonly` | (`id`: `string`, `bytes`: [`ConduitBytes`](../type-aliases/ConduitBytes.md)) => | [`MediaReader`](../../common/interfaces/MediaReader.md) | `Promise`<[`MediaReader`](../../common/interfaces/MediaReader.md)>                                           | Persists tool-generated media bytes into consumer storage and returns a [@nhtio/adk!MediaReader](../../common/interfaces/MediaReader.md). **Remarks** This is a low-level persistence conduit, NOT a mutation: it does not add to `turnMessages`/ `turnToolCalls` or fire a `stored*` hook. The handler builds a [@nhtio/adk!Media](../../common/classes/Media.md) from the returned reader (`Media.toolGenerated({ reader })`) and stores the owning primitive — a [@nhtio/adk!Message](../../common/classes/Message.md) attachment or [@nhtio/adk!ToolCall](../../forge/classes/ToolCall.md) result — via the relevant `store*` method separately. Persisting bytes without storing the primitive means the framework never sees the media. | [lib/contracts/dispatch\_context.ts:1155](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1155) |
|  `storeMemory`                                 | `readonly` | (`v`: [`Memory`](../../common/classes/Memory.md)) => `Promise`<`void`>                                                                                                                                                                                     | Stores a new memory in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | [lib/contracts/dispatch\_context.ts:1115](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1115) |
|  `storeMessage`                               | `readonly` | (`v`: [`Message`](../../common/classes/Message.md)) => `Promise`<`void`>                                                                                                                                                                                   | Stores a new message in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | [lib/contracts/dispatch\_context.ts:1127](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1127) |
|  `storeRetrievable`                       | `readonly` | (`v`: [`Retrievable`](../../common/classes/Retrievable.md)) => `Promise`<`void`>                                                                                                                                                                           | Stores a new retrievable record in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | [lib/contracts/dispatch\_context.ts:1121](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1121) |
|  `storeRetrievableBytes`             | `readonly` | (`id`: `string`, `bytes`: [`ConduitBytes`](../type-aliases/ConduitBytes.md)) => | [`SpoolReader`](../../spooled_artifact/interfaces/SpoolReader.md) | `Promise`<[`SpoolReader`](../../spooled_artifact/interfaces/SpoolReader.md)>                       | Persists extracted retrievable text bytes into consumer storage and returns a [@nhtio/adk!SpoolReader](../../spooled_artifact/interfaces/SpoolReader.md). **Remarks** Low-level persistence conduit, same posture as [DispatchContext.storeMediaBytes](#property-storemediabytes): returns a value, touches no Sets, fires no hook. Wrap the reader in a [@nhtio/adk!SpooledArtifact](../../spooled_artifact/classes/SpooledArtifact.md) and pass it as `Retrievable.content`, then persist the record via [DispatchContext.storeRetrievable](#property-storeretrievable).                                                                                                                                                                    | [lib/contracts/dispatch\_context.ts:1168](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1168) |
|  `storeStandingInstruction`       | `readonly` | (`v`: `string` | [`Tokenizable`](../../common/classes/Tokenizable.md)) => `Promise`<`void`>                                                                                                                                                               | Stores a new standing instruction in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [lib/contracts/dispatch\_context.ts:1109](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1109) |
|  `storeThought`                               | `readonly` | (`v`: [`Thought`](../../common/classes/Thought.md)) => `Promise`<`void`>                                                                                                                                                                                   | Stores a new thought in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | [lib/contracts/dispatch\_context.ts:1133](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1133) |
|  `storeToolCall`                             | `readonly` | (`v`: [`ToolCall`](../../forge/classes/ToolCall.md)) => `Promise`<`void`>                                                                                                                                                                                  | Stores a new tool call in the local Set and persistence layer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | [lib/contracts/dispatch\_context.ts:1139](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1139) |
|  `systemPrompt`                               | `readonly` | [`Tokenizable`](../../common/classes/Tokenizable.md)                                                                                                                                                                                                         | The system prompt for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [lib/contracts/dispatch\_context.ts:1077](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1077) |
|  `tools`                                             | `readonly` | [`ToolRegistry`](../../forge/classes/ToolRegistry.md)                                                                                                                                                                                                        | Tool registry for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | [lib/contracts/dispatch\_context.ts:1091](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1091) |
|  `turnMemories`                               | `readonly` | `Set`<[`Memory`](../../common/classes/Memory.md)>                                                                                                                                                                                                          | Memories loaded for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | [lib/contracts/dispatch\_context.ts:1081](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1081) |
|  `turnMessages`                               | `readonly` | `Set`<[`Message`](../../common/classes/Message.md)>                                                                                                                                                                                                        | Messages loaded for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | [lib/contracts/dispatch\_context.ts:1085](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1085) |
|  `turnRetrievables`                       | `readonly` | `Set`<[`Retrievable`](../../common/classes/Retrievable.md)>                                                                                                                                                                                                | Retrievable records loaded for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | [lib/contracts/dispatch\_context.ts:1083](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1083) |
|  `turnThoughts`                               | `readonly` | `Set`<[`Thought`](../../common/classes/Thought.md)>                                                                                                                                                                                                        | Thoughts loaded for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | [lib/contracts/dispatch\_context.ts:1087](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1087) |
|  `turnToolCalls`                             | `readonly` | `Set`<[`ToolCall`](../../forge/classes/ToolCall.md)>                                                                                                                                                                                                       | Tool calls loaded for this execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [lib/contracts/dispatch\_context.ts:1089](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1089) |
|  `waitFor`                                         | `readonly` | [`OpenGateFn`](../../turn_runner/type-aliases/OpenGateFn.md)                                                                                                                                                                                                 | Opens a gate and suspends until it resolves, rejects, times out, or is aborted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | [lib/contracts/dispatch\_context.ts:1183](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1183) |

## Methods

### \_getHooks()

```ts
_getHooks(): Hooks<DispatchContextHooks>;
```

Defined in: [lib/contracts/dispatch\_context.ts:938](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L938)

**`Internal`**

Accessor used by [@nhtio/adk!DispatchRunner](../../dispatch_runner/classes/DispatchRunner.md) to register forwarding handlers.

#### Returns

`Hooks`<[`DispatchContextHooks`](../type-aliases/DispatchContextHooks.md)>

***

### \_setDispatchId()

```ts
_setDispatchId(id: string): void;
```

Defined in: [lib/contracts/dispatch\_context.ts:928](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L928)

**`Internal`**

Set by [@nhtio/adk!DispatchRunner](../../dispatch_runner/classes/DispatchRunner.md) after construction.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `id`      | `string` |

#### Returns

`void`

***

### \_setIteration()

```ts
_setIteration(n: number): void;
```

Defined in: [lib/contracts/dispatch\_context.ts:933](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L933)

**`Internal`**

Updated by [@nhtio/adk!DispatchRunner](../../dispatch_runner/classes/DispatchRunner.md) on each iteration.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `n`       | `number` |

#### Returns

`void`

***

### ack()

```ts
ack(): void;
```

Defined in: [lib/contracts/dispatch\_context.ts:969](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L969)

Signals successful completion of this execution.

#### Returns

`void`

#### Remarks

Sets the context's internal signal flag. The [@nhtio/adk!DispatchRunner](../../dispatch_runner/classes/DispatchRunner.md) reads the flag at the
end of each iteration to decide whether to loop or exit. Calling `ack()` does NOT abort the
current iteration — the current pipeline and flush complete first.

#### Throws

[@nhtio/adk!E\_LLM\_EXECUTION\_ALREADY\_SIGNALLED](../../exceptions/variables/E_LLM_EXECUTION_ALREADY_SIGNALLED.md) when the context has already been signalled
(whether via `ack()` or `nack()`).

***

### nack()

```ts
nack(error?: Error): void;
```

Defined in: [lib/contracts/dispatch\_context.ts:1027](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1027)

Signals failed completion of this execution, optionally with an error.

#### Parameters

| Parameter | Type    | Description                                                                 |
| --------- | ------- | --------------------------------------------------------------------------- |
| `error?`  | `Error` | Optional error describing the failure. If omitted, a generic Error is used. |

#### Returns

`void`

#### Remarks

Sets the context's internal signal flag and stores the error. The [@nhtio/adk!DispatchRunner](../../dispatch_runner/classes/DispatchRunner.md)
reads the flag at the end of each iteration and surfaces the error via the `dispatchEnd`
observability payload and as the rejection reason of `dispatch()`. Calling `nack()` does NOT
abort the current iteration — the current pipeline and flush complete first.

#### Throws

[@nhtio/adk!E\_LLM\_EXECUTION\_ALREADY\_SIGNALLED](../../exceptions/variables/E_LLM_EXECUTION_ALREADY_SIGNALLED.md) when the context has already been signalled.

***

### onAck()

```ts
onAck(handler: () => void): () => void;
```

Defined in: [lib/contracts/dispatch\_context.ts:1008](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L1008)

Registers a handler to run when this context completes successfully via [ack](#ack).

#### Parameters

| Parameter | Type         | Description                              |
| --------- | ------------ | ---------------------------------------- |
| `handler` | () => `void` | Callback invoked when `ack()` is called. |

#### Returns

An unsubscribe function that removes the handler.

() => `void`

#### Remarks

The handler does NOT fire on [nack](#nack) — failed executor runs should leave any
ack-tied subscriptions alone so the consumer can inspect what was registered when
debugging the failure. Returns an unsubscribe function; subscriptions are short-lived
and die with the context regardless.

The canonical consumer is `ToolRegistry.bindContext(ctx)`, which uses this hook to drop
ephemeral tools (notably forged artifact-query tools from `SpooledArtifact.forgeTools(ctx)`)
at ctx-completion. Consumers may also register custom handlers here for any per-executor
cleanup.

#### See

* [@nhtio/adk!ToolRegistry.bindContext](../../forge/classes/ToolRegistry.md#bindcontext)
* [@nhtio/adk!SpooledArtifact.forgeTools](../../spooled_artifact/classes/SpooledArtifact.md#forgetools)

***

### toolCallCount()

```ts
toolCallCount(checksum: string): number;
```

Defined in: [lib/contracts/dispatch\_context.ts:954](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/dispatch_context.ts#L954)

Returns how many times a tool call with the given checksum has been stored in this execution.

#### Parameters

| Parameter  | Type     | Description                               |
| ---------- | -------- | ----------------------------------------- |
| `checksum` | `string` | The `ToolCall.checksum` value to look up. |

#### Returns

`number`

#### Remarks

Checksums are computed over `tool + args` (see [@nhtio/adk!ToolCall.checksum](../../forge/classes/ToolCall.md#property-checksum)). This count lets
the executor detect repeat invocations of the same call without scanning the full Set.
Returns `0` when the checksum has not been seen.
