npm / @langchain/core
@langchain/core
What changed in @langchain/core 0.1 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
11 breaking8 security1 deprecations61 new APIs and options2 performance18 behavior and defaults2 tooling75 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@langchain/core 1149 changes
Breaking changes 11
Types invoke answers from the questions asked, including Choice labels, and rejects unanswered questions or responses with the wrong type or label.
Requires Zod 4.6.6 or newer for installed dependencies to exclude versions affected by GHSA-mrhx-c7xc-m3w5; Zod v3 schemas remain supported through the bundled zod/v3 entry point.
JSON, tool-call, and structured output parsers throw ModelRefusalError from @langchain/core/errors when the model refuses, instead of a generic parsing error.
Tool-call args stream as delta slices instead of snapshots; raw-event consumers and stream transformers should read tool-call-delta. Tool-call id, name and index move to content-block-start, with late id or name on content-block-finish.
Retry middleware respects retryability marks by default and stops retrying non-retryable errors; unclassified errors keep retrying as before.
Passing retryOn: () => true restores the old retry behavior.
Arrays are treated as message content blocks only when every element is an object with a type; other arrays are JSON-stringified.
Reverts adding all chat model and LLM invocation parameters to metadata.
fakeModel has moved from utils/testing to the testing namespace.
Adds createNamespace and the Namespace API for hierarchical symbol-based branding, enabling reliable cross-realm identity for class hierarchies.
When aborted during streaming with streaming callback handlers, invoke throws ModelAbortError with accumulated partialOutput.
Security 8
Recursion depth guards for mustache parsing and dict prompt traversal prevent stack-exhaustion DoS from deeply nested attacker-controlled templates.
LangChain: MongoDBChatMessageHistory query injection can allow cross-session access
Adds utilities for validating URLs against private IPs, cloud metadata endpoints, and localhost.
Hardens URL loading against SSRF attacks by validating safe URLs and comparing origins.
LangChain serialization injection vulnerability enables secret extraction
Security hardening was added for load.
Various security fixes were made in community/core.
LangChain: RediSearch Filter Injection via Unescaped Tag/Text Values
Deprecations 1
Deprecated in favor of LangChainError subclasses.
New APIs and options 32
Adds a decisions entry point with BaseDecisionModel, question and answer types, and parsing utilities for providers.
Adds a classifier-response parsing utility for providers.
Adds a question-parsing utility for providers.
Exports omitPayload from @langchain/core/tracers/tracer_langchain; it is a TracePolicy processor that records an empty payload while keeping the run.
Adds tracePolicy to shape the inputs and outputs LangChainTracer sends to LangSmith for the sequence's own run.
Adds a way to mark messages the agent harness adds.
Adds a way to retrieve metadata marking messages the agent harness adds.
Adds a type for metadata marking messages the agent harness adds.
Adds a ModelProfile field indicating whether a chat model sends a system message after the first turn in place.
Adds a ModelProfile field indicating whether a chat model can add a tool through a message rather than the request's tool list.
Adds explicit agent address support, inherits project and address destinations together, and delegates default destination resolution to the LangSmith SDK.
Exposes a branded class type for provider declarations, making the type available to provider authors.
ModelProfile now includes fileMimeTypes so models can advertise accepted MIME types for generic file inputs; OpenAI Responses API models report the types supported by input_file, while Chat Completions profiles are unchanged.
Adds an exported function that reads an error's retryability mark and returns undefined when nobody classified it.
Models accept a per-call maxRetries value so a surrounding retry loop can take over.
Adds an exported function to mark an error as retryable or non-retryable without changing its class or shape.
OpenAI, Anthropic, and Fireworks chat models now support LangSmith Gateway environment configuration.
Adds conversion of stream events to an OpenAI-compatible format.
OpenRouter reasoning content is surfaced as standard reasoning content blocks alongside text and tool calls.
UUID utilities now export v6 generation support, including the upstream v1ToV6 helper.
Adds support for browser tools.
FakeBuiltModel is now exported for use with the fakeModel builder API.
Type inference is implemented for tool streams, allowing developers to infer types from streamed tool calls.
Adds standard schema support for structured output.
Runnable traces now include package version metadata in this.metadata.versions, making version information available in LangSmith trace metadata.
Tool calling supports asynchronous generators for streaming partial tool results.
Adds ContextOverflowError, raised for context overflow in Anthropic and OpenAI; includes a fromError() static factory method.
Adds a static factory method for creating a ContextOverflowError from an error.
Adds a base class that all LangChain errors extend.
Added an error class in @langchain/core/errors that contains partial output when a model invocation is aborted mid-stream.
FakeListChatModel now supports bindTools.
Adds extras to tools.
Performance 2
Tool call chunks are collapsed lazily on first read of
tool_callsorinvalid_tool_calls, avoiding repeated parsing during streamed delta concatenation.Caches Zod-to-JSON-Schema conversions in toJsonSchema(), avoiding repeated conversions.
Behavior and default changes 18
addNotificationMetadata now accepts tool messages.
Tool messages created for reject and respond decisions now include lc_source: "hitl_interrupt_decision" and lc_data: { decision }.
A standard refusal content block is added to message.contentBlocks for model refusals from OpenAI, Anthropic, and Gemini.
Long tool-call IDs are abbreviated when chat messages are formatted as strings, while the original messages remain unchanged.
The v0 default replay path reuses response_metadata.output directly, preserving every reasoning item's id and encrypted_content in original order under Zero Data Retention.
A custom handler replaces the built-in handler and opts out of automatic retryability marking.
Retry middleware respects retryability marks by default and stops retrying non-retryable errors; unclassified errors keep retrying as before.
Traced metadata now includes chat model and LLM invocation parameters.
Tracer-scoped inheritable metadata and tag options are separated from runnable metadata; ensureConfig metadata mirroring is limited to model.
Adds LangSmith integration metadata to createAgent.
Adds LangSmith integration metadata to initChatModel.
All invocation parameters are included as part of metadata.
OpenAI image generation outputs are represented as proper image content blocks.
Tool call content returns compacted JSON.
Adds literal name type inference to tool(), improving type inference for tool names.
Run IDs are now generated with UUIDv7 instead of UUIDv4.
Starting in version 1.1.4, the default recursion limit is 10,007 steps.
Parsing now allows more partial JSON, which can affect how developers handle incomplete JSON output.
Tooling 2
Exported Zod type references in the public API are replaced with minimal structural interfaces to prevent TypeScript OOMs and unresponsive language servers in monorepo setups.
Adds custom Vitest matchers for LangChain message and tool call assertions, registerable with expect.extend(langchainMatchers).
Fixes and other changes 75
Streamed input_json_delta blocks are merged into the preceding tool_use or server_tool_use block at the same index.
Prevents v2 from hanging or leaking an unhandled rejection when aborted, and from throwing its own AbortError when the consumer breaks early.
The tool run now ends when its signal is already aborted.
When processInputs or processOutputs throws, LangChainTracer still sends and ends the run, dropping that payload and setting the error instead of skipping the run or leaving it pending in LangSmith.
Batched sequence runs now each record their own output.
Merged runnable configs now keep each callback handler once and in order, preventing duplicate callback delivery.
drawMermaid escapes node metadata labels and omits object values so metadata with brackets or objects no longer breaks Mermaid parsing.
Graph.toJSON output now includes node metadata when set, matching Python.
ChatModelStream appends tool-call-delta slices to a tool call's args, while block-delta continues to replace them.
ChatModelStream ignores unrecognized delta types instead of throwing an error.
Runtime context is preserved in ambient runnable config across tool calls, nested runnables, and streaming.
Structured tool arguments are preserved in tracer run inputs.
OpenAI Responses API replay in v1 preserves every reasoning item's id and encrypted_content in original order under Zero Data Retention.
Streaming token usage is built from fully accumulated chunk metadata instead of being overwritten by the last chunk; this also populates llmOutput for @langchain/google invoke({streaming: true}).
BaseMessage.text now uses contentBlocks.
ChatVertexAI and ChatGoogle contentBlocks now include tool_call blocks from message.tool_calls and skip spurious empty text blocks.
The gateway now uses a unified endpoint.
Peer dependencies were updated for core and langchain, which may affect package compatibility.
Overrides Symbol.hasInstance to use the same logic as .isInstance() for comparable properties, avoiding conflicts when multiple versions of core are installed.
The mustache escape override is now passed per render call.
Nested tracer callbacks that share run bookkeeping are coalesced.
Binds splitText when trimMessages receives a TextSplitter instance.
Reasoning blocks are emitted in standard form with preserved signatures; incomplete signature-only reasoning is omitted during replay, while legacy and redacted reasoning remain compatible.
Coerces string content to text blocks when constructing an AIMessage with v1 output metadata, preventing contentBlocks.push errors.
Provider 429 errors are classified before retrying.
Preserves existing v1 contentBlocks when constructing AIMessage instances, preventing serialized messages from losing block content during deserialization.
CommonJS default re-exports are now callable.
Apply v1 message casting after implicit streaming aggregation.
Different content block types are kept separate when merging chunks.
Inheritance behavior for special keys in tracer metadata was updated.
createAgent now accepts cross-version runnable models.
Normalizes single-block content when merging content.
Surfaces Responses API message phase on text content blocks and supports round-tripping it through standard content paths.
Chained concat() calls no longer spread lc_kwargs into the new constructor, preventing nested duplication of system message content.
Streaming tool call deltas without an index now merge by id, preventing them from accumulating as separate entries in tool_call_chunks and additional_kwargs.tool_calls.
Preserves multimodal content as placeholders.
The timeout option is now respected in streamEvents v2.
Preserves thoughtSignature in array content when streaming with thinking models.
Empty string tool call chunk IDs are treated like null or undefined during merging, allowing old completions-style streaming chunks to merge by index.
An explicit symbol type annotation prevents TypeScript from inferring unique symbol, avoiding incompatibility when multiple package versions are present in a dependency tree.
Uses Symbol.for() and an explicit symbol type annotation for cross-realm compatibility and compatibility when multiple package versions are present.
Standard schema type guards now support callable schemas.
Added usage_metadata to AIMessage lc_aliases.
Content blocks are merged by string index during streaming.
Tool calls are now preserved when concatenating AIMessageChunks.
Supports reasoning/thinking blocks in parsed string output.
Fixes contentBlocks for file_search_call in the OpenAI Responses API.
Fixes contentBlocks for web_search_call in the OpenAI Responses API.
Empty text blocks are skipped in ChatOpenAI contentBlocks.
Avoids long-lived abort signals.
Provider implementations now check and propagate abort signals in both _generate() and _streamResponseChunks().
Updated invoke, stream, generate, and generatePrompt signatures across Runnable, BaseChatModel, and BaseLLM to accept partial call options without TypeScript errors.
When aborted, stream throws a regular AbortError because chunks have already been yielded to the caller.
Reads error.status when response.status is absent, avoiding retries for OpenAI SDK 4xx errors.
When tracingEnabled is false, inherited LangChainTracer handlers are stripped so child runs do not produce traces.
Fixes additional undefined and null errors.
Preserves index and timestamp fields when merging dictionaries.
JsonOutputParser now sources content from the text accessor.
Reasoning tokens are now properly elevated.
Serialization now allows shared object references.
Fixes an error when merging undefined values.
load now handles circular references.
Numeric values are now handled correctly by mergeDicts.
Message summarization now uses getBufferString.
Interop with Zod has been improved.
Ensures streaming test chat models respect AbortSignal.
Avoids writing to TransformStream when the underlying ReadableStream is closed.
Fixes an error when merging two undefined objects.
Graph Mermaid output handles subgraph nesting better.
The tracer handles missing parent runs to prevent LangSmith 400 errors.
MCP tool calls now preserve the timeout from RunnableConfig.
Nested objects in tool call arguments are now displayed properly instead of as [object Object].
Uses toBase64Url instead of btoa for encoding Mermaid images.
Fixes tool chunk concatenation behavior.
Uses a dynamic import for p-retry to support CommonJS environments.
@langchain/core 0.129 changes
New APIs and options 29
A POST endpoint creates custom workspace model prices, with matching and token-cost fields for pricing LLM runs ingested after the entry takes effect.
Adds an endpoint to retrieve a model price entry the workspace uses to compute run costs, including custom, organization, and LangSmith default entries.
Adds an API endpoint to create an organization model price entry that applies across every workspace in the organization.
Adds a DELETE endpoint to delete an organization model price, whether or not it exists.
Adds an endpoint to list model prices set for the organization, with page_size and cursor query parameters for pagination.
Adds an endpoint to retrieve one team in an organization, with organization- or workspace-scoped read permissions.
Adds an endpoint to list a team's access policies, with pagination and organization- or workspace-scoped read permissions.
Adds an endpoint to detach an access policy from a team. For organization-wide teams, workspace_id selects the workspace; omitting it detaches the policy from every workspace the team can access.
Adds a paginated endpoint for listing the workspace identities of a workspace-scoped team's members.
A POST endpoint grants an organization-wide team a role in a workspace, creating a workspace-scoped team and recording eligible members’ workspace identities.
Adds an endpoint to get one user group in the organization, with organization- or workspace-scoped read permissions.
Adds an endpoint to attach an existing organization access policy to a user group, optionally limiting an organization-wide group's policy to one workspace.
Adds an endpoint to list a user group's access policies, with pagination and scope-specific read permissions.
Adds an endpoint to list members of a user group, with organization- or workspace-scoped read permissions.
Accepts a cursor from the previous page to resume listing; an unissued cursor starts again at the first page.
Accepts a page_size query parameter for the number of members per page, defaulting to 20 and limited to 1–100.
Adds an endpoint to grant an organization-wide user group a role in a workspace.
Adds a GET endpoint that resolves an AGENT, EXPERIMENT, or EVALUATOR address to a tracing project session ID.
Adds a query parameter for pagination using an opaque cursor from a prior response's next_cursor.
Adds a query parameter to filter results by a name substring.
Adds a query parameter for the number of results per page, defaulting to 20.
Adds an endpoint to create a copy-on-write copy of an existing volume. The source volume cannot be attached read-write to a sandbox that is not stopped.
Adds the upsert query parameter to update an existing session with the same name.
The root health check accepts an optional query parameter to check database connectivity.
Removes an organization-wide user group's grant in a workspace, detaches its workspace access policies, and deletes its workspace-scoped user group there. Requires organization:user-groups:manage-grants.
Adds an endpoint to list organization user groups, with optional workspace, parent group, identity, page size, and cursor filters.
The query parameter requests run statistics when retrieving a tracing project or experiment; it defaults to false.
Adds an endpoint to replace an organization model price using the full entry; omitted optional fields reset to defaults, and recorded costs on existing runs are not recomputed.
Defines the response schema for a user group, including its identifiers, name, description, synchronization state, and timestamps.