Repolode
NVIDIA-NeMo

NVIDIA-NeMo/Guardrails

An open-source Python toolkit for adding programmable guardrails to LLM-based conversational applications, controlling topics, dialog paths and outputs.

Stars
7,333
Forks
876
Open issues
270
Last commit
6 hours ago

What is it?

NeMo Guardrails is a toolkit from NVIDIA for placing programmable guardrails between application code and a large language model. Guardrails control what the model will discuss, how it responds to particular requests, which dialog paths it follows, and what style or structure its output takes, such as extracting structured data.

Guardrails are defined in a configuration folder. A config.yml file selects the LLM and active rails, and Colang files describe dialog flows and rules. Rails can run on user input, retrieved chunks in RAG pipelines, tool calls and results, and the model's output, and can reject or rewrite content at each stage. The library ships built-in guardrails for jailbreak and injection detection, self-checking moderation and fact-checking, and sensitive data masking, and it integrates with several third-party moderation and safety services.

The library is async-first and offers both sync and async methods, with a generate interface modeled on the OpenAI Chat Completions format. It can also run as an HTTP server with a chat completions endpoint, through a CLI with chat, server and evaluate commands, or inside LangChain chains when that integration is enabled.

Key features

  • 01Programmable input, dialog, retrieval, execution and output rails.
  • 02Colang 1.0 and 2.0 modeling languages for defining dialog flows.
  • 03Built-in guardrails for jailbreak detection, moderation, fact-checking and sensitive data masking.
  • 04Async-first Python API with generate and generate_async methods.
  • 05HTTP server with a chat completions endpoint, plus a CLI and Docker image.
  • 06Optional LangChain integration and an evaluation tool for topical rails and hallucination.

Use cases

  • Keeping a customer support chatbot on topic and following a fixed conversation flow.
  • Adding moderation and fact-checking to a RAG question-answering system.
  • Masking personal data in user input before it reaches an LLM.
  • Placing a safety layer in front of a custom LLM endpoint serving external users.

Quick start

  1. 1

    Install the library with pip

    pip install nemoguardrails
  2. 2

    Load a guardrails configuration and create an LLMRails instance (Python API)

  3. 3

    Call rails.generate with your messages

Things to know

  • Requires an LLM backend and its API credentials to run a configuration, which you must supply yourself.
  • Colang 1.0 is the default and Colang 2.0 is a separate syntax, so you must choose which one your configuration uses.

Topics

FAQ

What is Guardrails?
An open-source Python toolkit for adding programmable guardrails to LLM-based conversational applications, controlling topics, dialog paths and outputs. NeMo Guardrails is a toolkit from NVIDIA for placing programmable guardrails between application code and a large language model. Guardrails control what the model will discuss, how it responds to particular requests, which dialog paths it follows, and what style or structure its output takes, such as extracting structured data.
Is Guardrails free to use? What license does it have?
Guardrails is open source under the Other license. Check the license terms before using it in commercial products.
Is Guardrails still maintained?
Actively maintained. The last commit to Guardrails was on Oct 20, 2026.
What can I use Guardrails for?
Keeping a customer support chatbot on topic and following a fixed conversation flow. Adding moderation and fact-checking to a RAG question-answering system. Masking personal data in user input before it reaches an LLM. Placing a safety layer in front of a custom LLM endpoint serving external users.
How do I install Guardrails?
Install the library with pip: pip install nemoguardrails Load a guardrails configuration and create an LLMRails instance (Python API) Call rails.generate with your messages
Where can I get Guardrails?
The source code and installation instructions are on GitHub: https://github.com/NVIDIA-NeMo/Guardrails

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects