Release range: langchain==0.3.30
→ langchain==1.0.0-alpha.1
Compare: langchain==0.3.30...langchain==1.0.0-alpha.1
💥 Breaking changes
-
Require Node.js ≥ 20
Langchain packages now require Node 20+ (.nvmrc
is on Node 24 for development). Update your engines and CI accordingly. (GitHub)// package.json { "engines": { "node": ">=20" } }
-
Removed legacy subpath exports (cleaner surface area)
-
langchain/schema/prompt_template
→ uselangchain/prompts
. (GitHub, api.js.langchain.com)- import { PromptTemplate } from "langchain/schema/prompt_template"; + import { PromptTemplate } from "langchain/prompts";
-
langchain/schema/query_constructor
→ uselangchain/chains/query_constructor
. (GitHub, v03.api.js.langchain.com, Langchain)- import type { AttributeInfo } from "langchain/schema/query_constructor"; + import type { AttributeInfo } from "langchain/chains/query_constructor";
-
langchain/runnables/remote
export removed. If you used this entrypoint, migrate off this subpath (no 1:1 replacement export inlangchain
package). (GitHub) -
langchain/smith
export path removed fromlangchain
. Use the separatelangsmith
package and opt-in (see below). (GitHub)
-
-
Callbacks removed from
langchain
The./callbacks
entrypoint is gone. Prefer LCEL observability (runnables), agent/tool messages, or provider-native hooks instead. (GitHub)- import { ... } from "langchain/callbacks"; // Replace with runnable config / tracing via LangSmith (optional) or agent nodes.
✨ Features
-
langchain
now exports most important user primitives
Thelangchain
package now exports the most important user primitives, includingtool
,HumanMessage
,AIMessage
,SystemMessage
,ToolNode
,createAgent
, and more.import { tool, HumanMessage, createAgent } from "langchain";
-
createAgent
is now part of corelangchain
The React-style agent lives under thelangchain
project (with examples + tests). Import directly fromlangchain
. (GitHub)import { createAgent, HumanMessage, tool } from "langchain"; import { z } from "zod"; const getWeather = tool({ name: "getWeather", description: "Get current weather by city", schema: z.object({ city: z.string() }), func: async ({ city }) => `Sunny in ${city}` }); const agent = await createAgent({ // New: pass a model by name (string) or a model instance model: "claude-3-5-sonnet-20240620", tools: [getWeather], responseFormat: z.object({ answer: z.string() }), }); const res = await agent.invoke(new HumanMessage("Weather in SF?")); console.log(res);
Now you can pass in a “model as string” option to define the model to use. (GitHub)
-
ToolNode
exported fromlangchain
Build agent graphs that execute tools as a node. This makes tool execution composable within LCEL/graph flows.import { ToolNode, tool, HumanMessage } from "langchain"; const fail = tool({ name: "alwaysFails", description: "Demo failing tool", schema: {}, func: async () => { throw new Error("Boom"); } }); const node = new ToolNode([fail]); const out = await node.invoke({ messages: [new HumanMessage("Try it")] });
-
Default tool-error handling in agents
WhenhandleToolErrors
istrue
(default), tool exceptions are caught and converted into aToolMessage
so the agent can recover. Set it tofalse
to surface raw errors for strict workflows. (GitHub)import { ToolNode } from "langchain/agents"; // default: handleToolErrors: true → returns a ToolMessage with error text const forgiving = new ToolNode([/* tools */]); // strict: throw on tool error const strict = new ToolNode([/* tools */], { handleToolErrors: false });
🐛 Fixes
-
langsmith
made optional
LangSmith is no longer a hard dependency; the package is loaded dynamically only when you use features that need it. If you rely on eval/tracing/hub, add it explicitly:
pnpm add langsmith
(or yarn/npm). (GitHub) -
Removed
js-tiktoken
dependency
The package was dropped from deps; related types are sourced via the relevant provider packages (e.g.@langchain/openai
). If you had direct imports, adjust accordingly. (GitHub)
🧹 Chores / Internal
- New tsdown-based build system (faster, simpler internal builds). (GitHub)
- Repo migrated to
pnpm
(lockfile + scripts updated). (GitHub) - Rearranged packages and updated CI/workflows. (GitHub)
- Removed experimental and unused files/exports (
./indexes
,./document_transformers/openai_functions
, agents cleanup). User-visible API impact covered above via export removals; the rest is housekeeping to keep the surface tight. (GitHub) - Environment tests rewritten in TS and expanded to verify export maps across bundlers/runtimes. (GitHub)
🧭 Migration quick-guide
-
Node version
- Set
engines.node
to>=20
and update CI runners. (GitHub)
- Set
-
Imports / subpaths
schema/prompt_template
→langchain/prompts
(e.g.,PromptTemplate
). (GitHub, api.js.langchain.com)schema/query_constructor
→langchain/chains/query_constructor
(IR types, translators, etc.). (GitHub, v03.api.js.langchain.com, Langchain)- Remove
langchain/runnables/remote
usage; no longer exported. (GitHub) - Remove
langchain/smith
import; install and import fromlangsmith
if needed. (GitHub)
-
Agents
- Import prebuilt agents from
langchain
directly, e.g.import { createAgent } from "langchain"
. - You can pass
model
as a model name string tocreateAgent
. (GitHub)const agent = createAgent({ model: "openai:gpt-4o-mini", tools: [/* tools */], responseFormat: z.object({ answer: z.string() }), });
- Use
ToolNode
to encapsulate tool execution in graphs. - Decide on error policy: default soft-handling vs strict throws in
ToolNode
viahandleToolErrors
. (GitHub)
- Import prebuilt agents from
-
LangSmith & tokenization