InvokeModelContext
Defined in: src/middleware/stages.ts:74
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().
Properties
Section titled “Properties”readonly agent: LocalAgent;Defined in: src/middleware/stages.ts:76
The agent instance (escape hatch for advanced use cases).
messages
Section titled “messages”readonly messages: readonly Message[];Defined in: src/middleware/stages.ts:78
The messages to send to the model.
systemPrompt?
Section titled “systemPrompt?”readonly optional systemPrompt?: SystemPrompt;Defined in: src/middleware/stages.ts:80
System prompt to guide the model’s behavior.
toolSpecs
Section titled “toolSpecs”readonly toolSpecs: readonly ToolSpec[];Defined in: src/middleware/stages.ts:82
Tool specifications available to the model.
toolChoice?
Section titled “toolChoice?”readonly optional toolChoice?: ToolChoice;Defined in: src/middleware/stages.ts:84
Controls how the model selects tools.
invocationState
Section titled “invocationState”readonly invocationState: InvocationState;Defined in: src/middleware/stages.ts:86
Per-invocation state. Shared by reference — mutations are visible to hooks, tools, and AgentResult.