npm / @langchain/anthropic
@langchain/anthropic
What changed in @langchain/anthropic 0.3 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
3 breaking3 security1 deprecations22 new APIs and options10 behavior and defaults26 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@langchain/anthropic 163 changes
Breaking changes 3
Only text, tool_addition and tool_removal blocks are sent; other blocks are dropped, and a system message with no remaining content is omitted.
The default model changes from claude-3-5-sonnet-latest to claude-sonnet-4-5-20250929.
Usage metadata input_tokens now includes cache creation and cache read tokens.
Security 2
LangChain: MongoDBChatMessageHistory query injection can allow cross-session access
LangChain: RediSearch Filter Injection via Unescaped Tag/Text Values
Deprecations 1
The output format setting moves to outputConfig.format; outputFormat remains available for backwards compatibility but is deprecated.
New APIs and options 22
Adds support for Claude Fable 5.1.
Adds support for Claude Sonnet 5.
Adds LangSmith Gateway environment configuration to Anthropic chat models.
Adds support for the claude-opus-5 model.
Adds support for strict tool calling for custom tools.
Anthropic structured output now supports standard schemas.
Anthropic raises ContextOverflowError for context overflow errors.
Adds the Claude Opus 4.6 model with 16384 default max output tokens.
Adds beta compaction support, including auto-detection of compact_20260112 edits and streaming handlers for compaction content blocks.
Adds a parameter for data residency controls.
Adds effort levels low, medium, high, and max for controlling token usage.
Supports adaptive thinking, recommended for Opus 4.6.
Exports ChatAnthropicInput, an intersection of AnthropicInput and BaseChatModelParams, for type-safe configuration and IntelliSense.
Adds a named computer use tool for use with Anthropic.
Adds a named mcp toolset tool for use with Anthropic.
Adds a named text editor tool for use with Anthropic.
Adds a named webfetch tool for use with Anthropic.
Adds support for the Anthropic tool search tool.
Adds support for advanced tool use.
Adds opus-4.5 to the supported model strings.
Support for the betas parameter was added.
Native structured output is now supported.
Behavior and default changes 10
SystemMessage content can carry tool_addition and tool_removal blocks, which are forwarded verbatim; the required beta is added automatically based on how the tool is defined.
System content built from standard content blocks no longer sends the internal block id to the provider.
Rate limits are marked retryable; context overflow, invalid tool results, bad credentials, and unknown models are marked non-retryable. Other errors remain unmarked and retry as before.
Native streamEvents event coverage was updated, changing which events are covered.
Adds compatibility updates for Claude Opus 4.7, allowing developers to use the model with this package.
Adds a default max token value for Sonnet models.
Runnable traces now include package version metadata, making version information available in LangSmith trace metadata.
Structured outputs are GA and no longer require a beta header.
Anthropic models handle standard file content blocks.
Invocation parameters now set an empty tool array.
Fixes and other changes 25
SystemMessage can appear anywhere in the message list; it applies from its position onwards, and adding one preserves the prompt cache for earlier turns.
A leading run of two or more SystemMessages is merged into the top-level system field instead of being rejected.
Preserves the generic tool search result block type in streaming output and message payload conversion, preventing INVALID_TOOL_RESULTS in multi-turn conversations after a client-tool round-trip.
Message translation now round-trips this tool search result block, preventing multi-turn requests from failing when the block is dropped.
Message translation now round-trips this tool search result block, preventing multi-turn requests from failing when the block is dropped.
A per-call maxRetries is forwarded to the retry loop, allowing a surrounding retry loop such as modelRetryMiddleware to take over instead of multiplying retry counts.
convertAnthropicStream now surfaces an Anthropic-compatible gateway's numeric usage.cost in response_metadata.usage.cost; token accounting in usage_metadata is unchanged.
Filters tools with unsupported root schema composition.
Anthropic streams preserve cost metadata provided by the gateway.
Requests no longer include thinking: { type: "disabled" } unless the user explicitly configured it, preventing default instances from failing with adaptive-only models that reject this setting.
Tool choice required is now implemented for Anthropic.
Undefined values are no longer set on the request object.
Undefined values are no longer set on the request object, and validation works when thinking is enabled.
Undefined values are no longer set on the request object, and validation works when thinking is enabled.
Prevents cache tokens from being double-counted during streaming.
Only set topP when it is defined, avoiding an API error.
When content is an empty array and tool_calls are present, formatting now appends unrepresented calls as tool_use blocks instead of silently dropping them and causing Anthropic API requests to fail.
Model profiles were updated.
Corrected the default maximum output token values for all Claude models.
Chat model invocations and streams now properly handle abort signals; invoke() throws ModelAbortError with accumulated partial output when aborted during streaming, while stream() throws AbortError.
Consolidates input_json_delta blocks in streaming tool calls, improving how streamed tool-call inputs are handled.
Fixed converting partial tool inputs.
Reasoning tokens are now properly elevated.
Fixes the
.jsimport issue in chat_models.ts.Fixes passing betas to the client when streaming.
@langchain/anthropic 0.32 changes
Security 1
A fix addresses CVE-2025-12735.
Fixes and other changes 1
The default temperature option in v0/anthropic is fixed.