nemoguardrails
NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
What it is and what it does
NeMo Guardrails is an NVIDIA open-source library that inserts a programmable control layer between your application code and an LLM. It lets you define rules—called rails—that shape how the LLM responds: rejecting unsafe inputs, preventing jailbreaks and prompt injections, enforcing topic boundaries, masking sensitive data, and steering conversations along predefined paths. The library supports five rail types (input, dialog, retrieval, execution, output) and works with multiple LLM providers.
You configure guardrails via YAML and Python files in a standard folder structure, then instantiate an LLMRails object and call generate() or generate_async() instead of the LLM directly. The API mirrors OpenAI's Chat Completions format, so integration requires minimal code changes. It's async-first internally but exposes both sync and async methods, and includes built-in protections against common LLM vulnerabilities like jailbreaks and hallucinations.
Use it for:
- Add fact-checking and output moderation to retrieval-augmented generation (RAG) systems
- Build domain-specific chatbots that stay on topic and follow predefined conversation flows
- Protect custom LLM endpoints from jailbreaks and prompt injection attacks
- Mask sensitive data (PII, credentials) in user input before the LLM sees it
- Enforce authentication and support workflows in conversational applications
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds programmable guardrails to LLM-based conversational applications to control output behavior, prevent unsafe responses, and enforce structured dialog flows.
Yes, if you are building LLM-based conversational applications and need safety controls. The library is actively maintained, has no known vulnerabilities, supports current Python versions, and low install friction. The 18 dependencies are standard ecosystem packages. Permissive licensing allows commercial use. Main consideration: evaluate whether the guardrails configuration overhead and async-first design fit your application architecture.
Install
nemoguardrails on PyPI
pip
pip install nemoguardrailsuv
uv add nemoguardrailspoetry
poetry add nemoguardrailsInstalling nemoguardrails
Before you install
Low install friction with a pure-Python wheel. Active maintenance with recent release (44 days old) and 6951 repository stars. Requires Python 3.10–3.13; 18 runtime dependencies including aiohttp, pydantic, and onnxruntime add moderate weight but are standard ecosystem packages.
License in practice
Permissive license (Apache-2.0 primary with Other/Proprietary noted in classifiers). No restrictions on commercial use or modification; review LICENSE.md for any dual-licensing details if proprietary clauses apply.
Quickstart
from nemoguardrails import LLMRails, RailsConfig
config = RailsConfig.from_path("PATH/TO/CONFIG")
rails = LLMRails(config)
completion = rails.generate(
messages=[{"role": "user", "content": "Hello world!"}]
)
Requires Python 3.10, 3.11, 3.12, or 3.13. Guardrails configuration folder with config.yml, config.py, and actions.py must be provided.
Verify before relying
- Performance overhead of guardrails layer relative to direct LLM calls
- Compatibility with specific LLM providers beyond those listed in documentation
- Memory footprint with all 18 runtime dependencies loaded
Package facts
| License | LICENSE.md (permissive) |
| Python support | supports the current Python release (<3.14,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 18 — aiohttp, aiohttp-retry, dataclasses-json, fastembed, httpx, jinja2, jsonschema, lark, nest-asyncio, onnxruntime, pandas, prompt-toolkit, protobuf, pydantic, pyyaml, rich, simpleeval, typer |
| Maintenance | actively maintained — 44 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 407,191/month — #6,888 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nemoguardrails-0.23.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
datarobot-moderationsEnforces content moderation on LLM prompts and…
unclear · top 15,000 on PyPI
openai-guardrailsAdds configurable safety and compliance…
permissive · top 15,000 on PyPI
nemo-toolkitnemo-toolkit provides a PyTorch framework for…
permissive · top 5,000 on PyPI
nemo-relaynemo-relay wraps a shared Rust runtime to give…
permissive · top 15,000 on PyPI
guardrails-aiGuardrails is a Python framework that validates…
permissive · top 15,000 on PyPI
nvidia-nat-coreNVIDIA NeMo Agent Toolkit is a…
permissive · top 15,000 on PyPI
data-designer-engineExecution engine for the NeMo Data Designer…
permissive · top 15,000 on PyPI
guardrails-ai-typesProvides type definitions and data structures…
permissive · top 15,000 on PyPI
nemo-gymNeMo Gym provides infrastructure for building,…
permissive · top 5,000 on PyPI
guardrails-hub-typesProvides internal data structure definitions…
permissive · top 15,000 on PyPI