building-pydantic-ai-a…
Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, structured output, streaming,…
Migrate TypeScript Pi coding-agent applications, extensions, or packages to Python with Pydantic AI and Pydantic AI Harness. Use when source code imports `@earendil-works/pi-*`, calls `createAgentSession`, registers Pi extensions, or relies on Pi tools, hooks, skills, sessions,
$ npx -y skills add pydantic/skills --skill migrating-pi-to-pydantic-ai --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/migrating-pi-to-pydantic-aiContext preview
The summary Claude sees to decide when to auto-load this skill.
Migrate TypeScript Pi coding-agent applications, extensions, or packages to Python with Pydantic AI and Pydantic AI Harness. Use when source code imports `@earendil-works/pi-*`, calls `createAgentSession`, registers Pi extensions, or relies on Pi tools, hooks, skills, sessions,
name: migrating-pi-to-pydantic-ai description: Migrate TypeScript Pi coding-agent applications, extensions, or packages to Python with Pydantic AI and Pydantic AI Harness. Use when source code imports `@earendil-works/pi-*`, calls `createAgentSession`, registers Pi extensions, or relies on Pi tools, hooks, skills, sessions, compaction, providers, TUI, RPC, or packages.
Preserve observable behavior, not Pi's TypeScript API. Migrate the smallest complete caller path and keep product/host infrastructure in the application.
1. Read repository instructions, `package.json`, Pi settings, tests, extension/package manifests, and runtime entrypoints. Record the installed Pi, Pydantic AI, and Harness versions. 2. Trace one real request from the Pi CLI, RPC boundary, or `createAgentSession().prompt()` through resource discovery, system instructions, tools, extensions, model requests, messages, compaction/retry, events, session entries, UI/RPC output, and side effects. Establish a focused baseline or characterization test. 3. Inventory every active extension factory and package resource. For each `pi.on(...)`, `registerTool`, `registerCommand`, provider registration, renderer/UI contribution, skill, prompt, and persisted entry, record its firing point, trusted inputs, mutations, output, state owner, and caller-visible effect. 4. Separate these contracts when present:
5. Record each observed contract, its owner, semantic difference, and executable proof. An installed but inactive Pi package feature is not migration scope.
Read [Research and concept mapping](references/RESEARCH-AND-MAPPING.md) for the detected features. Read [Verification and cutover](references/VERIFICATION-AND-CUTOVER.md) before implementation.
A Pi extension is the closest source concept to a Pydantic AI capability, but it is broader. An extension can combine agent behavior with terminal UI, commands, provider registration, resource discovery, and host lifecycle. **Port responsibilities, not the extension file:**
1. Map reusable model-facing behavior—tools, instructions, model settings, history/event processing, guardrails, and agent-loop hooks—to an existing Core or Harness capability when its lifecycle matches. 2. Bundle related instructions and tools in core `Capability`; subclass `AbstractCapability` only for reusable behavior that needs lifecycle hooks, adaptive models/settings, native tools, or typed capability events. 3. Keep CLI commands, flags, keyboard shortcuts, TUI renderers/dialogs, session selection, project trust, package installation, and provider credential setup in the Python application or interface adapter. They are not agent capabilities merely because a Pi extension owns them. 4. Split mixed extensions at that seam. A permission extension may become a `ToolGuardrail` or approval capability plus an application-owned approver UI; a coding package may become `Coder` plus host configuration; a provider extension remains a model/provider integration. 5. Preserve order only where evidence shows it matters. Pi handler load order and Pydantic AI capability/hook ordering are different contracts.
The normal embedded migration is one reusable `Agent`, `Coder` or a smaller capability composition, application services in typed dependencies, an application-owned message/session store, and a thin adapter at the existing RPC or UI boundary.
Logfire, Pydantic AI, and Pydantic plugins for Claude Code, Codex, and Cursor. Instrument your code with Logfire, query and export the resulting telemetry, build LLM agents with Pydantic AI, and validate data with Pydantic.
Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, structured output, streaming,…
Migrate Python Agno applications to Pydantic AI and, only when needed, Pydantic AI Harness. Use when source code imports `agno`…
Migrate Python applications from the Claude Agent SDK to Pydantic AI and, only when needed, Pydantic AI Harness. Use when source…
Migrate Python Google Agent Development Kit (ADK) applications to Pydantic AI. Use for `LlmAgent`, `Runner`, sessions, state,…
Migrate Python LangChain, LangGraph, or Deep Agents applications to Pydantic AI and, when the source uses harness features,…
Migrate TypeScript Mastra applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness. Use when source…