Skip to content

InvokeModelContext

Defined in: src/middleware/stages.ts:75

Context passed to model-stage middleware. All inputs to the model call are explicit — middleware can inspect and transform any of them by passing a modified context to next().

readonly agent: LocalAgent;

Defined in: src/middleware/stages.ts:77

The agent instance (escape hatch for advanced use cases).


readonly messages: readonly Message[];

Defined in: src/middleware/stages.ts:79

The messages to send to the model.


readonly optional systemPrompt?: SystemPrompt;

Defined in: src/middleware/stages.ts:81

System prompt to guide the model’s behavior.


readonly toolSpecs: readonly ToolSpec[];

Defined in: src/middleware/stages.ts:83

Tool specifications available to the model.


readonly optional toolChoice?: ToolChoice;

Defined in: src/middleware/stages.ts:85

Controls how the model selects tools.


readonly modelState: StateStore;

Defined in: src/middleware/stages.ts:87

Runtime state for stateful model providers.


readonly invocationState: InvocationState;

Defined in: src/middleware/stages.ts:89

Per-invocation state shared across hooks and tools.