LangChain.js migration guide
Migrate LangChain.js from 0.2 to 0.3 or from 0.3 to 1.0. Find the langchain and @langchain/core imports that break in your code and review supported fixes.
What tools identify LangChain.js breaking changes?
Emendant identifies supported LangChain.js changes in TypeScript and JavaScript repositories. It covers langchain 0.2 to 0.3 and 0.3 to 1.0, @langchain/core 1.0, and selected later 1.x releases listed below. Run npx emendant scan, then review the affected imports or calls and their release sources. Read the scan guide for the result and coverage warnings, and compare it with the upstream migration notes. Coverage does not extend to every LangChain package.
Example: move a legacy chain import in langchain 1.0
Emendant's langchain 1.0.1 entry detects the old chain module path and can offer this deterministic import rewrite:
Before the upgrade:
import { LLMChain } from "langchain/chains";Possible fix with @langchain/classic installed:
import { LLMChain } from "@langchain/classic/chains";The LangChain v1 migration source confirms that legacy chains move to @langchain/classic. Review the 1.0 coverage and remaining changes. Add the destination package yourself and check its peer dependencies. This preserves a legacy chain; it does not convert it to createAgent. Inspect the possible patch with npx emendant fix --dry-run, then run your typecheck and tests against the new dependencies. A patch preview checks structure but does not install dependencies or run your typecheck and tests.
Choose your LangChain.js migration path
LangChain.js is published as langchain and @langchain/core, and a major upgrade moves both. Start with the release you are moving to. Each guide names the changes Emendant covers, shows code before and after, and states what still needs your review.
- Migrate langchain 0.2 to 0.3: 39 document loader and tool subpaths move to
@langchain/communityunder the same names, andlangchain/memory/indexbecomeslangchain/memory. Read it with the LangChain v0.3 migration notes. - Migrate langchain 0.3 to 1.0: chains, legacy agents, retrievers, memory and document loaders move to
@langchain/classic, andRemoteRunnableis removed. Also read the@langchain/core1.0 guide:predictandpredictMessagesare removed from chat models, with four legacy subpaths and 24 named exports. Read both with the LangChain v1 migration guide. - Later 1.x releases of both packages: each page covers a change to agent, middleware, model or stream types, such as
streamEventsv3 for agents in langchain 1.4.0. Read the page for each release between your current version and your target. Thelangchainpages are listed below, and the@langchain/corerelease pages list the rest.
Check your repository before you upgrade
- Check the installed
langchainand@langchain/coreversions in your manifest and lockfile. Read each guide between those versions and your target. - Run
npx emendant scanin your TypeScript or JavaScript repository. It reports supported changes at affected call sites without editing your files. - Review the findings, then run
npx emendant fix --dry-runto inspect eligible patches. Emendant does not update package versions or install packages for you. The 0.3 and 1.0 patches rewrite imports to@langchain/communityor@langchain/classic, so add that package before you apply them. - After you update dependencies, run your own typecheck and tests.
What Emendant fixes, and the gaps
- Transforms patch the import moves in langchain 0.3 and 1.0. The
@langchain/core1.0 changes and the type changes in later 1.x releases are patched only when you name a model provider. - Some removals have no replacement, so Emendant reports them and does not patch them: the self-query translators and the NotionDB loader in 0.3,
RemoteRunnablein 1.0, and four legacy@langchain/coresubpaths. - Emendant does not move legacy chains or agents to the 1.0 agent API. It moves their imports to
@langchain/classic, which publishes the same modules. - The feed covers
langchainand@langchain/coreonly. A scan does not report changes in@langchain/community,@langchain/classic,@langchain/langgraphor provider packages such as@langchain/openai.
Emendant reports only changes in its curated feed. A clean scan does not prove that every LangChain.js migration step is complete. Read the supported projects guide for the current scope, the fix guide for patch grades, and whether AI-generated migration patches are safe.
Reviewing a dependency update PR? Follow Use Emendant alongside Dependabot to scan affected code, review possible patches, and check the remaining migration work.
LangChain.js release pages
- langchain 1.x breaking changes: 1.0.3 to 1.5.17
18 releases, 1.0.3 to 1.5.17, released 6 November 2025 to 15 October 2026. 55 breaking, 6 deprecations. - langchain 1.0.1: legacy imports move to classic
langchain 1.0.1, released 18 October 2025. 2 breaking, 0 deprecations. - langchain 0.3.0: community import migration
langchain 0.3.0, released 13 September 2024. 3 breaking, 0 deprecations.
Releases without a page here may still be in the feed. Run emendant feed status to see what your snapshot holds.