pydantic-ai-shields
Enrichment pendingGuardrail capabilities for Pydantic AI, cost tracking, prompt injection detection, PII filtering, secret redaction, tool permissions, and async guardrails. Built on pydantic-ai's native capabilities A
GraphCanon updated today · GitHub synced today
Verify the decision
Maintenance and security
Full trust report- Maintenance
- Very active (6d since push)
- As of today
- Provenance
- Not a fork · Organization account
- As of today
- Security (OSV)
- No lockfile
- As of today
Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.
Install
pip install pydantic-ai-shields PyPISimilar tools
Same-category neighbours. No typed graph edges are catalogued for this tool yet.
Evidence and technical details
Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.
Overview
Guardrail capabilities for Pydantic AI — cost tracking, prompt injection detection, PII filtering, secret redaction, tool permissions, and async guardrails. Built on pydantic-ai's native capabilities API.
Capability facts
- Languages
- python
Source: github.language+pyproject.toml · Jul 15, 2026
Categories
Compatibility
Sourced claims from the README excerpt - not unsourced marketing copy.
Source: README excerpt (regex_v1, Jul 15, 2026)
```python from pydantic_ai import AgentSource link
Tags
README
Installation
pip install pydantic-ai-shields
Quick Start
from pydantic_ai import Agent
from pydantic_ai_shields import CostTracking, ToolGuard, InputGuard
agent = Agent(
"openai:gpt-4.1",
capabilities=[
CostTracking(budget_usd=5.0),
ToolGuard(blocked=["execute"], require_approval=["write_file"]),
InputGuard(guard=lambda prompt: "ignore all instructions" not in prompt.lower()),
],
)
result = await agent.run("Hello!")
Infrastructure Shields
| Class | Description |
|---|---|
CostTracking | Token/USD tracking with budget enforcement |
ToolGuard | Block tools or require approval |
InputGuard | Custom input validation (pluggable function) |
OutputGuard | Custom output validation (pluggable function) |
AsyncGuardrail | Concurrent guardrail + LLM execution |
License
MIT — see LICENSE
For agents
This page has a .md twin and JSON over the API.