Home/AI Agents/pydantic-ai-shields
pydantic-ai-shields logo

pydantic-ai-shields

Enrichment pending
vstorm-co/pydantic-ai-shields

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 A

GraphCanon updated today · GitHub synced today

81 stars11 forksLast push 1w Python MIT

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
PyPI

Similar 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.

Python runtimePython

Source: README excerpt (regex_v1, Jul 15, 2026)

```python from pydantic_ai import Agent
Source 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

ClassDescription
CostTrackingToken/USD tracking with budget enforcement
ToolGuardBlock tools or require approval
InputGuardCustom input validation (pluggable function)
OutputGuardCustom output validation (pluggable function)
AsyncGuardrailConcurrent guardrail + LLM execution

License

MIT — see LICENSE


For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.