# NVIDIA NeMo Guardrails

> Open-source Python library for adding programmable guardrails to LLM-based applications, blocking or altering unsafe, off-topic, or policy-violating inputs and outputs.

NVIDIA NeMo Guardrails is an open-source Python package from NVIDIA for adding programmable guardrails between application code and a large language model. It checks, alters, or blocks user inputs and model responses that are unsafe, off-topic, malicious, or policy-violating. The documentation lists v0.24.1 as the latest release, and the library is available on PyPI and GitHub.

## What It Is

NeMo Guardrails is a toolkit for controlling LLM-based conversational applications without rewriting the application or its model backend. Developers define a guardrails configuration made of YAML settings, Colang flows, and optional Python actions. Calls then go through the guardrails layer instead of directly to the LLM.

Guardrails run at several stages of an interaction: input rails, dialog rails, retrieval rails, execution rails (for tool and action calls), and output rails. A configuration with no rails simply forwards requests to the LLM.

## How the Workflow Operates

A configuration folder typically holds a config.yml (models, active rails, settings), optional config.py for custom initialization, actions.py for custom Python actions, and .co files containing Colang definitions. Colang is a Python-like modeling language for dialogue flows; versions 1.0 and 2.0 are supported.

Applications can load the configuration with the Python SDK, creating an LLMRails instance and calling generate or generate_async with OpenAI Chat Completions-style messages. Alternatively, the nemoguardrails CLI can start a guardrails server that exposes endpoints such as /v1/chat/completions. The CLI also offers chat, evaluate, and actions-server commands.

## Built-in Protections and Integrations

The documentation lists guardrails for content safety, jailbreak and prompt-injection detection, topic control, PII detection and masking, fact-checking, hallucination detection, and agentic tool-call validation. These can use LLM self-checks, NVIDIA safety models, community models, or third-party services such as ActiveFence, Cisco AI Defense, Llama Guard, Presidio, and Private AI. LangChain and LangGraph integration is opt-in.

## Deployment and Evaluation

Configurations are described as portable between the library and the NVIDIA NeMo Guardrails microservice, a container image deployed on Kubernetes with Helm. Docker deployment, tracing and metrics via OpenTelemetry, an evaluation tool, and LLM vulnerability scanning are also documented. The library collects anonymous telemetry, which can be disabled through environment variables.

## Features
- Input, dialog, retrieval, execution, and output rails
- Colang 1.0 and 2.0 flow modeling language
- YAML-based guardrails configuration
- Content safety and moderation
- Jailbreak and prompt injection detection
- Topic control
- PII detection and masking
- Fact-checking and hallucination detection
- Tool call and agentic security validation
- Custom Python actions
- Python SDK with sync and async APIs
- Guardrails server with chat completions endpoint
- CLI for chat, server, evaluation, and actions server
- Tracing and metrics with OpenTelemetry
- Evaluation tooling and LLM vulnerability scanning
- Docker deployment

## Integrations
LangChain, LangGraph, OpenAI, ActiveFence, Cisco AI Defense, Llama Guard, Fiddler Guardrails, Microsoft Presidio, Private AI, Polygraf, AutoAlign, GuardrailsAI, Prompt Security, Pangea AI Guard, NVIDIA NemoGuard, NVIDIA NIM, OpenTelemetry, Patronus, AlignScore, CrowdStrike AIDR, Trend Micro, Cleanlab, Clavata, F5 AI Guardrails, GCP Text Moderation

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
0.24.1

## Links
- Website: https://docs.nvidia.com/nemo/guardrails/latest/index.html
- Documentation: https://docs.nvidia.com/nemo/guardrails/latest/index.html
- Repository: https://github.com/NVIDIA-NeMo/Guardrails
- EveryDev.ai: https://www.everydev.ai/tools/nvidia-nemo-guardrails
