- PII detection and redaction
- Prompt injection defense
- Jailbreak defense
- Data leakage prevention
- NSFW content filtering
Agno built-in Guardrails
Agno provides some built-in guardrails you can use out of the box with your Agents:- PII Detection Guardrail: detect PII (Personally Identifiable Information).
- Prompt Injection Guardrail: detect and stop prompt injection attemps.
- OpenAI Moderation Guardrail: detect content that violates OpenAI’s content policy.
pre_hooks
parameter. For example, to use the PII Detection Guardrail:
Custom Guardrails
You can create custom guardrails by extending the BaseGuardrail class. This is useful if you need to perform any check or transformation not handled by the built-in guardrails, or just to implement your own validation logic. You will need to implement thecheck
and async_check
methods to perform your validation and raise exceptions when detecting undesired content.
Agno automatically uses the sync or async version of the guardrail based on whether you are running the agent with
.run()
or .arun()
.