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 mfmezger/ai_agent_dotfiles --skill building-pydantic-ai-agentsgit clone --depth 1 https://github.com/mfmezger/ai_agent_dotfilesWrote 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/mfmezger/ai_agent_dotfiles/building-pydantic-ai-agents)<a href="https://agentmods.dev/skills/mfmezger/ai_agent_dotfiles/building-pydantic-ai-agents"><img src="https://agentmods.dev/badge/skills/mfmezger/ai_agent_dotfiles/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/mfmezger/ai_agent_dotfiles/building-pydantic-ai-agents"><img src="https://agentmods.dev/badge/skills/mfmezger/ai_agent_dotfiles/building-pydantic-ai-agents.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.00076 | $0.02701 |
| Opus 5 | $0.00038 | $0.01350 |
| Sonnet 5 | $0.00015 | $0.00540 |
| Haiku 4.5 | $0.00008 | $0.00270 |
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 11d 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.
How it starts
The opening of the file, as written. The whole thing — 275 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
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
from pydantic_ai import Agent
agent = Agent(
'anthropic:claude-sonnet-4-6',
instructions='Be concise, reply with one sentence.',
)
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.
"""
Add Tools to an Agent
import random
from pydantic_ai import Agent, RunContext
agent = Agent(
'google-gla:gemini-3-flash-preview',
deps_type=str,
instructions=(
"You're a dice game, you should roll the die and see if the number "
"you get back matches the user's guess. If so, tell them they're a winner. "
"Use the player's name in the response."
),
)
@agent.tool_plain
def roll_dice() -> str:
"""Roll a six-sided die and return the result."""
return str(random.randint(1, 6))
@agent.tool
def get_player_name(ctx: RunContext[str]) -> str:
"""Get the player's name."""
return ctx.deps
dice_result = agent.run_sync('My guess is 4', deps='Anne')
print(dice_result.output)
#> Congratulations Anne, you guessed correctly! You're a winner!
What ships with it
10 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 4.1 KB
- references/ARCHITECTURE.md 10 KB
- references/BUILTIN-TOOLS.md 1.9 KB
- references/CAPABILITIES-AND-HOOKS.md 2.5 KB
- references/COMMON-TASKS.md 4.5 KB
- references/INPUT-AND-HISTORY.md 1.8 KB
- references/ORCHESTRATION-AND-INTEGRATIONS.md 3.4 KB
- references/TESTING-AND-DEBUGGING.md 2.0 KB
- references/TOOLS-ADVANCED.md 3.9 KB
- references/TOOLS-CORE.md 2.8 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.
- 11d ago First seen · 275 lines · 76 tokens per session scan A 4fed3c0a468c
building-pydantic-ai-agents is a skill published in the GitHub repository mfmezger/ai_agent_dotfiles (6 stars, last pushed 1mo ago), licensed MIT. It adds 76 tokens to every session and 2,701 once invoked, about $0.0004 per session on Opus 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-31.
Other skills, from other repositories
python-patterns
Python idioms — type hints, dataclasses, async/await, generators, pytest, common pitfalls. Activate when writing or reviewing Python code.
writing-python
Idiomatic Python 3.12+ development. Use when writing Python code, CLI tools, scripts, or services. Emphasizes stdlib, type hints, fast pytest feedback, uv/ruff/pyright toolchain, and minimal dependencies. NOT for Go, Rust, TypeScript, or shell-only tasks.
python-engineering-guidelines
General Python engineering standards for writing, reviewing, and refactoring maintainable code. Use when Codex works on Python code, especially in medium/large projects, runtime adapters, APIs, SDK integrations, async services, stateful systems, or refactors where readability, explicit typing, module boundaries, side…
test-generator
A generator that reads Python functions and creates pytest test-file skeletons with parameterized example inputs. Pytest is a Python testing tool, and TDD means writing tests as part of the implementation process.
python-development
Professional Python development skill covering modern Python 3.10+, FastAPI, Django, Flask, async programming, data processing, and best practices. Use this skill when developing Python web applications, building FastAPI/Django projects, implementing async programming, or need guidance on Python architecture design…
mainframe-python-backend
Develop, debug, review, or test server-side Python in FastAPI, Django, Flask, and other established services. Use proactively for backend APIs, business rules, persistence, workers, realtime behavior, server integrations, and focused backend tests. Do not use for data or ML pipelines, substantial client-only UI…