NeMo Guardrails
v0.24.0 open-sourceNeMo Guardrails is a framework that adds safety constraints and moderation to large language models to prevent harmful outputs.
curl -s http://localhost:8000/v1/health
curl -s -X POST http://localhost:8000/v1/checks \
-H 'Content-Type: application/json' \
-d '{"config_id": "my-guardrails-config", "messages": [{"role": "assistant", "content": "Here is the answer."}]}' Summary
NeMo Guardrails is an open-source Python library, licensed under Apache 2.0, that adds programmable guardrails to LLM-based conversational applications to control outputs and block unsafe behavior. It's imported directly into an application's code, though it can also run as a standalone HTTP server exposing an OpenAI-compatible endpoint for checking inputs or outputs without generating a model response. It's built for developers building LLM applications who need to validate tool calls, screen retrieved content for context bloat, or detect and mask PII, using either local Hugging Face classifiers or integrations like Polygraf, rather than for security teams auditing systems after the fact. It sits in the LLM runtime-protection category, alongside the broader set of guardrail and content-filtering libraries developers reach for when wiring safety checks into a chat pipeline.
NeMo Guardrails is a framework that adds safety constraints and moderation to large language models to prevent harmful outputs.
What NeMo Guardrails answers
Can it validate tool calls before they execute, not just chat text?
streaming and non-streaming rails inspect both model-emitted tool calls and the results returned by the application, so a bad call can be caught before or after it runs
What does checking a single input or output cost me if I don't need a full chat turn?
a standalone endpoint runs the configured rails and returns whether the content passed, was modified, or was blocked, without spending a call generating a response
Do I need a GPU or an external service to run classifier-based checks?
the input, output, and retrieval classifiers run locally on Transformers, vLLM, KServe, or FMS, so screening works without a hosted dependency
Will upgrading break my existing environment?
it now requires a newer Pydantic line, so anything pinned to the older major version has to be upgraded first
How much does adding this library add to my deployment size?
the packaged distribution dropped to roughly a tenth of its previous size by dropping examples and development files
Does it help with prompt-stuffing or bloated retrieval context, or only unsafe content?
separate rails flag oversized, repetitive, low-entropy, or padded text coming from input or retrieval, which is a distinct check from safety filtering
Examples
Command line
No option matches that search.
| option | found in | since | description |
|---|
No option matches that search.
Values are placeholders taken from each option’s declared default. Nothing is executed here — the output shown is a recording of a run that already happened.
Release history
- v0.24.0
NeMo Guardrails v0.24.0 adds RailOutcome, rail manifests, F5 integration, health endpoints, and expands IORails to 59 built-in rails.
└──▷ GET THIS VERSION$ git clone --branch v0.24.0 https://github.com/NVIDIA-NeMo/Guardrails.git # already have the repo? check out this version: $ git checkout v0.24.0
└──▷ TRY ITPoll the new health endpoint to verify a running Guardrails server is ready before routing traffic.$ curl -s http://localhost:8000/v1/health
Run output-rail checks against a server-loaded config by supplyingconfig_idto/v1/checks.$ curl -s -X POST http://localhost:8000/v1/checks \ -H 'Content-Type: application/json' \ -d '{"config_id": "my-guardrails-config", "messages": [{"role": "assistant", "content": "Here is the answer."}]}'
- ›Adds
RailOutcome— an engine-neutral allow, block, or transform result that both LLMRails and IORails can enforce from a single rail action return value. - ›Adds typed rail manifests so built-in rails declare their configuration, actions, execution surfaces, requirements, and privacy properties for automatic discovery by both engines.
- ›Adds
/v1/healthand/healthzserver health-check endpoints. - ›Adds output-rail checking mode to the
/v1/checksendpoint, which now selects a server-loaded configuration viaconfig_idor the server default. - ›Adds F5 Guardrails integration as a new built-in library rail.
+5 moreshow less
- ›Adds a canonical outbound HTTP client shared by all built-in integrations, providing connection pooling, retries, TLS, error handling, lifecycle management, and privacy-safe tracing and metrics.
- ›Adds shared model telemetry and an instrumented model decorator for LLM call observability.
- ›Expands IORails to execute 59 of the library's 67 action-backed input and output surfaces, including community integrations and content-transforming rails, sharing the same rail implementations as LLMRails.
- ›Supports running multiple self-check rails simultaneously with per-rail namespaced task prompts.
- ›IORails now returns
GenerationResponsefrom non-streaming generate() and generate_async() calls when generation options are supplied.
└──▷ BREAKING ON UPGRADE- !Custom actions using @action(output_mapping=...) must remove that argument and return an explicit
RailOutcomeinstead. - !The
hf-classifierinstall extra is removed; installtransformersandtorchdirectly for the local classifier backend. - !IORails generate() and generate_async() calls that supply generation options now return
GenerationResponse; message lists must be passed withmessages=as a keyword argument rather than positionally. - !Custom Colang 1 flows using the former space-separated Cleanlab, Fiddler, or GCP action names must switch to their
snake_casenames. - !
/v1/checksno longer accepts inline configuration; select a server-loaded configuration usingconfig_idor rely on the server default. - !Chat Completions requests must use supported role-specific OpenAI message shapes; internal event payloads, unexpected fields, and audio requests are now rejected.
- ›Adds