{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/11"}],"enrichment":{"capability":"Pydantic AI Shields provides guardrail capabilities for Pydantic AI agents, including cost tracking, prompt injection detection, PII detection, secret redaction, tool permissions, and async guardrails.","skillfed_tags":["guardrails","cost-control","safety-checks"],"use_cases":["Enforce per-agent or per-run spending limits and track cumulative token costs across multiple LLM calls.","Prevent agents from calling dangerous or sensitive tools without user approval or hide them entirely from the model.","Detect and block prompt injection attempts, jailbreaks, and role-play exploits before they reach the LLM.","Scan user input for PII (email, phone, SSN, credit card, IP) and block or log detections without stopping execution.","Redact API keys, tokens, and credentials from model output to prevent accidental secret leakage.","Run safety checks concurrently with LLM inference and cancel the LLM call if a guard fails, reducing wasted API costs."],"what_it_does":"Pydantic AI Shields is a library of ready-to-use guardrail capabilities that integrate directly into Pydantic AI agents without middleware wrappers. It provides infrastructure shields (cost tracking with budget enforcement, tool access control, custom input/output validation, and concurrent guardrail execution) and content shields (prompt injection detection across 6 categories, PII detection for email/phone/SSN/credit card/IP, secret redaction for API keys and tokens, blocked keyword filtering, and LLM refusal blocking).\n\nYou compose shields by passing them to an agent's `capabilities` parameter. Each shield raises a specific exception (InputBlocked, OutputBlocked, ToolBlocked, BudgetExceededError) when its guard condition fails. CostTracking auto-detects pricing from genai-prices; PromptInjection supports three sensitivity levels; PiiDetector and SecretRedaction use regex patterns; AsyncGuardrail can cancel LLM calls if guards fail first, saving cost. The library targets Pydantic AI agents and depends on pydantic-ai-slim and pydantic.","worth_installing":"Yes, if you are building Pydantic AI agents and need safety, cost control, or tool permission guardrails. The library is actively maintained, has low install friction, and composes naturally into agent capabilities. MIT license has no restrictions. Start with it if you need any of its built-in shields; the modular design lets you add only what you need. No known vulnerabilities."},"id":"pydantic-ai-shields","links":{"html":"https://skillfed.io/packages/pydantic-ai-shields","md":"https://skillfed.io/packages/pydantic-ai-shields.md","pypi":"https://pypi.org/project/pydantic-ai-shields/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-06-01","license_spdx":"MIT","license_treatment":"permissive","name":"pydantic-ai-shields","python_support":"supports_current","summary":"Guardrail capabilities for Pydantic AI \u2014 cost tracking, tool permissions, input/output guards"},"popularity":{"monthly_downloads":536314,"position":6127,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.3.4"}
