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 building-pydantic-ai-agentsgit 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/building-pydantic-ai-agents)<a href="https://agentmods.dev/skills/pydantic/pydantic-ai/building-pydantic-ai-agents"><img src="https://agentmods.dev/badge/skills/pydantic/pydantic-ai/building-pydantic-ai-agents/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/building-pydantic-ai-agents"><img src="https://agentmods.dev/badge/skills/pydantic/pydantic-ai/building-pydantic-ai-agents.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- Snyk pass
- NVIDIA SkillSpector pass
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.00092 | $0.08794 |
| Opus 5.5 | $0.00037 | $0.03518 |
| Sonnet 5.5 | $0.00018 | $0.01759 |
| Haiku 4.5 | $0.00009 | $0.00879 |
Grade A, and why
building-pydantic-ai-agents 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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 515 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Building AI Agents with Pydantic AI
Pydantic AI is a Python agent framework for building production-grade Generative AI applications. This skill provides patterns, architecture guidance, and tested code examples for building applications with Pydantic AI.
When to Use This Skill
Invoke this skill when:
- User asks to build an AI agent, create an LLM-powered app, or mentions Pydantic AI
- User wants to add tools, capabilities (thinking, web search), or structured output to an agent
- User asks to define agents from YAML/JSON specs or use template strings
- User wants to stream agent events, delegate between agents, or test agent behavior
- Code imports
pydantic_aior references Pydantic AI classes (Agent,RunContext,Tool) - User asks about hooks, lifecycle interception, or agent observability with Logfire
- User wants to reach models from several providers with one API key (the Pydantic AI Gateway)
- User wants an agent to run commands or access files in an attached workspace
- The agent design includes optional instructions, specialist workflows, long-tail tools, or any context the model does not need on most turns
Do not use this skill for:
- The Pydantic validation library alone (
pydantic/BaseModelwithout agents) - Other AI frameworks (LangChain, LlamaIndex, CrewAI, AutoGen)
- General Python development unrelated to AI agents
Quick-Start Patterns
Create a Basic Agent
Start new applications with Logfire instrumentation and prompt caching in place, so the first run is already visible and repeated prompt prefixes are read from the cache (see Set Up Observability and Model Access for credentials and alternatives):
import logfire
from pydantic_ai import Agent
from pydantic_ai.capabilities import Caching
logfire.configure()
logfire.instrument_pydantic_ai()
agent = Agent(
'anthropic:claude-fable-5-1',
name='hello_world_agent',
instructions='Be concise, reply with one sentence.',
capabilities=[Caching()],
)
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
"""
The first known use of "hello, world" was in a 1974 textbook about the C programming language.
"""
What ships with it
12 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.
- references/AGENTS-CORE.md 19 KB
- references/ARCHITECTURE.md 15 KB
- references/CAPABILITIES-AND-HOOKS.md 24 KB
- references/COMMON-TASKS.md 5.8 KB
- references/INPUT-AND-HISTORY.md 21 KB
- references/NATIVE-TOOLS.md 3.8 KB
- references/ON-DEMAND-CAPABILITIES.md 18 KB
- references/ORCHESTRATION-AND-INTEGRATIONS.md 14 KB
- references/TESTING-AND-DEBUGGING.md 5.7 KB
- references/TOOLS-ADVANCED.md 22 KB
- references/TOOLS-CORE.md 7.8 KB
- references/WORKSPACES.md 8.9 KB
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.
- today Changed · +14 lines bb979b79442c
- 3d ago Changed c49b232964c4
- 4d ago Changed · +1 lines 0501b6e9980f
- 6d ago Changed · +7 lines 5beb0f39db22
- 7d ago Changed · +8 lines 9d823213a50a
- 10d ago Changed · +4 lines fb465da0f98e
- 11d ago Changed 04abc521e436
- 13d ago Changed · +2 lines 2e7ef7da3a89
- 17d ago Changed · +3 lines 00df1499b4d8
- 20d ago First seen · 476 lines · 92 tokens per session scan A baf8fb96764c
building-pydantic-ai-agents is a skill published in the GitHub repository pydantic/pydantic-ai (20,889 stars, last pushed today), licensed MIT. It adds 92 tokens to every session and 8,794 once invoked, about $0.0004 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-08-30.
Other skills, from other repositories
verification-strategy
Thorough verification of completed work before declaring done.
test-generator
Generate pytest test cases for Python functions and classes.
test-writer
Generate comprehensive test suites for existing code.
pydantic-evals
Test and evaluate AI agents and LLM outputs using code-first evaluation framework with strong typing. Use when the user wants to: (1) Create evaluation datasets with test cases for AI agents, (2) Define evaluators (deterministic, LLM-as-Judge, custom, or span-based), (3) Run evaluations and generate reports, (4)…
browser-use
Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers hosted cloud browsers for AI agents: the browser-use Python library (Browser(usecloud=True)), Playwright, Puppeteer or any CDP client.
python-testing
Python testing best practices using pytest including fixtures, parametrization, mocking, coverage analysis, async testing, and test organization. Use when writing or improving Python tests.