/ai:migrating-claude-agent-sdk-to-pydantic-aifrom ai
Migrates Python applications from the Claude Agent SDK to Pydantic AI (and Harness when needed), preserving observable behavior across agent loops, tools, hooks, sessions, and subagents. Includes tracing, contract mapping, and verification guidance. Not for Anthropic Messages SDK or Claude Managed Agents.
Ships in ai. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Preserve observable behavior, not the Claude Code process or API shape. Migrate the smallest complete caller path and keep application infrastructure in place.
query() or ClaudeSDKClient through prompts, tools, events, results, state, persistence, approvals, and side effects that callers use. Establish a focused baseline or characterization test.query() calls, live ClaudeSDKClient continuation, disk/external-store resume, transcript forks, and file rewind;Read Research and concept mapping for the detected source features. Read Verification and cutover before implementation.
pydantic_ai.Agent for model calls, the agent loop, typed dependencies, tools, outputs, normalized messages, generic hooks, streaming, MCP, approvals, usage limits, instrumentation, and durable-runtime integrations.pydantic-ai-harness only for observed reusable policy such as coding filesystem/shell tools, repository context, planning, memory, model-directed subagents, model-agnostic context management, or Agent Skills. Harness capabilities compose through the core agent loop; Harness is not a second runtime.ClaudeSDKClient or emulate Claude transcript files merely to hide a difference.The normal migration is one reusable Agent, application services supplied through typed dependencies, ordinary Pydantic AI tools, a typed output when the caller expects structure, and application-owned storage of result.all_messages() when later turns need context. Preserve the existing public request/response/event boundary with a small adapter while callers migrate.
allowed_tools in the Claude Agent SDK means auto-approval, not exclusive availability and not isolation. Map availability, approval, policy, and sandboxing independently.message_history explicitly replays normalized messages. conversation_id correlates runs; it is not a Claude session-resume token. Prove restart and fork behavior rather than renaming IDs.before_* hooks in capability order, after_* hooks in reverse order, and nests wrap_* hooks with the first capability outermost. Require a golden trace for any hook-visible contract.SubAgents only for model-directed delegation. Keep deterministic orchestration and verification loops in application code.Skills supplies on-demand SKILL.md instructions; verify resources and scripts separately instead of assuming Claude Code skill or plugin loading parity.ModalSandbox where it fits or retain application-owned container, VM, or sandbox isolation.claude-agent-sdk only after no retained path imports it, spawns Claude Code, reads its transcripts, or consumes its event/result types.Explain any consequential semantic change before implementing it: state the source behavior, target behavior, caller impact, recommended choice, and remaining risk.
Apply the completion criterion in Verification and cutover. Label evidence from fakes, recordings, and live providers accurately.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
migration, pydantic-ai, claude-agent-sdk, agent-loop, harness
9 skills in this plugin
/building-pydantic-ai-agentsBuild AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, structured output, streaming, testing, and multi-agent patterns. Use when the user mentions Pydantic AI, imports pydantic_ai, or asks to build an AI agent, add tools/capabilities, attach a workspace, defer capability loading, stream output, define agents from YAML, or test agent behavior./migrating-agno-to-pydantic-aiMigrate Python Agno applications to Pydantic AI and, only when needed, Pydantic AI Harness. Use when source code imports `agno` or relies on Agno agents, teams, workflows, sessions, memory, knowledge, tools, hooks, guardrails, approvals, skills, streaming, or AgentOS./migrating-google-adk-to-pydantic-aiMigrate Python Google Agent Development Kit (ADK) applications to Pydantic AI. Use for `LlmAgent`, `Runner`, sessions, state, memory, tools, callbacks, plugins, graph or dynamic workflows, resumability, events, artifacts, MCP, and ADK deployment boundaries./migrating-langchain-to-pydantic-aiMigrate Python LangChain, LangGraph, or Deep Agents applications to Pydantic AI and, when the source uses harness features, Pydantic AI Harness. Use for LangChain agents, chains, LCEL, direct LangGraph graphs, persistence, interrupts, streaming, and `create_deep_agent` projects with planning, filesystem or sandbox backends, skills, memory, subagents, permissions, approvals, or Deep Agents Code hosts./migrating-mastra-to-pydantic-aiMigrate TypeScript Mastra applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness. Use when source code imports `@mastra/*` or relies on Mastra agents, tools, workflows, memory, processors, streaming, approvals, skills, or subagents./migrating-openai-agents-sdk-to-pydantic-aiMigrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness. Use for `agents.Agent`, `Runner`, function tools, handoffs, guardrails, sessions, human approval, streaming, or `SandboxAgent`. Do not use for applications built directly on the OpenAI Responses API without the Agents SDK runtime.Other plugins' skills for the same job
npx claudepluginhub pydantic/skills --plugin ai