← All sessions, cheat sheets & labs
Week 4 · Field guide · Guardrails

NeMo Guardrails

NVIDIA's programmable guardrails toolkit: you declare, in config, what the model may and may not do around each call.

guardrailsopen sourcePythonNVIDIA

What it is

Five rail types, declared not coded.

NeMo Guardrails is NVIDIA's open-source toolkit for wrapping an LLM in programmable rails. It defines five rail types that fire at different points around a call: input rails screen what the user sends, output rails screen what the model returns, dialog rails steer the conversation along allowed paths, retrieval rails filter what RAG pulls in, and execution rails guard tool and action calls. You configure them in YAML and a small modelling language called Colang, and its built-in self-check input and output flows use an LLM as a judge to enforce topic bans and content policies.

The one job

Declare, in config, the model's boundaries.

Instead of scattering if-statements through your code, you state the policy once: these topics are off-limits, this input pattern is refused, this output shape is required. The rails become an auditable artifact you can review, not logic buried in a handler.

Reach for it when

Skip it when

The principle it teaches

Course principle

Defense in depth at the boundary. NeMo is Week 4's guardrail layer made explicit: the policy is declared in config and enforced around every call, rather than hand-coded and re-derived at each site.

Where it fits your labs

This is a Week 4 tool. When Lab 4 asks you to put real rails around the agent, NeMo is the option that lets you write the policy as config and cover input, output, dialog, retrieval, and execution in one place.

Use in
Lab 4, as the declarative guardrail layer around the agent.
week 4
Pairs with
Lakera or Llama Guard when you want dedicated injection detection alongside the broader rails.