migrating-langchain-to-pydantic-ai
Skill by pydantic
Guides an AI assistant through migrating Python LangChain, LangGraph, or Deep Agents applications to Pydantic AI. It suits teams porting agents, chains, graphs, or Deep Agents projects with behavior-preserving, test-first steps.
Install migrating-langchain-to-pydantic-ai
Built from the published package, never by AI.
git clone --depth 1 https://github.com/pydantic/pydantic-ai /tmp/pydantic-ai && mkdir -p ~/.claude/skills && cp -r /tmp/pydantic-ai/pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-langchain-to-pydantic-ai ~/.claude/skills/migrating-langchain-to-pydantic-aiRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install migrating-langchain-to-pydantic-ai in Claude Code
git clone --depth 1 https://github.com/pydantic/pydantic-ai /tmp/pydantic-ai && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/pydantic-ai/pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-langchain-to-pydantic-ai ~/.gemini/antigravity-cli/skills/migrating-langchain-to-pydantic-aiAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install migrating-langchain-to-pydantic-ai in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill walks an AI assistant through moving a Python LangChain, LangGraph, or Deep Agents application to Pydantic AI, and to Pydantic AI Harness when the source uses harness features. It starts by reading the running application, tracing one representative request, and adding characterization tests. It then migrates one vertical slice behind the existing public boundary.
The skill classifies each slice, such as a chain, a LangChain agent, a direct LangGraph workflow, or a Deep Agents harness, and chooses a matching target. It asks for decisions when a source behavior has no direct equivalent and marks each contract as preserved, changed, or unverified. It is aimed at developers who want a behavior-preserving migration rather than a one-to-one rewrite.
Written from the project's SKILL.md and checked against it.
What it can do
- Application tracingReads the running app, traces one representative request, and inventories the contracts callers use.
- Slice classificationClassifies chains, LangChain agents, LangGraph workflows, and Deep Agents harnesses before choosing a target.
- Concept mappingMaps LangChain and LangGraph concepts to Pydantic AI agents, pydantic_graph, or plain Python.
- Deep Agents mappingMaps bundled Deep Agents features to Harness capabilities, core primitives, or application services.
- Characterization testsAdds deterministic tests before migrating one vertical slice behind the public boundary.
- Semantic gap guidanceExplains differences in state, retries, approvals, and streaming before a design choice is made.
- Harness capabilitiesAdds pydantic-ai-harness capabilities one at a time, such as planning, skills, memory, and subagents.
- Observability guidanceExplains Logfire and how to keep an existing tracing system during the migration.
- Verification and cutoverSets a completion standard and gives guidance for a production cutover.
What you need
- A Python project that uses LangChain, LangGraph, or Deep Agents
- Pydantic AI, added during the migration
Try asking
- Migrate my LangChain agent in this repo to Pydantic AI, keeping the public API.
- Port this LangGraph workflow to pydantic_graph and write parity tests first.
- Map the Deep Agents features we use to Pydantic AI Harness capabilities.
Good to know
- Pydantic AI Harness experimental modules are version-sensitive.
- Contracts without executable tests are treated as unverified, not equivalent.
- Queues, databases, sandboxes, and auth stay unchanged unless they are in scope.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-langchain-to-pydantic-ai/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md10 KB -
agents/openai.yaml394 B -
references/CONCEPT-MAPPING.md16 KB -
references/DEEP-AGENTS-MAPPING.md24 KB -
references/LOGFIRE-VERIFICATION.md10 KB
Show all 8 files
-
references/SEMANTIC-GAPS.md22 KB -
references/VERIFICATION-AND-CUTOVER.md12 KB -
references/WORKAROUND-RECIPES.md18 KB
Alternatives to migrating-langchain-to-pydantic-ai
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
migrating-langchain-to-pydantic-ai: common questions
Does it rewrite the whole application?
No. It migrates the smallest behaviorally complete slice and leaves infrastructure outside that slice unchanged.
Which LangChain features does it cover?
The source covers LangChain agents, chains, LCEL, direct LangGraph graphs, persistence, interrupts, streaming, and create_deep_agent projects.
Does it replace LangSmith with Logfire?
Not silently. The source says an existing observability system should be kept unless the user agrees to a switch after a recommendation is explained.
How do I install migrating-langchain-to-pydantic-ai?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is migrating-langchain-to-pydantic-ai free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is migrating-langchain-to-pydantic-ai safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to migrating-langchain-to-pydantic-ai?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
