Pydantic Deep Agents is a self-hosted terminal AI assistant and Python framework for building coding, research, and other AI agents. It gives agents tools such as file access, shell commands, planning, memory, sub-agents, sandboxed execution, and MCP connections, and supports different models.
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 agentmods add skills/vstorm-co/pydantic-deepagents/performant-codenpx skills add vstorm-co/pydantic-deepagents --skill performant-codegit clone --depth 1 https://github.com/vstorm-co/pydantic-deepagentsWrote 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/vstorm-co/pydantic-deepagents/performant-code)<a href="https://agentmods.dev/skills/vstorm-co/pydantic-deepagents/performant-code"><img src="https://agentmods.dev/badge/skills/vstorm-co/pydantic-deepagents/performant-code.svg" alt="Measured on agentmods" 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 | $0.00014 | $0.00632 |
| Opus 5 | $0.00007 | $0.00316 |
| Sonnet 5 | $0.00003 | $0.00126 |
| Haiku 4.5 | $0.00001 | $0.00063 |
Grade A, and why
performant-code scanned grade A with 1 finding 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 5d 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
- `subprocess.run()` > `os.system()` How it starts
The opening of the file, as written. The whole thing — 71 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Performant Code
How to write code that won't timeout on large inputs.
Think About Scale First
Before writing code, ask: how big is the data?
| Data size | Approach |
|---|---|
| < 1 MB | Load into memory, any approach works |
| 1-100 MB | Load into memory, but use efficient algorithms |
| 100 MB - 1 GB | Stream/mmap, avoid loading entirely into memory |
| > 1 GB | Streaming only, chunk-based processing |
I/O Optimization
Large files
- mmap (C:
mmap(), Python:mmap.mmap()) — map file into memory, OS handles paging - Buffered binary reads —
fread()in C,open(f, 'rb').read(chunk)in Python - NEVER read a 500MB file line-by-line with
fgets()when you need random access
Writing output
- Buffer writes — don't call
write()for every byte - Use
fwrite()orsys.stdout.buffer.write()for binary output - Flush only when needed
Algorithm Complexity
- O(n) beats O(n log n) beats O(n²) — always
- Nested loops on large data = timeout. Restructure to single pass + hash map
- Sorting is O(n log n) — only sort if you need to
- Use hash maps/sets for lookup instead of linear search
- Pre-compute what you can outside loops
Language-Specific Tips
C
- Use
mmap()for large file access -O2or-O3for compiler optimizations- Avoid
malloc()/free()in tight loops — pre-allocate - Use
memcpy()instead of byte-by-byte copying - Integer arithmetic > floating point when possible
Python
- Use
numpyfor numerical work (100x faster than pure Python loops) collections.Counter,defaultdict— avoid manual counting- List comprehensions > explicit loops
struct.unpack()for binary parsingsubprocess.run()>os.system()- For heavy computation: consider writing a small C program instead
General
- Profile before optimizing — find the actual bottleneck
- If a program hangs, it's likely: infinite loop, deadlock, or I/O bound on huge data
- If a program is slow, check: algorithm complexity, I/O pattern, memory allocation
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.
- 5d ago First seen · 71 lines · 14 tokens per session scan A e6b38be0640b
performant-code is a skill published in the GitHub repository vstorm-co/pydantic-deepagents (1,053 stars, last pushed 13d ago), licensed MIT. It adds 14 tokens to every session and 632 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
performance-analysis
Comprehensive performance analysis, bottleneck detection, and optimization recommendations for Claude Flow swarms.
add-new-model
Add support for a newly-released LLM model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5). Use when a provider ships a new model id and you need to wire literals, profile flags, and tests to recognize it. Handles SDK-lag, gateway list conventions, and capability probing.
building-pydantic-ai-agents
Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns. Use when the user mentions Pydantic AI, imports pydanticai, or asks to build an AI agent, add tools/capabilities, defer capability loading, stream output, define agents…
complete-partial-pr
Evaluate and complete an issue or PR where the submitted patch fixes only a narrow symptom of the reported pain point. Use when a contribution may miss adjacent integration surfaces, provider/spec semantics, roundtrip behavior, tests, docs, or historical maintainer decisions.
testing-skill
Record, rewrite, and debug VCR cassettes for HTTP recordings. Use when running tests with --record-mode, verifying cassette playback, or inspecting request/response bodies in YAML cassettes.
pre-push-review
Run a high-judgment local review of the current branch before pushing, both before a PR exists and between PR iterations.