Migrating Mastra To Pydantic AI
pydantic/pydantic-ai
Migrate TypeScript Mastra applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness.
Extend Pydantic AI agents with batteries-included capabilities from pydantic-ai-harness -- Code Mode (collapse many tool calls into one sandboxed Python execution), a filesystem and shell…
$ npx skills add pydantic/skills --skill pydantic-ai-harness -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install pydantic/skills pydantic-ai-harness --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/pydantic/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/pydantic-ai-harness .claude/skills/pydantic-ai-harness && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "pydantic-ai-harness" agent skill from https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harness into .claude/skills/pydantic-ai-harness/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai-harness", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harnessType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add pydantic/skills --skill pydantic-ai-harness -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install pydantic/skills pydantic-ai-harness --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pydantic/skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/pydantic-ai-harness .agents/skills/pydantic-ai-harness && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "pydantic-ai-harness" agent skill from https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harness into .agents/skills/pydantic-ai-harness/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai-harness", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pydantic/skills --skill pydantic-ai-harness -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install pydantic/skills pydantic-ai-harness --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pydantic/skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/pydantic-ai-harness .cursor/skills/pydantic-ai-harness && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "pydantic-ai-harness" agent skill from https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harness into .cursor/skills/pydantic-ai-harness/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai-harness", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/pydantic/skills.git --path skills/pydantic-ai-harness--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add pydantic/skills --skill pydantic-ai-harness -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install pydantic/skills pydantic-ai-harness --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pydantic/skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/pydantic-ai-harness .gemini/skills/pydantic-ai-harness && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "pydantic-ai-harness" agent skill from https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harness into .gemini/skills/pydantic-ai-harness/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai-harness", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install pydantic/skills pydantic-ai-harnessInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add pydantic/skills --skill pydantic-ai-harness -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/pydantic/skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/pydantic-ai-harness .github/skills/pydantic-ai-harness && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "pydantic-ai-harness" agent skill from https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harness into .github/skills/pydantic-ai-harness/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai-harness", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add pydantic/skills --skill pydantic-ai-harness -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install pydantic/skills pydantic-ai-harness --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/pydantic/skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/pydantic-ai-harness .opencode/skills/pydantic-ai-harness && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "pydantic-ai-harness" agent skill from https://github.com/pydantic/skills/tree/main/skills/pydantic-ai-harness into .opencode/skills/pydantic-ai-harness/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai-harness", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
pydantic-ai-harnessExtend Pydantic AI agents with batteries-included capabilities from pydantic-ai-harness -- Code Mode (collapse many tool calls into one sandboxed Python execution), a filesystem and shell…
Pydantic AI Harness is an agent skill from pydantic/skills, published by the product's own GitHub organization. Extend Pydantic AI agents with batteries-included capabilities from pydantic-ai-harness -- Code Mode (collapse many tool calls into one sandboxed Python execution), a filesystem and shell, sub-agents, planning, context compaction, and more. Use when the user mentions pydantic-ai-harness, CodeMode, Monty, code mode, or tool sandboxing, when they want first-party filesystem/shell/sub-agent/planning/compaction capabilities for a Pydantic AI agent, when they want an agent to run agent-written Python, or when a…
Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/CODE-MODE.md`). Compatibility notes: Requires Python 3.10+ and pydantic-ai-slim=2.18.0
It sits in Agent Workflows, covering Subagents and Context engineering. It works with Pydantic AI, Python and Pydantic. The licence is MIT.
Read from SKILL.md and the folder at commit 238d971. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
uvFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
github.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Requires Python 3.10+ and pydantic-ai-slim>=2.18.0
From compatibility in the SKILL.md frontmatter.
Pydantic AI Harness loads about 1.9k tokens when it runs, and up to ~3.6k if it reads all its reference files. Until then it costs about 158 tokens; SKILL.md has 710 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from pydantic/skills at commit 238d971, republished under its MIT licence (© pydantic). 710 words, ~1,899 tokens.
.claude/skills/pydantic-ai-harness/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Pydantic AI Harness is the official capability library for Pydantic AI. Capabilities that need model or
framework support -- and those fundamental to every agent -- live in core pydantic-ai; optional,
batteries-included capabilities live here. Both are composed onto an agent through the same
capabilities=[...] API.
This skill covers the capabilities shipped by pydantic-ai-harness. For the core framework -- agents,
tools, structured output, hooks, and testing -- use the building-pydantic-ai-agents skill instead.
Invoke this skill when:
pydantic-ai-harness, CodeMode, code mode, or the Monty sandboxasyncio.gatherDo not use this skill for:
building-pydantic-ai-agents)pydantic-ai, such as web search, tool search, and thinkingpydantic/BaseModel without agents)CodeMode has a full reference below; it is the flagship capability and the one this skill goes deep on.
The rest ship today and each has its own README with API and examples.
Each capability lives in its own submodule and is imported from there
(from pydantic_ai_harness.<module> import ...). Capabilities are not importable from the top-level
pydantic_ai_harness package by design, so each one keeps its own optional dependencies isolated.
CodeMode, FileSystem, Shell, and ManagedPrompt also have top-level re-exports (importable directly
from pydantic_ai_harness).
APIs are subject to change between releases; breaking changes ship deprecation warnings where practical.
| Capability | Module | Description |
|---|---|---|
CodeMode | pydantic_ai_harness.code_mode (also top-level) | Wraps eligible tools into a single sandboxed run_code tool so the model orchestrates them in Python -- see Code Mode |
FileSystem | pydantic_ai_harness.filesystem (also top-level) | Read, write, edit, and search files under a root directory, with traversal prevention |
Shell | pydantic_ai_harness.shell (also top-level) | Run commands in a subprocess with allowlists, a default denylist, timeouts, and env masking |
ManagedPrompt | pydantic_ai_harness.logfire (also top-level) | Back an agent's instructions with a Logfire-managed prompt |
SubAgents | pydantic_ai_harness.subagents | Delegate subtasks to specialized child agents |
DynamicWorkflow | pydantic_ai_harness.dynamic_workflow | Orchestrate sub-agents from a model-written Python script |
Planning | pydantic_ai_harness.planning | Break complex tasks into structured plans before execution |
compaction family (SlidingWindowCompaction, SummarizingCompaction, ...) | pydantic_ai_harness.compaction | Trim or summarize conversation history to stay within token limits |
ToolOutputLimits | pydantic_ai_harness.tool_output_limits | Truncate, summarize, or spill large tool outputs |
RepoContext | pydantic_ai_harness.repo_context | Auto-load CLAUDE.md/AGENTS.md and repo structure |
StepPersistence | pydantic_ai_harness.step_persistence | Save, restore, resume, and fork run state |
PydanticAIDocs | pydantic_ai_harness.pydantic_ai_docs | On-demand read_pyai_docs tool for Pydantic AI docs |
CapabilityCreation | pydantic_ai_harness.capability_creation | Let an agent author, validate, and load real capabilities at runtime |
| media externalization | pydantic_ai_harness.media | Offload large BinaryContent to content-addressed stores |
Still experimental: an ACP server adapter, imported from pydantic_ai_harness.experimental.acp. Importing it
emits a HarnessExperimentalWarning.
The full, current list with links and status is in the capability matrix.
uv add pydantic-ai-harnessEach capability declares its own extra. Code Mode needs the Monty sandbox:
uv add "pydantic-ai-harness[codemode]" # `code-mode` is also accepted as an aliasRequires Python 3.10+ and pydantic-ai-slim>=2.18.0.
A harness capability is added to the agent like any other. Here CodeMode wraps locally registered tools
into a single run_code tool that the model drives with Python.
from pydantic_ai import Agent
from pydantic_ai_harness import CodeMode
agent = Agent('anthropic:claude-sonnet-4-6', capabilities=[CodeMode()])
@agent.tool_plain
def get_temperature_f(city: str) -> float:
return {'Paris': 68.0, 'Tokyo': 77.0}[city]
@agent.tool_plain
def convert_temp(fahrenheit: float) -> float:
return round((fahrenheit - 32) * 5 / 9, 1)
result = agent.run_sync(
'Compare the weather in Paris and Tokyo, and report both temperatures in Celsius.'
)
print(result.output)
#> Paris is 20.0 C and Tokyo is 25.0 C.The model writes a single Python script that fetches both temperatures with asyncio.gather and then
converts them -- performing four tool calls across two dependent stages in one run_code invocation.
building-pydantic-ai-agents skill instead -- don't reach for the harness by default.CodeMode without pydantic-ai-harness[codemode] raises an ImportError; the Monty sandbox is an optional dependency.native=True tools bypass CodeMode. Provider-native MCP servers and web search execute server-side, so run_code never sees them. Use native=False for client-side dispatch that CodeMode can wrap, but do not treat a remote server as trusted or sandboxed; see the Code Mode trust boundary.CodeMode needs its extra. Install pydantic-ai-harness[codemode], not the bare package.© pydantic, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file (references) in skills/pydantic-ai-harness of pydantic/skills.
Open the folder on GitHubat commit 238d971
We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders. This page covers the copy in pydantic/skills, which our catalogue first saw on October 7, 2026.
Pydantic AI Harness next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Pydantic AI Harness this skillpydantic/skills | 140 | — | ~1.9k | Automated safety check: Pass | MIT | |
| Migrating Mastra To Pydantic AIpydantic/pydantic-ai | 21k | — | ~2k | Automated safety check: Pass | MIT | |
| Migrating Vercel AI SDK And Eve To Pydantic AIpydantic/pydantic-ai | 21k | — | ~2.3k | Automated safety check: Pass | MIT | |
| Pydantic AI Harnesspydantic/pydantic-ai | 21k | — | ~4.9k | Automated safety check: Pass | MIT | |
| Claude Statusbarleeguooooo/claude-code-usage-bar | 378 | — | ~2.6k | Automated safety check: Pass | MIT | |
| Migrating Claude Agent SDK To Pydantic AIpydantic/pydantic-ai | 21k | — | ~1.6k | Automated safety check: Pass | MIT |
pydantic/pydantic-ai
Migrate TypeScript Mastra applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness.
pydantic/pydantic-ai
Migrate TypeScript Vercel AI SDK or Eve applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness.
pydantic/pydantic-ai
Adds optional capabilities to Pydantic AI agents from pydantic-ai-harness, led by Code Mode, which runs many tool calls as one sandboxed Python script.
leeguooooo/claude-code-usage-bar
Manage cs (claude-statusbar) — switch theme/style/density, override severity colors, preview combinations, run doctor, reset config, install, upgrade (cs upgrade — the only supported upgrade path)…
pydantic/pydantic-ai
Migrate Python applications from the Claude Agent SDK to Pydantic AI and, only when needed, Pydantic AI Harness.
pydantic/pydantic-ai
Migrate Python Google Agent Development Kit (ADK) applications to Pydantic AI.
pydantic/skills
Monitor hosts, Docker containers, Kubernetes clusters, database/queue/cache servers, and cloud-provider metrics with Pydantic Logfire — no application code required.
pydantic/skills
Query and analyze Logfire telemetry data — traces, logs, spans, metrics, summaries, and SQL results.
pydantic/skills
Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns.
pydantic/skills
Run offline Python (pydanticevals) or Node.js (logfire/evals) evaluations and review them in Logfire.
pydantic/skills
Add Pydantic Logfire observability to application code — traces, logs, metrics, and AI/agent spans.
pydantic/skills
Open or return Logfire project pages, live views, trace links, and Explore pages in the Codex browser without querying telemetry first.
Works with
Categories
Extend Pydantic AI agents with batteries-included capabilities from pydantic-ai-harness -- Code Mode (collapse many tool calls into one sandboxed Python execution), a filesystem and shell…. Pydantic AI Harness is an agent skill from pydantic/skills, published by the product's own GitHub organization. Extend Pydantic AI agents with batteries-included capabilities from pydantic-ai-harness -- Code Mode (collapse many tool calls into one sandboxed Python execution), a filesystem and shell, sub-agents, planning, context compaction, and more.
Pydantic AI Harness fits situations like: the user mentions pydantic-ai-harness; tool sandboxing; they want first-party filesystem/shell/sub-agent/planning/compaction capabilities for a Pydantic AI agent; they want an agent to run agent-written Python.
Run `npx skills add pydantic/skills --skill pydantic-ai-harness -a claude-code`. Or copy the skill folder (skills/pydantic-ai-harness in pydantic/skills) into .claude/skills/pydantic-ai-harness in your project. Claude Code loads it when a task matches its description.
Run `npx skills add pydantic/skills --skill pydantic-ai-harness -a codex`. Or copy the skill folder (skills/pydantic-ai-harness in pydantic/skills) into .agents/skills/pydantic-ai-harness in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pydantic/skills --skill pydantic-ai-harness -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pydantic-ai-harness, .gemini/skills/pydantic-ai-harness, .github/skills/pydantic-ai-harness and .opencode/skills/pydantic-ai-harness in your project.
Going by SKILL.md and its folder, Pydantic AI Harness needs the command-line tools its instructions call (uv). Our summary lists: Python 3. Compatibility (from SKILL.md): Requires Python 3.10+ and pydantic-ai-slim>=2.18.0.
SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Pydantic AI Harness is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.7k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Pydantic AI Harness: Migrating Mastra To Pydantic AI (pydantic/pydantic-ai, 21k stars), Migrating Vercel AI SDK And Eve To Pydantic AI (pydantic/pydantic-ai, 21k stars), Pydantic AI Harness (pydantic/pydantic-ai, 21k stars) and Claude Statusbar (leeguooooo/claude-code-usage-bar, 378 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
pydantic (a GitHub organization, an official publisher) maintains it in pydantic/skills, which has 140 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 1, 2026.
Source: pydantic/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.