Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add adriannoes/awesome-agentic-ai --skill implementing-llm-guardrails-for-securitygit clone --depth 1 https://github.com/adriannoes/awesome-agentic-aiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security)<a href="https://agentmods.dev/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security"><img src="https://agentmods.dev/badge/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security"><img src="https://agentmods.dev/badge/skills/adriannoes/awesome-agentic-ai/implementing-llm-guardrails-for-security.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00143 | $0.02067 |
| Opus 5.5 | $0.00057 | $0.00827 |
| Sonnet 5.5 | $0.00029 | $0.00413 |
| Haiku 4.5 | $0.00014 | $0.00207 |
Grade A, and why
implementing-llm-guardrails-for-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
92% identical to implementing-llm-guardrails-for-security — 53 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Implementing LLM Guardrails for Security
When to Use
- Deploying a new LLM-powered application that processes user input and needs input/output safety controls
- Adding content policy enforcement to an existing chatbot or AI agent to comply with organizational policies
- Implementing PII detection and redaction in LLM pipelines handling sensitive customer data
- Building topic-restricted AI assistants that must refuse off-topic or disallowed queries
- Validating that LLM responses conform to expected schemas before they reach downstream systems or users
- Protecting RAG pipelines from indirect prompt injection in retrieved documents
Do not use as a replacement for proper authentication, authorization, and network security controls. Guardrails are a defense-in-depth layer, not a perimeter defense. Not suitable for real-time content moderation of user-to-user communication without LLM involvement.
Prerequisites
- Python 3.10+ with pip for installing guardrail dependencies
- An OpenAI API key or local LLM endpoint for NeMo Guardrails self-check rails (set as
OPENAI_API_KEYenvironment variable) - The
nemoguardrailspackage for Colang-based guardrail definitions - The
guardrails-aipackage for structured output validation (optional, for JSON schema enforcement) - Familiarity with YAML configuration and basic Colang 2.0 syntax for defining rail flows
Workflow
Step 1: Install Guardrail Frameworks
Install the required Python packages:
# Core NeMo Guardrails library
pip install nemoguardrails
# Guardrails AI for structured output validation (optional)
pip install guardrails-ai
# Additional dependencies for PII detection and content analysis
pip install presidio-analyzer presidio-anonymizer spacy
python -m spacy download en_core_web_lg
Step 2: Run the Guardrails Security Agent
The agent implements a complete input/output validation pipeline:
# Analyze a single input through all guardrail layers
python agent.py --input "Tell me how to hack into a system"
# Analyze input with a custom content policy file
python agent.py --input "Some text" --policy policy.json
# Scan a file of prompts through the guardrail pipeline
python agent.py --file prompts.txt --mode full
# Input-only validation (no LLM call, just check if input is safe)
python agent.py --input "Some text" --mode input-only
# Output validation mode (validate a pre-generated LLM response)
python agent.py --input "User question" --response "LLM response to validate" --mode output-only
# PII detection and redaction mode
python agent.py --input "My SSN is 123-45-6789 and email [email protected]" --mode pii
# JSON output for pipeline integration
python agent.py --file prompts.txt --output json
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 236 lines · 143 tokens per session scan A 1cf02a88ea56
implementing-llm-guardrails-for-security is a skill published in the GitHub repository adriannoes/awesome-agentic-ai (108 stars, last pushed 2d ago), licensed MIT. It adds 143 tokens to every session and 2,067 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 92% identical to implementing-llm-guardrails-for-security, differing in 53 lines, and is treated as a copy.
implementing-llm-guardrails-for-security compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| implementing-llm-guardrails-for-securityadriannoes/awesome-agentic-ai | Skill | 108 | 2d ago | MIT | A | 143 | Claude Code, Codex |
| implementing-llm-guardrails-for-securityxalgorix/xalgorix | Skill | 1.5k | yesterday | Apache-2.0 | A | 143 | Claude Code, Codex |
| llamaguarddavila7/claude-code-templates | Skill | 34k | today | MIT | A | 74 | Claude Code, Codex |
| geminiGoogleCloudPlatform/vertex-ai-samples | Skill | 802 | 6d ago | Apache-2.0 | A | 0 | Claude Code, Codex |
| firebase-aievanca/flutter-ai-rules | Skill | 676 | 18d ago | MIT | A | 30 | Claude Code |
| coding-agents-prompt-authoringgriddynamics/rosetta | Skill | 382 | 5d ago | Apache-2.0 | A | 39 | Claude Code |
| best-practicesMoizIbnYousaf/Ai-Agent-Skills | Skill | 1.2k | 2mo ago | MIT | A | 35 | Claude Code, Codex |