agno-guardrails

Configures mandatory input guardrails for Agno agents including PII, prompt injection, moderation, and scope checks.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/allankltsn/setup_kiro --skill agno-guardrails-allankltsn
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: agno-guardrails
Source: https://github.com/allankltsn/setup_kiro/tree/main/.kiro/skills/agno-guardrails
Command: npx skills add https://github.com/allankltsn/setup_kiro --skill agno-guardrails-allankltsn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires agno, boto3.

What problem does it solve? Building an Agno agent without input validation leaves it exposed to prompt injection, PII leakage, off-topic requests, and policy violations. This Skill enforces a non-negotiable rule: every agent must run with at least one guardrail configured as a pre-hook, and it provides the exact patterns to do so. ## Core Features & Use Cases - Mandatory baseline stack: Wires PII Detection, Prompt Injection, and OpenAI Moderation guardrails into every agent via pre_hooks, ordered from cheap deterministic checks to external provider calls. - Custom scope guardrail: Provides a ScopeGuardrail extending BaseGuardrail with both check and async_check, blocking out-of-domain messages with InputCheckError and safe refusal messages. - Optional AWS Bedrock Guardrails: Adds a Bedrock ApplyGuardrail integration enabled only via environment variables, with fail-fast validation when enabled without a guardrail ID. - Use Case: When creating or reviewing any Agno agent, apply this Skill to assemble build_guardrails() in the composition root so the agent can never start with an empty guardrail list. ## Quick Start Ask the AI to add the mandatory guardrail stack with a custom scope guardrail to your Agno agent following the agno-guardrails skill.

Frequently Asked Questions about agno-guardrails

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add guardrails to an Agno agent?▼

Pass guardrails via the pre_hooks parameter when constructing the Agent or Team. Guardrails run after session loading and before context assembly, raising InputCheckError to block execution, which run() captures as RunStatus.error.

What guardrails should every Agno agent have?▼

The recommended baseline is PII Detection, Prompt Injection, OpenAI Moderation, plus a custom scope guardrail blocking out-of-domain messages. Order cheap deterministic checks first and external provider calls like OpenAI Moderation last to fail fast and reduce cost.

How do I create a custom guardrail in Agno?▼

Extend BaseGuardrail and implement both check (sync) and async_check (async), since Agno picks the version based on run() or arun(). Raise InputCheckError with CheckTrigger.INPUT_NOT_ALLOWED and keep refusal messages neutral without exposing internal details.

Can I use AWS Bedrock Guardrails with Agno agents?▼

Yes, via a custom guardrail calling the Bedrock ApplyGuardrail API through boto3, converting GUARDRAIL_INTERVENED responses into InputCheckError. Enable it only through environment variables and fail fast if enabled without a guardrail ID configured.

What are the limitations of Agno guardrails?▼

Guardrails only check the input of the current run; they do not inspect conversation history, dependencies, retrieved RAG documents, or media automatically. They do not guarantee total safety, so choose checks per your application policy and monitor false positive and negative rates.