LangChain.js 1.6.5 adds decision models and router middleware, and now requires Zod 4.6.6 or newer (November 11, 2026)
langchain 1.6.5 and @langchain/core 1.4.0 add decision models and two new middleware, and both now require Zod 4.6.6 or newer.
What changed
On November 11, 2026 LangChain.js released langchain 1.6.5 and @langchain/core 1.4.0. This is the JavaScript side of the decision model work that LangChain 1.5 brought to Python on the same day.
@langchain/core 1.4.0 adds a new entry point, @langchain/core/decisions. It holds BaseDecisionModel, a Runnable that answers typed Noul, Choice, Score and Box questions about text, messages or JSON state. The answers from invoke are typed from the questions you ask, including Choice labels. A provider response that leaves a question unanswered, or answers it with the wrong type or label, is rejected.
langchain 1.6.5 adds two middleware built on decision models:
modelRouterMiddlewarepicks the agent's model for each run from a decision model'sChoiceanswer. It classifies the latest human message once per run and stores the answer in state asmodelRoute.autoModeMiddlewareblocks listed tool calls that a decision model judges risky. A call at or above 0.5 returns an errorToolMessagewithout running the tool. Tools you do not list are not classified.
LangChain's JavaScript changelog marks both middleware as beta.
Two things can break an existing project:
- Both packages now require Zod 4.6.6 or newer, to exclude versions affected by GHSA-mrhx-c7xc-m3w5. On npm,
langchain1.6.5 and@langchain/core1.4.0 listzodas^4.6.6. Zod v3 schemas remain supported through the bundledzod/v3entry point. langchain1.6.5 needs@langchain/core^1.4.0as a peer dependency.
@langchain/typesafe 0.1.0, released the same day, has breaking changes. TypeSafeClassifier now extends BaseDecisionModel, and questions move from the constructor to invoke: new TypeSafeClassifier().invoke({ state, questions }) replaces new TypeSafeClassifier({ questions }).invoke(state). Token usage moves from to , and every question now requires . The and in are deprecated and will be removed in 0.2.0.
