langchain
1.6.7 · 18 Nov 2026MIT4.2M / weekRepositoryHomepagenpmAtom feed
404 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
1.6.7
18 Nov 2026Mark tool messages that
humanInTheLoopMiddlewarecreates forrejectandresponddecisions withlc_source: "hitl_interrupt_decision"andlc_data: { decision }, and letaddNotificationMetadataaccept tool messageslangchain: Make
ConfigurableModelnon-configurable whenconfigurableFieldsis omittedinitChatModelwith a model and noconfigurableFields(and directnew ConfigurableModel(...)without it) no longer letsconfigurable.model/configurable.modelProviderswap the model at invoke time, matching the docs. PassconfigurableFields: ["model", "modelProvider"]to keep runtime model swapping.
1.6.6
13 Nov 2026Prevent a failed tool call or subagent from crashing the process when its
outputpromise is never consumedApply a
Commandreturned fromwrapModelCallonce when outer middleware passes it through
1.6.5
11 Nov 2026- Breaking
Require 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/v3entry point. langchain: Add model router and auto mode middleware
1.6.4
10 Nov 2026langchain: Add
modelRefusalMiddlewaremodelRefusalMiddleware()throwsModelRefusalErrorwhen the model refuses, instead of ending the run as if it succeeded. Middleware now passesModelRefusalErrorthrough unwrapped instead of as aMiddlewareError.
1.6.3
7 Nov 2026modelRetryMiddlewarenow retries errors that are subclasses of a class listed inretryOn. Previously the array form matched only the exact constructor, soretryOn: [APIError]never retried aRateLimitError. This matchestoolRetryMiddleware.langchain: Preserve model errors propagated through middleware
1.6.2
5 Nov 2026Add
tracePolicytocreateMiddleware, applied to the middleware's lifecycle hook runs. It only changes whatLangChainTracersends to LangSmith (useomitPayloadfrom@langchain/core/tracers/tracer_langchain). Requires@langchain/langgraph>= 1.6.1.
1.6.1
3 Nov 2026langchain: humanInTheLoopMiddleware — execute approved, edited and auto-approved tool calls when other calls in the same interrupt are rejected, instead of dropping them without a ToolMessage (caused "400 No tool output found for function call" on subsequent model requests)
1.6.0
28 Oct 2026Add a beta
OpenAIDecisionsrunnable with typed predicate, choice and score questions, plus model-routing and tool-risk agent middleware.
1.5.20
27 Oct 2026langchain: re-throw a drained tool from the agent's
ToolNodeA tool that throws
GraphDrained, for example one whose inner graph run is drained withRunControl.requestDrain(), now stops the agent run with that error, as an interrupt already did, instead of coming back as an errorToolMessagethat lets the agent go on as if the tool had failed.
1.5.19
22 Oct 2026Avoid copying full agent state into every parallel tool task. Restore tool and middleware state from graph channels for compact tasks while continuing to support full-state tasks saved in older checkpoints.
Align the default todo-list system prompt and tool description with Python, including guidance to deliver the substantive final answer after the last
write_todosresult.
1.5.18
16 Oct 2026agents: Add opt-in
interruptMode: "per_call"tohumanInTheLoopMiddleware. Each gated tool call raises its own interrupt (type: "tool_approval", with a typedresponseSchemabuilt from the tool's allowed decisions), answered by interrupt ID.respondis supported. Edits are pinned to the called tool and checked against the input side of its Zod v4 schema, so its transforms run once, when the tool does. An invalid answer throws without being saved. Also addsInterrupt.response_schema. In both modes,interruptOn: { tool: true }now allows every decision,respondincluded, as in Python; batched mode is otherwise unchanged.
1.5.17
15 Oct 20261.5.16
8 Oct 2026langchain:
createAgentwith middleware now passes aCommandbuilt by a different copy of@langchain/langgraphto the graph as-is, instead of merging it into the input state as a plain object.
1.5.15
1 Oct 2026Preserve LangGraph interrupts in
toolRetryMiddlewareinstead of retrying them or converting them into tool errors. Interrupted tool calls can pause and resume through their checkpointer without being treated as failures.
1.5.14
27 Sep 2026createAgentno longer ends the run when areturnDirecttool fails. A tool error, including arguments that fail the tool's schema, now goes back to the model so it can correct the call and retry; the run still ends on the first successfulreturnDirectresult. ErrorToolMessages produced by the tool node now carrystatus: "error", and aToolMessagereturned from a customhandleToolErrorsfunction defaults to that status when it sets none.
1.5.12
22 Sep 2026Preserve ReactAgent callbacks when its compiled graph is extracted, without duplicate calls through the agent.
1.5.11
9 Sep 2026agents: Ignore thought/reasoning text blocks when parsing structured output in
ProviderStrategy
1.5.10
20 Aug 2026Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
1.5.9
14 Aug 2026langchain: Use unified endpoint for gateway
core: Mark errors as retryable or not, and stop retrying the ones that aren't
Retry middleware retried every failure up to
maxRetries, including deterministic ones like a bad API key or an unknown model. Retries also nest, so a single such failure could cost dozens of API calls.@langchain/core/errorsaddsstampRetryable(error, retryable)andgetRetryable(error). Marking an error leaves its class and shape untouched, so a provider SDK error can be classified without breakinginstanceof.getRetryablereturnsundefinedfor errors nobody classified, and both are exported so tool authors can mark their own failures.modelRetryMiddlewareandtoolRetryMiddlewarenow respect the mark by default, and retries stop as soon as one is found rather than each layer spending its own budget. Aborted calls, context overflow, and oversized payloads are marked non-retryable out of the box.
Models accept a per-callmaxRetriesso a surrounding retry loop can take over.Behavior change: errors marked non-retryable now fail on the first attempt. Unclassified errors — including any from third-party integrations or custom tools — retry exactly as before. Pass
retryOn: () => trueto restore the old default. A customonFailedAttemptreplaces the built-in handler and opts out of marking.
1.5.8
13 Aug 2026core,langchain: Patch and release core, update peer dependencies
1.5.6
12 Aug 2026langchain: Exclude middleware-internal model calls from the message projection
Bookkeeping model calls made by
summarizationMiddlewareandtoolEmulatorMiddlewareno longer appear inrun.messagesorstream({ streamMode: "messages" }), and the summarysummarizationMiddlewarewrites back to state is no longer projected as a new message. These calls remain observable viastreamEvents({ version: "v2" }), identified bylc_source.Apply [Symbol.hasInstance] method to all comparable properties using .isInstance()
We have some internal schemas that rely on
z.instanceof(). This uses a strictinstanceofcheck which can conflict if there are multiple versions of core installed. This overrides the Symbol.hasInstance method to use the same logic as.isInstance()to compare objects at runtime.
1.5.5
5 Aug 2026langchain: Resolve LocalFileStore keys with path.relative
1.5.4
24 Jul 2026langchain: Add middleware for handling tool execution errors
1.5.3
8 Jul 2026langchain: Malformed tool input schemas are unrecoverable
1.5.2
23 Jun 2026langchain, openai: Decouple strict tools from strict structured output response
1.5.1
22 Jun 2026langchain: Keep tool call streams pending across any tool interrupt
A raw
interrupt()raised from inside a tool surfaced as atool-errorand
rejected the call's un-awaitedoutputpromise, producing an unhandled
rejection that crashed HITL runs. The tool-call stream transformer now treats
any serialized graph interrupt as control flow (the call stays pending and
resumes), not justhumanInTheLoopMiddlewareinterrupts.
1.5.0
18 Jun 2026langchain: Surface tool-dispatched subagents on
run.subagentsAdd a native subagent stream transformer to
createAgentso v3 runs expose
named nested agents (createAgent({ name })invoked from tools) as typedSubagentRunStreamhandles withname,cause, scopedmessages/toolCalls, andoutput. Refactors agent stream transformers intoagents/transformers/and exports only the public stream types from the
package entry.
1.4.6
17 Jun 2026langchain: Add
whenpredicate to human-in-the-loop middlewareAdd an optional
whencallback onInterruptOnConfigso callers can
dynamically skip interrupts for specific tool calls. The predicate receives
aToolCallRequest(batchafterModelcontext) and returns whether to
interrupt or auto-approve, matching PythonHumanInTheLoopMiddleware.aws: Bedrock prompt caching middleware
Adds bedrockPromptCachingMiddleware. The interface largely matches what was previous implemented with anthropicPromptCachingMiddleware, making a best-effort attempt at utilizing prompt caching features for supported models.
1.4.2
21 May 2026langchain: Unwrap tool message outputs in agent streams
langchain: Set name on todoListMiddleware ToolMessages
1.4.1
18 May 2026langchain/createAgent: Throw on terminal
providerStrategyparse failure instead of silently resolving withstructuredResponse: undefinedWhen
createAgentwas configured withresponseFormatresolving to aproviderStrategy(either passed explicitly or auto-promoted from a bare Zod / JSON schema for models whose profile reportsstructuredOutput: true), and the model produced a terminal response (notool_calls) whose text could not be JSON-parsed or did not satisfy the schema, the agent silently exited with nostructuredResponse, surfacing later asTypeError: Cannot read properties of undefined. The agent now throws aStructuredOutputParsingErrorin that case while still allowing the agent loop to continue when tool calls are present. Closes #10878.langchain: Prevent llmToolSelectorMiddleware from leaking into message stream
Patch Changes
langchain/createAgent: Throw on terminal
providerStrategyparse failure instead of silently resolving withstructuredResponse: undefinedWhen
createAgentwas configured withresponseFormatresolving to aproviderStrategy(either passed explicitly or auto-promoted from a bare Zod / JSON schema for models whose profile reportsstructuredOutput: true), and the model produced a terminal response (notool_calls) whose text could not be JSON-parsed or did not satisfy the schema, the agent silently exited with nostructuredResponse, surfacing later asTypeError: Cannot read properties of undefined. The agent now throws aStructuredOutputParsingErrorin that case while still allowing the agent loop to continue when tool calls are present. Closes #10878.langchain: Prevent llmToolSelectorMiddleware from leaking into message stream
1.3.4
22 Apr 2026langchain: Adds ls_agent_type to create agent runs as tracing metadata
Patch Changes
langchain: Adds ls_agent_type to create agent runs as tracing metadata
1.3.3
15 Apr 2026Prevent local file corruption when using
LocalFileStore
Patch Changes
Prevent local file corruption when using
LocalFileStore
1.3.2
13 Apr 2026agents: Derive middleware hook state from invocation state
Prevents middleware state from leaking across threads by deriving middleware hook input state from the current invocation state instead of cross-node cached state.
1.3.1
7 Apr 20261.3.0
3 Apr 2026langchain: Support for browser tools
Add @langchain/perplexity standalone provider package
fireworks: Extract standalone provider package
Minor Changes
langchain: Support for browser tools
Patch Changes
Add @langchain/perplexity standalone provider package
fireworks: Extract standalone provider package
together-ai: Migrate Together AI into provider package
langchain: Add ChatGoogle support to initChatModel
1.2.39
31 Mar 2026langchain: Allow dynamic tools in wrapModelCall with wrapToolCall
langchain: Add support for dynamic structured output
langchain: Bump langgraph dep
Patch Changes
langchain: Allow dynamic tools in wrapModelCall with wrapToolCall
langchain: Add support for dynamic structured output
langchain: Bump langgraph dep
langchain: Accept cross-version runnable models in createAgent
1.2.38
30 Mar 2026langchain: Export createAgent and prebuilt middleware from browser entry point
langchain: Revert zod import in utils.ts to fix v3/v4 interop
Patch Changes
langchain: Export createAgent and prebuilt middleware from browser entry point
langchain: Revert zod import in utils.ts to fix v3/v4 interop
1.2.37
24 Mar 2026langchain: Add "aws" alias to MODEL_PROVIDER_CONFIG so hub/node auto-detects ChatBedrockConverse from Python-serialized prompts
Align Zod Importation For 'libs/langchain/src/agents/nodes/utils.ts'
Patch Changes
langchain: Add "aws" alias to MODEL_PROVIDER_CONFIG so hub/node auto-detects ChatBedrockConverse from Python-serialized prompts
Align Zod Importation For 'libs/langchain/src/agents/nodes/utils.ts'
1.2.36
22 Mar 2026Support structured output (providerStrategy) for Google Gemini models in createAgent
Add LangSmith integration metadata to createAgent and initChatModel
Patch Changes
Support structured output (providerStrategy) for Google Gemini models in createAgent
Add LangSmith integration metadata to createAgent and initChatModel
1.2.35
18 Mar 2026Renamed getSubgraphAsync -> getSubgraphsAsync
Patch Changes
Renamed getSubgraphAsync -> getSubgraphsAsync
1.2.34
17 Mar 2026langchain: Respect version:"v1" in afterModel router's pending tool call path
agents: Propagate store and configurable to ToolNode middleware runtime
langchain/agents: Dispatch tool calls via Send in afterModel router for version:"v2"
Breaking change for
version: "v2"+afterModelmiddleware users.Previously, when
afterModelmiddleware was present,createAgentalways routed all tool calls from anAIMessageto a singleToolNodeinvocation — regardless of theversionoption. This meantversion: "v2"silently behaved likeversion: "v1"(parallel viaPromise.allin one node) wheneverafterModelmiddleware was used.#createAfterModelRouternow correctly respects#toolBehaviorVersion:Migration: If you use
version: "v2"(the default) together withafterModelmiddleware and rely on the previous single-node parallel execution, switch toversion: "v1"to preserve that behaviour. See theversionJSDoc onCreateAgentParamsfor guidance on which option to choose.
1.2.33
17 Mar 2026langchain/agents: Fix ReactAgent routing with returnDirect + beforeModel middleware
This fixes a routing error when an agent has both tools with returnDirect: true and middleware with beforeModel hooks (e.g., summarizationMiddleware). Before this fix, non-returnDirect tools would fail with "Branch condition returned unknown or null destination".
Patch Changes
langchain/agents: Fix ReactAgent routing with returnDirect + beforeModel middleware
This fixes a routing error when an agent has both tools with returnDirect: true and middleware with beforeModel hooks (e.g., summarizationMiddleware). Before this fix, non-returnDirect tools would fail with "Branch condition returned unknown or null destination".
1.2.32
12 Mar 2026langchain: Add browser export
1.2.31
11 Mar 2026langchain: Export todo schema
Implement type inference for tool streams
langchain: Serializable schemas aren't exposed on create agent response format
Patch Changes
langchain: Export todo schema
Implement type inference for tool streams
langchain: Serializable schemas aren't exposed on create agent response format
1.2.30
5 Mar 2026Move fakeModel from utils/testing to testing namespace
move to updated namespaceAdd custom Vitest matchers for LangChain message and tool call assertions
Adds a new
@langchain/core/testing/matchersexport containing custom Vitest matchers (toBeHumanMessage,toBeAIMessage,toBeSystemMessage,toBeToolMessage,toHaveToolCalls,toHaveToolCallCount,toContainToolCall,toHaveToolMessages,toHaveBeenInterrupted,toHaveStructuredResponse) that external users can register viaexpect.extend(langchainMatchers)in their Vitest setup files. Re-exported fromlangchainfor convenience.
Patch Changes
Move fakeModel from utils/testing to testing namespace
move to updated namespaceAdd custom Vitest matchers for LangChain message and tool call assertions
Adds a new
@langchain/core/testing/matchersexport containing custom Vitest matchers (toBeHumanMessage,toBeAIMessage,toBeSystemMessage,toBeToolMessage,toHaveToolCalls,toHaveToolCallCount,toContainToolCall,toHaveToolMessages,toHaveBeenInterrupted,toHaveStructuredResponse) that external users can register viaexpect.extend(langchainMatchers)in their Vitest setup files. Re-exported fromlangchainfor convenience.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.