NVIDIA-NeMo/Guardrails
Python policy layer for checking LLM traffic and agent tool calls
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
NeMo Guardrails is a policy layer, not an agent runtime. Configuration selects rails, models, and prompts. In check mode, the application owns model generation and tool execution, calling check_async() or POST /v1/checks at the points where it needs a verdict. Tool checks through check_async() require the IORails engine and an explicit RailType.TOOL_CALL or RailType.TOOL_RESULT. The harness must act on the verdict before executing a tool or handing its result back to the model.
In proxy mode, generate_async(), stream_async(), or the server's /v1/chat/completions path wraps model generation with input and output checks. The separate Gateway targets existing model APIs, while the hooks server integrates with coding agents. The Python package declares aiohttp and httpx for HTTP, jsonschema for schema validation, and fastembed and onnxruntime for embedding and inference dependencies. Their presence does not imply that every policy performs local inference.
Key Capabilities & Differentiators
Tool rails validate declared tool names, argument schemas, and the structure and linkage of results. Per-tool policy can add regex or CEL rules and LLM-judged safety checks. The catalog also covers content and topic controls, jailbreak detection, PII detection or masking, and evidence-grounding checks for retrieval-augmented generation. Detector choices include local rules, Nemotron safety models such as Nemotron 3.5 Content Safety, and hosted or third-party services. Check mode avoids main-model generation, but model-backed checks still invoke their configured detector.
In a non-streaming server benchmark on an Apple M4, with 5,000 ms of fixed mock model latency subtracted, IORails added 13 ms p50 and 126 ms p99 at concurrency 64, versus 93 ms and 2,094 ms for LLMRails. At concurrency 128, IORails added 17 ms p50 but 2,880 ms p99. That gap makes tail latency a deployment concern even when the median looks stable. These figures include HTTP calls to mock endpoints and do not predict latency with real detectors.
Trade-offs & Limitations
Compared with inline validators, NeMo Guardrails lets teams share policy across applications and combine deterministic rules with model judgments, at the cost of configuration and more enforcement points to wire up and test. Compared with provider moderation, it gives the application control over where to check tool arguments, tool results, and retrieved content. It does not replace authorization or execution isolation. Keep hard constraints in deterministic checks and budget separately for the latency and cost of model-backed checks.
Integration choice affects what can be enforced. The Gateway's built-in profiles do not support tool content, and /v1/responses requires store: false. In stream_async(), the default stream_first: true releases chunks before checking; set it to false when content must be checked before delivery. Define how the application responds to errors and overload, especially before executing side-effecting tools. The Apache-2.0 package license does not override the terms or data-handling practices of configured services.
Hardware & Deployment Guide
The package requires Python 3.11–3.13 and installs as nemoguardrails; CEL is an optional extra. The Dockerfile starts from python:3.12-slim, installs Git, GCC, and G++, and copies a digest-pinned uv build. Embed the SDK for in-process checks, self-host the FastAPI service for shared verdicts, or put the Gateway in front of supported model API traffic. A local, model-free policy can run without an inference endpoint; local detector sizing depends on the selected model and concurrency. A self-hosted service can still send payloads to configured external detectors.
Version 0.24.0 expanded IORails coverage to 59 of 67 action-backed input and output surfaces; 0.24.1 added an overload response for IORails. Version 0.25.0 adds tool-call and tool-result checks, the hooks server, and the Gateway. It also deprecates LLMRails, with removal planned no earlier than 0.27.0. Use Guardrails for new integrations and verify engine and integration support for each required rail before migrating.
check_async() returns policy decisions at the call and result stages.POST /v1/checks, or connect Claude Code, Codex, and NeMo Relay through the hooks server./v1/chat/completions and /v1/responses; built-in profiles do not support tool content, and Responses requests require store: false.stream_async() delivers chunks before checking by default; set rails.output.streaming.stream_first: false to check before delivery.Teams that own their agent loop and need reusable policy across model messages, tool calls, and tool results, with a choice of in-process checks or a shared service.
A few inline validators or a provider moderation endpoint cover your needs, or you need a sandbox or authorization system that independently prevents tool execution.
Quick Start & Installation
pip install nemoguardrailsComparison vs. Top Agents & Frameworks Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| Guardrails ★ | 7.6k | +44 | Python | — | Python policy layer for checking LLM traffic and agent tool calls |
| browser-use | 122.7k | +477 | Python | MIT | Python REPL and CDP for adaptive browser automation |
| langgraph | 45.8k | +293 | Python | MIT | Python graph orchestration for stateful, resumable agents and workflows |
| langchain | 150.4k | +290 | Python | MIT | Modular Python framework for building agents across model providers |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/NVIDIA-NeMo/Guardrails.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about Guardrails
How do I add tool checks without replacing my agent loop?
check_async() with the IORails engine and RailType.TOOL_CALL before execution, supplying the declared tool schemas. Check the result with RailType.TOOL_RESULT before returning it to the model. The harness still executes tools and must decide how to handle blocked, modified, or failed checks. For a new integration, use Guardrails rather than the deprecated LLMRails.Do I need a GPU, and how should I size the service?
Can I self-host NeMo Guardrails for commercial use?
NEMO_GUARDRAILS_NO_USAGE_STATS=1 disables library usage telemetry, not outbound calls to configured endpoints. NVIDIA Build is evaluation-only and must not receive confidential information or personal data.When is NeMo Guardrails preferable to inline validators or provider moderation?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy