Pydantic AI is a typed Python SDK for building AI agents that can use different language models and interfaces, including voice, image generation, and embeddings. Developers use it for applications ranging from structured data extraction to long-running multi-agent work. The catalogue entries provide workflows and configuration for its coding-agent and harness features.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add pydantic/pydantic-ai --skill migrating-mastra-to-pydantic-aigit clone --depth 1 https://github.com/pydantic/pydantic-aiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/pydantic/pydantic-ai/migrating-mastra-to-pydantic-ai)<a href="https://agentmods.dev/skills/pydantic/pydantic-ai/migrating-mastra-to-pydantic-ai"><img src="https://agentmods.dev/badge/skills/pydantic/pydantic-ai/migrating-mastra-to-pydantic-ai/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/pydantic/pydantic-ai/migrating-mastra-to-pydantic-ai"><img src="https://agentmods.dev/badge/skills/pydantic/pydantic-ai/migrating-mastra-to-pydantic-ai.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00073 | $0.01594 |
| Opus 5.5 | $0.00029 | $0.00638 |
| Sonnet 5.5 | $0.00015 | $0.00319 |
| Haiku 4.5 | $0.00007 | $0.00159 |
Grade A, and why
migrating-mastra-to-pydantic-ai scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- migrating-mastra-to-pydantic-ai — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Migrate Mastra to Pydantic AI
Preserve observable behavior, not TypeScript or Mastra's object model. Migrate the smallest complete caller path and keep application infrastructure in place.
Trace the source before choosing a target
- Read repository instructions, dependencies, tests, and the runtime entrypoint. Record the installed Mastra, Pydantic AI, and Harness versions.
- Trace one real request from its public entrypoint, whether an
Agent.generate()/Agent.stream()call or a workflow run, through the tools, processors, memory, events, results, state, and side effects that callers use. Establish a focused baseline or characterization test. - Separate these source contracts when present:
- request context, model-chosen tool input, workflow input/output, and shared workflow state;
- conversation messages, semantic recall, working or observational memory, workflow snapshots, and model-owned plans;
- final text or objects, token deltas, lifecycle events, tripwires, and terminal workflow status;
- tool approval, authenticated authorization, and process or sandbox isolation;
- deterministic workflows, agent-selected delegation, queues, schedules, and durable execution.
- Record each observed contract, its owner, semantic difference, and executable proof. An unused Mastra feature is not migration scope.
Read Research and concept mapping for the detected source features. Read Verification and cutover before implementation.
Choose the smallest target
- Core: use
pydantic_ai.Agentfor the agent loop, typed dependencies, tools, outputs, normalized messages, generic hooks, streaming, MCP clients, approvals, usage limits, instrumentation, realtime, and durable-runtime integrations. - Graph: use
pydantic_graphonly when explicit typed nodes, branches, and joins remain useful; use plain async Python for simple fixed control flow. - Harness: add
pydantic-ai-harnessonly for observed reusable policy such as memory notebooks, planning, model-directed subagents, Agent Skills, coding tools, guardrails, model-agnostic compaction strategies, or step persistence. Harness capabilities compose through the core agent loop; Harness is not a workflow engine or second runtime. - Evals: add the separate
pydantic-evalspackage for observed datasets, cases, and evaluators. - Application: retain authentication, databases, vector search, queues, schedulers, deployment, product state, API/UI transports, session lookup, and tenant policy unless the requested slice includes them.
- Gap: name behavior that no supported public seam preserves, explain its impact, and test a bounded adapter. Do not reproduce the Mastra registry, server, storage schema, or event taxonomy merely to hide a difference.
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 62 lines · 73 tokens per session scan A 721f38c76111
migrating-mastra-to-pydantic-ai is a skill published in the GitHub repository pydantic/pydantic-ai (20,645 stars, last pushed today), licensed MIT. It adds 73 tokens to every session and 1,594 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-16.
Other skills, from other repositories
ax-python-signature
Use when writing Python code with axllm for string signatures, field descriptors, JSON schema output, validation, and typed tool argument shapes.
ax-python-llm
Use when writing Python code with axllm for using the generated Ax package, factory functions, package docs, examples, and API reference.
test-generator
Generate pytest test cases for Python functions and classes.
python-expert
Python expert for stdlib, packaging, type hints, async/await, and performance optimization.
typescript-expert
TypeScript expert for type system, generics, utility types, and strict mode patterns.
deepseek-harness
Use when building AI agent applications with a plugin-based architecture — Web UI, CLI, Python SDK, Cordis plugin system, multi-model orchestration. DeepSeek Harness (dsh): open-source agent harness by DeepSeek AI where everything is a plugin, powered by Cordis for spatiotemporal composability.