NeMo Guardrails: free AI agent safety controls

NeMo Guardrails is a free, open-source library from NVIDIA that adds programmable safety and security controls to LLM and agentic applications, so a security engineer can decide what an AI agent is allowed to do before it does it. It checks inputs, outputs, retrieved content and tool calls against a policy you write, and it is the most practical way I have seen to study the standing theme of fully automated, agentic AI-driven cyber attacks from the defender’s side.
That theme is not theoretical. Our briefing on fully automated, AI-driven attacks explains how attacks that no longer need a human at the keyboard are moving from experiment to real intrusions, and the shadow-AI risk inside enterprises grows as staff wire agents into real data. Before an attacker points an agent at a target, defenders need the same class of control pointed at a system they own. The parallel agent fleets in Orca agent orchestration show what agent throughput looks like; NeMo Guardrails is the layer that governs it.
What NeMo Guardrails does
NeMo Guardrails is a Python library that sits between an application and the model. You declare a policy in configuration files that specify the rails, models and prompts to use, then run the library inside your application or deploy it as a server. The library works in two modes. In check mode your application calls the model and executes tools itself, and asks the library for a verdict at each decision point. In proxy mode you route model requests through the library, which applies input and output rails before anything reaches the model or returns to the caller.
The guardrail catalog is where the security value sits. It covers content safety, topic control, jailbreak detection, injection detection for code, SQL, template and cross-site scripting patterns, sensitive data and PII detection, fact-checking and hallucination checks, tool-call and tool-result validation, per-tool safety checks, and deterministic regex and CEL rules. For agents, the tool rails matter most: the library validates declared tool names and argument schemas before execution, and checks tool results before they go back to the model. That is the difference between an agent that can call any tool it likes and one that can only call the tools your policy allows, with arguments inside the bounds you set.
The licence
NeMo Guardrails is released under the Apache License 2.0, which you can read in the licence file on the repository. Apache 2.0 is permissive: it allows use, modification and distribution, including commercially, provided the copyright and licence notices are kept and modified files carry a notice. It also grants an express patent licence from contributors, which matters for security tooling used in production, and it provides no warranty.
Installing it on Linux
The official documentation lists Python 3.11, 3.12 or 3.13 and a modest machine: one CPU with 4 GB of RAM is enough for the library itself, and any external models can run separately. Start in a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install nemoguardrails
The package is on PyPI, so that is the whole install for the core library. Verify it without calling a model or needing an API key:
python -c "import nemoguardrails; print(nemoguardrails.__version__)"
nemoguardrails --help
Optional extras add features: cel for Common Expression Language rules, sdd for Presidio-based sensitive data detection, jailbreak for YARA-based heuristics, server for the Guardrails API server, and eval for policy evaluation. Add only what you need, for example pip install "nemoguardrails[cel]".
A concrete authorised lab use case
Run this only against a system you own or have written permission to test. A sensible first target is a lab AI service on an isolated network, the same kind of practice environment you build for Parrot OS and Kali Linux.
Start with the tool-call check, because it needs no model and no API key. The documentation’s quickstart defines a issue_refund tool with an amount argument and a CEL rule that blocks any call over 500. The library validates the argument schema and returns passed for 50 and blocked for 5000, and your application only executes the tool when the check passes. That pattern transfers directly to a security use: give a lab agent a small set of tools, write a policy that bounds each one, and watch the library refuse the calls that fall outside your rules. Then add an input rail for prompt injection and an output rail for sensitive data, and re-run the same lab traffic to see what changes.
Risks and limits
- Data leakage. Any content you send to a model or guardrail service can reach the provider behind it. The library sends anonymous usage telemetry that excludes prompts and credentials, and you can opt out with
NEMO_GUARDRAILS_NO_USAGE_STATS=1, but configured model and guardrail endpoints still receive what you send them. Keep customer data and production secrets out of prompts. - Prompt injection. A rail that reads untrusted content can itself be steered. Treat retrieved documents, tool output and model responses as untrusted input, and keep a human in the loop before anything is executed or committed.
- Hallucinated findings. A guardrail verdict is a model or rule output, not ground truth. Check each block or pass against the raw content before it reaches a report.
- Licence limits. Apache 2.0 permits reuse and commercial use with notice retention and patent grants, and provides no warranty. The library moves quickly, so pin the version you tested.
- What not to send it. No production credentials, customer data, real domain contents, or systems you are not authorised to test.
Use NeMo Guardrails only on systems you own or have written permission to test. Using it against systems you do not have permission to test is unlawful.







