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.
Signature
class anthropic.internal.AnthStreamStateWhat 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 37487–39076
Fields
thinking
stringsignature
stringtool_calls
cache_read_input_tokens
int | nullcache_creation_input_tokens
int | nullreasoning_tokens
int | nullstop_reason_raw
string | nullmodel
string | nullStatic methods
new
() -> anthropic.internal.AnthStreamStateInstance methods
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.