Skip to content

StreamOptions

Defined in: src/models/model.ts:223

Options interface for configuring streaming model invocation.

cancelSignal?: AbortSignal;

Defined in: src/models/model.ts:228

Optional cancellation signal that a provider implementation can forward to abort an in-flight request. Support is provider-dependent.


systemPrompt?: SystemPrompt;

Defined in: src/models/model.ts:234

System prompt to guide the model’s behavior. Can be a simple string or an array of content blocks for advanced caching.


toolSpecs?: ToolSpec[];

Defined in: src/models/model.ts:239

Array of tool specifications that the model can use.


toolChoice?: ToolChoice;

Defined in: src/models/model.ts:244

Controls how the model selects tools to use.


modelState?: StateStore;

Defined in: src/models/model.ts:252

Runtime state for model providers that manage server-side conversation state. The model can read and write this state during streaming (e.g., to store a response ID for conversation chaining). Mutations via set/delete are visible to the caller after the stream completes.


dynamicTrailingBlocks?: number;

Defined in: src/models/model.ts:255

How many trailing blocks of the last user message are rebuilt on every call.


agentMetadata?: AgentMetadata;

Defined in: src/models/model.ts:258

Metadata of the invoking agent, supplied per request.


structuredOutputSchema?: ZodSchema;

Defined in: src/models/model.ts:265

Schema this call must produce, set by the agent on its structured output retry so the provider can choose how to enforce it. The response must then be either a call to the tool named in toolChoice or a final text response whose text is exactly one JSON object that validates against this schema.