skillfed

nemoguardrails

NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.

nemoguardrails v0.23.0 407.2K downloads/30d#6,888 on PyPI6,951
Permissive license LICENSE.md Active released

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 nemoguardrails

uv

uv add nemoguardrails

poetry

poetry add nemoguardrails

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseLicense :: Other/Proprietary LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

llm safety guardrailsprompt injection protectionconversational ai safetyllm output moderationjailbreak preventionrag safety layerllm behavior control
llm-safetyconversational-aiprompt-engineering

More Artificial Intelligence packages