# Repository Briefing: NVIDIA-NeMo/Guardrails
> Source: https://repoforai.com/repo/NVIDIA-NeMo/Guardrails (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/NVIDIA-NeMo/Guardrails
- **Official Docs / Website**: https://docs.nvidia.com/nemo/guardrails/latest/index.html
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: See repository
- **Engineering Health**: A (81/100 · Maintenance 35/35 · Adoption 20/25 · Releases 20/20 · License 6/20)
- **Latest Release**: v0.25.0 (2026-11-19) — https://github.com/NVIDIA-NeMo/Guardrails/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, Self-Hosted, API
- **Momentum**: 7,635 ★ total (+4 24h / +44 7d) · 928 forks
- **Topics**: `agents`, `guardrails`, `python`, `safety`, `generative-ai`, `llms`, `nvidia`, `llm-safety`, `llm-security`
- **When to Use**: Best for: 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. Skip if: 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.

## Overview
```text
### Architecture & 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.
```

## Key Capabilities
```text
- Enforcement boundary: The application executes tools; `check_async()` returns policy decisions at the call and result stages.
- Deterministic policy: The optional CEL extra supports model-free per-tool rules, such as blocking refunds above $500 after schema validation.
- Integration surfaces: Embed the Python SDK, share verdicts through `POST /v1/checks`, or connect Claude Code, Codex, and NeMo Relay through the hooks server.
- Proxy compatibility: The Gateway serves `/v1/chat/completions` and `/v1/responses`; built-in profiles do not support tool content, and Responses requests require `store: false`.
- Streaming behavior: `stream_async()` delivers chunks before checking by default; set `rails.output.streaming.stream_first: false` to check before delivery.
- Tail latency: In the mocked Apple M4 benchmark, IORails p50/p99 added latency was 13/126 ms at concurrency 64 and 17/2,880 ms at 128.
```

## Quick Start / Clone
```bash
pip install nemoguardrails
```
