anthropic.internal.AnthStreamState

What a stream carried that `ai.stream.Event` cannot yet express: tool calls, extended thinking, cache-token counts and the raw stop reason. The decoder folds them here so nothing is silently dropped; wiring them to the consumer needs the stdlib extensions listed in the workstream report.

Reference version

Signature

class anthropic.internal.AnthStreamState

What a stream carried that ai.stream.Event cannot yet express: tool calls, extended thinking, cache-token counts and the raw stop reason. The decoder folds them here so nothing is silently dropped; wiring them to the consumer needs the stdlib extensions listed in the workstream report.

Source:<builtin>/anthropic/ns_internal/messages.bamlbytes 3748739076

Fields

thinking

string

signature

string

cache_read_input_tokens

int | null

cache_creation_input_tokens

int | null

reasoning_tokens

int | null

stop_reason_raw

string | null

model

string | null

Static methods

function

new

() -> anthropic.internal.AnthStreamState

Instance methods

function

tool_uses

(self) -> ai.content.ToolUse[]

The assembled tool calls as canonical content blocks. An argument fragment stream that never completed decodes as an empty argument map rather than throwing.