Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/langchain-upgrade-migration

@0d57af8
Run it yourself

Migrate a LangChain 0.3.x Python codebase to LangChain 1.0 / LangGraph 1.0 without breaking production — named breaking changes, codemod patterns, and a phased rollout. Use when upgrading LangChain or LangGraph from 0.2 or 0.3 to 1.0, when hitting ImportError after an upgrade, or when preparing a migration PR. Trigger with "langchain 1.0 migration", "langchain upgrade", "LLMChain removed", "initialize_agent removed", "ConversationBufferMemory removed", "astream_log deprecated", "langchain-anthropic 1.0".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/langchain-upgrade-migration

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesmigration-detection.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Migration Detection — grep-based Pre-flight

Run these commands from the repo root before starting the upgrade. Each command pairs to a pain code and a codemod pattern. Collect the hits into a file — it is the migration work list.

The Eight Checks

# P38 — Provider import paths (chat models, llms, embeddings, vectorstores)
grep -rn "from langchain\.chat_models" --include="*.py" .
grep -rn "from langchain\.llms" --include="*.py" .
grep -rn "from langchain\.embeddings" --include="*.py" .
grep -rn "from langchain\.vectorstores" --include="*.py" .

# P39 — LLMChain and siblings
grep -rn "from langchain\.chains\b" --include="*.py" .
grep -rn "\bLLMChain\b" --include="*.py" .
grep -rn "\bConversationChain\b" --include="*.py" .
grep -rn "\bSequentialChain\b" --include="*.py" .
grep -rn "\bRetrievalQA\b" --include="*.py" .

# P40 — Memory classes
grep -rn "from langchain\.memory" --include="*.py" .
grep -rn "ConversationBufferMemory\|ConversationBufferWindowMemory\|ConversationSummaryMemory" --include="*.py" .

# P41 — Legacy agent constructors
grep -rn "initialize_agent\|AgentType\." --include="*.py" .

# P42 — AgentAction field access
grep -rn "\.tool_input\b\|AgentAction\." --include="*.py" .
grep -rn "intermediate_steps" --include="*.py" .

# P66 — Peer-pin drift between langchain-anthropic and anthropic
grep -rn "langchain-anthropic" requirements*.txt pyproject.toml 2>/dev/null
grep -rn "^anthropic" requirements*.txt pyproject.toml 2>/dev/null

# P67 — Soft-deprecated streaming API
grep -rn "astream_log\b" --include="*.py" .

Bundled one-shot script (one-liner, not a committed script)

For a single run of all of the above piped into a work-list:

{ \
  grep -rn "from langchain\.chat_models\|from langchain\.llms\|from langchain\.embeddings\|from langchain\.vectorstores" --include="*.py" . ; \
  grep -rn "from langchain\.chains\b\|LLMChain\|ConversationChain\|SequentialChain\|RetrievalQA" --include="*.py" . ; \
  grep -rn "from langchain\.memory\|ConversationBufferMemory\|ConversationBufferWindowMemory\|ConversationSummaryMemory" --include="*.py" . ; \
  grep -rn "initialize_agent\|AgentType\." --include="*.py" . ; \
  grep -rn "\.tool_input\b\|intermediate_steps" --include="*.py" . ; \
  grep -rn "astream_log\b" --include="*.py" . ; \
} > langchain-0.3-hits.txt
wc -l langchain-0.3-hits.txt

The line count is a rough lower bound on the number of call sites to touch. Typical outcomes:

Line count Interpretation
0 Already on 1.0 patterns. Only the version bump and peer-pin (P66) remain.
1–20 Small codebase or isolated usage. One afternoon of codemod work.
21–100 Typical mid-sized service. Plan a two-day migration with staged commits per module.
100+ Multiple teams own parts of the code. Do Phase 2 of the playbook per team, not per file.

Reading the Output

Each hit is path:line_no:matched_line. Group by path, then by pain code, then assign each file to the codemod pattern in codemod-patterns.md:

Matched on Pain Apply pattern
from langchain.chat_models etc. P38 Pattern 1
LLMChain, RetrievalQA, SequentialChain P39 Pattern 2
initialize_agent, AgentType. P41 Pattern 3
ConversationBufferMemory etc. P40 Pattern 4
astream_log P67 Pattern 5
.tool_input, intermediate_steps P42 Pattern 6
langchain-anthropic in requirements without anthropic >= 0.40 P66 Pattern 7

Re-running After the Codemod

Run the same block after Phase 2 of the playbook. Every check should return zero hits except intentional test fixtures that pin 0.3 for comparison. Any non-test hit is unfinished migration work.

False Positives to Expect

  • Third-party code vendored into .venv/ or node_modules/ — exclude with --exclude-dir. On most setups, grep already skips these by default if they are gitignored.
  • Documentation strings that reference the old API for context. Flag these for the prose update but do not treat them as code migrations.
  • Tests that intentionally assert 0.3 backwards-compat shims (rare). Annotate with # noqa: langchain-migration and exclude from the recount.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides a legitimate and well-structured migration path for upgrading LangChain Python codebases from version 0.3.x to 1.0. It facilitates code auditing via grep, identifies breaking changes, and provides migration snippets without any malicious behavior.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago
What it can do
Reads files Edits files Runs commands
version
2.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 5 allowed tools
ReadWriteEditGrepBash(python:*)
Other metadata
tags
[
  "saas",
  "langchain",
  "langgraph",
  "python",
  "langchain-1.0",
  "migration",
  "upgrade"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/langchain-upgrade-migration