Full-Code · Orchestration Frameworksactive

NVIDIA NeMo Guardrails

Type: full-code · Vendor: NVIDIA · Language: Python · License: Apache-2.0 · Status: active · Status in practice: mature · First released: 2023

Links: homepage docs repo

NeMo Guardrails adds programmable rails around an LLM-based conversational application so that inputs and outputs can be checked, rewritten, or rejected outside the model's own discretion.

Description. NeMo Guardrails is an open-source Python toolkit from NVIDIA for adding rule-based controls to LLM applications. Developers express rails in Colang, a flow language, and the runtime applies them at fixed stages: input rails on the incoming user message, dialog rails that steer the conversation, and output rails on the generated response. Each rail can reject, alter, or rephrase the text it inspects, so safety and topic checks run as deterministic code around the model rather than as model behavior.

Agent loop shape. A wrap-around guard pipeline: user input passes through input rails, then dialog rails select a flow and the LLM generates a response, then output rails inspect and may reject or rewrite that response before it returns to the user. Rails are deterministic Colang subflows that bracket each model call rather than a free agent loop.

Primary use cases

  • topic and scope control for domain-specific assistants
  • input sanitization and PII masking on user messages
  • output filtering and response rewriting
  • refusal of disallowed subjects
  • enforcing predefined conversational flows

Key concepts

  • Colang deterministic-control-flow-not-prompt (docs)A modeling language for conversational flows in which developers write rails and dialog flows as subflows that the runtime executes deterministically around the LLM.
  • Input / dialog / output rails input-output-guardrails (docs)The three rail stages: input rails check the user message before the model, dialog rails steer which flow runs, and output rails check the generated response before it returns to the user.
  • Self-check rails prompt-injection-defense (docs)Built-in rails that issue a separate LLM query to moderate input or output, including jailbreak/prompt-injection detection, before content is accepted.

Patterns this full-code implements —

Neighbourhood

Click any neighbour to follow the lineage. Scroll to zoom, drag to pan.