pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-langchain-to-pydantic-ai/SKILL.md
Preserve behavior, not framework shape. Migrate the smallest behaviorally complete slice and leave application infrastructure outside that slice unchanged.
langchain, langgraph, langsmith, and deepagents, then confirm findings against imports, factories, and call sites.pydantic_ai.Agent with typed dependencies, tools, and outputs.pydantic_graph when explicit typed nodes and branching remain useful. Treat persistence as a separate design decision.Read Concept Mapping for the detected source features. Read Semantic Gaps only for state, middleware, retries, approval, concurrency, streaming, or other behavior where similar-looking APIs may differ. Use Workaround Recipes after a concrete gap is identified, not as a mandatory checklist. Read Logfire Verification when adding observability, comparing source and target runs, or debugging a semantic difference. Read Verification and Cutover before a production cutover.
When an observed source contract has no direct equivalent, explain it to the user before making a consequential design choice. State the source behavior, how the proposed Pydantic AI design differs, the user-visible or operational impact, and the available choices. Recommend one option and name its residual risk. Keep this proportional: do not turn ordinary import or naming changes into semantic warnings.
deepagents dependency alone is not a reason to stop. If the active slice calls create_deep_agent or relies on its planning, skills, filesystem, subagent, sandbox, memory, or deployment contracts, report that it is a harness migration and ask whether those contracts are in scope. Do not assume another migration skill is installed.Agent onto deterministic LCEL or pydantic_graph onto every StateGraph.pydantic-ai-slim with only the required provider and integration extras when the dependency surface is bounded, and use the full distribution when its broader integrations are actually needed. Do not pin an older release merely to match a remembered example.The slice is complete when every observed contract is either preserved by an executable check, intentionally changed by an accepted decision, or explicitly not applicable. An untested contract is unverified, not equivalent; an unresolved requested contract is unfinished work, not completion evidence. Constrain the slice or ask the user to accept the deferral. Remove LangChain or LangGraph dependencies only after no retained path needs them.