Models#

Implement the model contract and normalize usage and stream output.

Read the walkthrough before consulting individual signatures.

Public interfaces#

Interface

Purpose

AgentModel

Protocol implemented by every provider or custom model adapter.

ModelEvent

One provider-neutral event emitted by an AgentModel.

ModelEventType

Streaming events emitted by a model adapter.

ModelRequest

Complete provider-neutral input for one model step.

ModelResponse

Final normalized response for one model step.

ModelUsage

Normalized token and cache measurements reported by a provider adapter.

NativeDeferredToolsModel

An AgentModel that says whether its endpoint can load a deferred tool by reference.

ReasoningEffort

Provider-neutral levels for controlling model reasoning effort.

RetryOptions

Model-owned exponential backoff, without jitter.

ServerToolCall

Provider-executed tool invocation exposed for observation only.

ServerToolDefinition

Opaque provider-hosted tool configuration for one model request.

ServerToolInputDelta

One streamed input fragment for a provider-executed tool invocation.

ServerToolResult

Terminal output from a tool executed inside the provider.

TimeoutOptions

How long a provider may stay silent before the request is given up on.

ToolCallDelta

One streamed fragment of a model-requested tool call.

ToolDefinition

Provider-neutral tool metadata supplied with a model request.