Skip to content
1 min read · 229 words

Class: DispatchRunner

Defined in: src/lib/dispatch_runner.ts:165

Runs a single dispatch iteration of an agentic turn: it drives the executor through the input/output middleware pipelines, emitting functional and observability hook events along the way. Construction is gated — obtain one via the static DispatchRunner.dispatch entry point rather than new.

Methods

dispatch()

ts
static dispatch(input: RawDispatchRunnerInput): Promise<void>;

Defined in: src/lib/dispatch_runner.ts:265

Dispatches a single LLM execution.

Parameters

ParameterTypeDescription
inputRawDispatchRunnerInputThe dispatch input. Provide either source (derived path) or raw (standalone).

Returns

Promise<void>

Remarks

Constructs an @nhtio/adk!DispatchContext (derived from source or from raw), runs the iteration loop, and resolves when middleware/executor signals completion via ctx.ack() or the abort signal fires. Rejects with the nack error when middleware/executor calls ctx.nack(err). Pipeline and executor errors are wrapped, surfaced on the observability error hook, and re-thrown.

Throws

@nhtio/adk!E_INVALID_LLM_DISPATCH_INPUT when the input does not satisfy validation, or when neither source nor raw is provided, or when both are provided.


isDispatchRunner()

ts
static isDispatchRunner(value: unknown): value is DispatchRunner;

Defined in: src/lib/dispatch_runner.ts:247

Returns true if value is a DispatchRunner instance.

Parameters

ParameterTypeDescription
valueunknownThe value to test.

Returns

value is DispatchRunner

true when value is a DispatchRunner instance.

Remarks

Uses @nhtio/adk!isInstanceOf for cross-realm safety.