> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrails

> Examples for input/output safety checks and policy enforcement.

| Example                                                               | Description                                                                                                             |
| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [Custom Guardrail](/examples/agents/guardrails/custom-guardrail)      | Subclass BaseGuardrail and raise InputCheckError to block security-abuse prompts as a pre-hook.                         |
| [OpenAI Moderation](/examples/agents/guardrails/openai-moderation)    | Block flagged input with OpenAIModerationGuardrail as a pre-hook, including custom category lists and image moderation. |
| [Output Guardrail](/examples/agents/guardrails/output-guardrail)      | Reject responses under 20 characters with a post-hook that raises OutputCheckError.                                     |
| [PII Detection](/examples/agents/guardrails/pii-detection)            | Block SSNs, credit cards, emails, and phone numbers with PIIDetectionGuardrail, or mask them with mask\_pii=True.       |
| [Prompt Injection](/examples/agents/guardrails/prompt-injection)      | Block prompt injection and jailbreak attempts with PromptInjectionGuardrail as a pre-hook.                              |
| [Mixed Hooks and Guardrails](/examples/agents/guardrails/mixed-hooks) | Combine a logging pre-hook with PIIDetectionGuardrail; blocked runs return RunStatus.error instead of raising.          |
