Enforcing custom content policies with NeMo Guardrails: what it does and when you need it
Start here if your organization already has an acceptable use policy and wants its LLM assistants to enforce it. NeMo Guardrails, the Apache 2.0 licensed toolkit at version 0.25.0, can apply input rails to user messages and output rails to model responses, and those rails can be driven by custom safety prompts and category definitions written for your policy. The library does not read your policy document for you. Someone on your team has to translate each prohibited or restricted behavior into a rule the rails can judge, with a clear category name, a definition, examples on both sides of the line and a defined action such as block, refuse or route to a human. Until that translation exists, the guardrail is only as precise as the wording someone happened to write.
The translation step is where most of the risk sits. Policies are written for people who can interpret intent, while a guardrail model judges each message against the text it is given. Vague categories such as "inappropriate financial advice" will produce inconsistent blocks, and overlapping categories will produce conflicting decisions. Confirm with your policy owners which behaviors must be blocked, which should be answered with a refusal, and which are acceptable with a caveat. Confirm also which languages and channels the policy covers, since a rule written in English may not behave the same way in other languages. Keep the rules in version-controlled configuration files so each change can be reviewed and traced.
The prerequisite is evaluation before enforcement. Build a labeled set of prompts and responses that should be allowed, should be refused and sit near the boundary, then run the configuration against it and record the block and miss rates per category. Repeat the run after every prompt or threshold change, because a wording edit that fixes one category can break another. Decide in advance what result is acceptable and who signs off on it. Running the rails in log-only mode for a period before blocking users lets you compare decisions with real traffic. The evaluation method is covered in the testing and evaluation section of this guide.
How a written policy becomes an enforced rail
The path starts with the acceptable use policy document, which is split into named categories, each with its own judging prompt and a parser that turns the model's answer into allow or block. Those prompts are wired into input and output rails in the config. Nothing reaches enforcement until the configuration passes an evaluation gate on labeled safe and unsafe examples, and any failures send the policy text, categories or parser back for revision. Check that every category has both safe and unsafe test cases before the gate opens.
Policy text moves through categories, prompts and rails to an evaluation gate, with failures looping back to revision.
Which parts of a policy map to NeMo Guardrails configuration
An acceptable use policy does not map to NeMo Guardrails in one step. Each clause has to become a category, a judging prompt, a verdict format, a rail position and, where checks need logic beyond a model call, an action. The cards below follow that chain so each part can be reviewed and tested on its own.
Category definitions
Each prohibited or restricted area in the policy becomes a named category with a written definition, examples of what falls inside and outside it, and an owner. Vague categories such as misuse produce inconsistent verdicts, so the definitions are the first thing to review with your compliance team. Keep the category list in version control next to config.yml so policy changes show up as reviewable diffs.
The safety prompt that judges content
The safety prompt tells the judging model which policy text to apply and what question to answer about the input or output. It is where your policy wording enters the pipeline, so it must name the categories it tests and say what counts as a violation. Test the prompt against your own examples, since a model can follow a generic prompt while missing the distinctions your policy draws.
The output parser that reads the verdict
The output parser turns the judging model's response into a decision the rail can act on, usually a safe or unsafe result and sometimes a category. If the expected format is loose, a verbose answer can be read as the wrong verdict. Confirm which parser and response format your chosen model uses, and test malformed and borderline responses, not only clean ones.
Input or output rail placement
Each category has to be placed on an input rail, an output rail or both. Input rails stop a request before the application model sees it, which saves model calls but cannot catch unsafe content the model generates on its own. Output rails check what the model returns, which covers generated content but adds latency to every response. Decide placement per category, based on where the risk actually sits in your application.
Custom actions for policy logic
Some policy rules need checks that a prompt cannot express, such as comparing a request against an internal allow list, looking up a customer's account tier, or applying a threshold across several categories. These go into Python actions that Colang flows call. Actions are code your team must own, version and test, so keep them narrow and document which policy clause each one enforces.
Configuration files and Colang version
config.yml declares the models, rails and their order. Optional Python actions and Colang files define the flows that connect rail outcomes to refusal or handling behavior. Colang 1.0 is the default, and Colang 2.0 is also supported, so confirm which version your team writes before creating flows, because the two syntaxes differ and migrating later needs manual review.
Read the sourceConfiguration options and when each fits
This table compares the three ways to turn your acceptable use policy into NeMo Guardrails checks: self-check prompts, dedicated safety models with custom policy text, and reasoning models or custom Python actions. Read each row against your latency budget, your team's maintenance capacity, and whether the option needs a model or backend you must host yourself.
| Option | When it fits | Latency and maintenance cost | Needs a custom model or backend? |
|---|---|---|---|
| Self-check prompts | Short, well-defined rules that the application LLM can judge reliably, such as off-policy topics or clear prohibited requests | Adds one extra LLM call per rail on the application model; prompts need regression testing whenever the model changes | No, it uses the application's own model, though a separate judge model can be configured |
| Dedicated safety model with custom policy text | Broad categories where a guard model is tuned for classification and your policy can be written as explicit category definitions | Adds a call to the safety model; policy text and output parsing must be validated against labeled examples | Usually yes, since you host or access the guard model and its serving endpoint |
| Reasoning model with custom policy text | Nuanced policies that require interpreting context, exceptions or multi-step judgment | Highest latency of the LLM-based options because of reasoning traces; token budgets must be set so responses are not cut off | Yes in most cases, with reasoning mode and token limits configured on the serving side |
| Custom Python action | Deterministic rules such as pattern matching, allow lists, identifier formats or account-specific checks | Lowest runtime latency; the code is owned by your team and needs unit tests and review like any other service | No model needed, but the action may call internal systems that require their own access controls |
| Combined layers | Policies where cheap deterministic checks screen obvious cases and a model handles the remainder | Latency adds up across rails, so order them so inexpensive checks run first | Depends on the model layer chosen |
How to set up custom policy rails step by step
This sequence takes an organization's acceptable use policy from written text to tested NeMo Guardrails rails, with a check at each stage so that enforcement is only switched on once the team can show it behaves as the policy intends.
Confirm the Python runtime and install the library
The platform engineer creates an isolated environment on Python 3.11, 3.12 or 3.13, which are the versions NeMo Guardrails 0.25.0 requires, and installs the nemoguardrails package from PyPI. Pin the exact version in your lock file so later upgrades are deliberate. Done means the package imports cleanly and the version reported matches the one you pinned. If the runtime is anything else, stop here and fix it, because later steps will fail in ways that look like policy problems.
Draft policy categories from the acceptable use policy
The policy owner and a safety or compliance lead translate each prohibited behavior in the acceptable use policy into a named category, such as harassment, self-harm facilitation or disclosure of internal data. Each category gets a one-sentence definition, a list of clear inclusions and a list of explicit exclusions that the business allows. Done means every rule in the policy maps to exactly one category or is recorded as out of scope for the assistant, and the reviewer has signed off on the wording.
Write safety prompts and output parsers
The engineer writes a judging prompt for each category that states the policy text, the input or output to be judged, and a fixed answer format. A parser then reads the model's answer and converts it into a block or allow decision, and it rejects any answer that does not match the format. Done means each prompt runs against a handful of hand-written examples and the parser returns a decision for every one of them, including malformed answers.
Add the rails to config.yml
The engineer registers the prompts and parser in the configuration folder, referencing them from config.yml as input or output rails and adding Colang files for the refusal flow if needed. Keep the category names identical across prompt, parser and rail so logs can be traced back to the policy. Done means the configuration loads without validation errors and the rail list shows each category exactly once, with no leftover rails from earlier experiments.
Load the configuration through the Python API or server
Choose one entry point for each environment. In application code, load the folder with the Python API and call it from the request path. For shared services, run the guardrails server with the configuration folder mounted, either directly or from a container image built from the provided Dockerfile. Done means a test request sent through the chosen entry point reaches the rails, and the response shows the expected block or allow behavior for a known example.
Test one prompt per category
The tester sends at least one clearly violating input and one clearly acceptable input for every category, then checks the decision and the refusal text. Record each result against the category name so a failure points to a specific rule. Done means every category has been exercised in both directions and any mismatch has been either fixed in the prompt or recorded as a known gap for the policy owner to decide on.
Run the full evaluation set before enforcement
Run a larger labeled evaluation set that covers borderline cases, multilingual inputs if your users write in more than one language, and cases the business has said must stay allowed. Compare the block rate and the missed or wrongly blocked examples against the thresholds the policy owner approved. Done means the results are saved with the configuration version, the policy owner has reviewed the misses, and enforcement is turned on only after that review is recorded.
What evaluation to run before a custom policy blocks real users
Before a custom policy blocks anyone, build a labeled evaluation set for each category in the policy. For every category, collect prompts that the policy should allow and prompts it should block, written the way your staff and customers actually write. Include the legitimate work that sits near the line: security teams asking about malware analysis, HR staff discussing harassment complaints, support agents quoting abusive messages. Have the policy owner label each prompt, and keep the labels with the category definitions they were written against. Without this set, you cannot tell whether a change to the safety prompt or category text helped or hurt.
Measure false positives on legitimate work first, because that is where a custom policy usually fails in production. Run the allowed prompts through the configuration and record each refusal, then sort them by cause: the category wording was too broad, the judging model misread the context, or the refusal fired on a retrieved document rather than the user's message. Review the borderline cases in a session with the policy owners, not only the engineers. Decisions about what the policy means belong to them, and the outcome should be written as a changed category definition or an explicit exception, not a silent tuning of thresholds.
Run the configuration in log-only mode against live traffic before enforcing any block. In this mode the rails evaluate each request and record the verdict, but the assistant still answers. Compare the logged verdicts with a sample of human review over a period your risk owner accepts, and only move a category to blocking when its false positive rate on that sample is acceptable to them. Record every result against the configuration version, including the prompt text, model, parser settings and the Guardrails package release in use, so that a later upgrade can be compared with the baseline. Confirm the current package release and its Python requirements in the NeMo Guardrails releases before you fix the test environment.
Security and operational risks of custom policy enforcement
A custom policy turns your acceptable use rules into a configuration that the application depends on. The cards below cover the places where that configuration can leak, be bypassed, log sensitive data, drift without review, or be edited by the wrong people.
Policy text leaking into prompts
Self-check and safety-model rails place your policy text into prompts sent to the model, and that text can be echoed back to users when a model quotes its instructions. Treat the policy as sensitive if it reveals detection thresholds or internal categories. Check whether a probe such as asking the assistant to repeat its instructions returns any policy wording, and confirm which prompts your configuration sends to which model endpoint.
Bypass through jailbreak and injection
A custom category only protects users if the input rail sees the request in its original form. Encoded text, role-play framing, translated prompts and instructions hidden in retrieved documents can slip past a policy written for plain requests. Test the policy with adversarial prompts in each language your users write in, and do not treat a passing set of ordinary examples as proof of coverage.
Logging of blocked personal data
When a rail blocks a request, the blocked text is often written to application logs, traces or debugging output so that teams can investigate. That text may contain personal data the policy was meant to stop, and it is then stored under the retention rules of your log platform. Decide what is recorded for blocked requests, mask or hash user content before storage, and set a retention period that your privacy team has approved.
Change control for policy edits
Policy wording, category lists and rail order are all code-like changes that alter what the assistant allows. A small edit can widen or narrow enforcement without any test failing. Store the configuration in version control, require review for changes to category definitions and thresholds, and run the evaluation set before each release so that every change has a recorded result.
Access to configuration and server
The configuration folder holds the policy, Colang flows, custom actions and model endpoints, and the guardrails server exposes them over HTTP. Anyone who can write to that folder or reach the admin side of the server can disable a rail. Limit write access to named maintainers, keep API keys out of the configuration files, restrict network access to the server, and confirm which endpoints require authentication in your deployment.
Questions buyers ask before hiring help with custom content policies
How much does it cost to enforce custom content policies with NeMo Guardrails?
The software itself has no license fee, because NeMo Guardrails is licensed under Apache 2.0 and the library is free to use. Cost comes from the work around it: policy drafting with your policy owners, writing and testing custom safety prompts, building a labeled evaluation set, running the model that judges content, and the infrastructure to host it. Some of these costs are one-time, such as the first policy mapping and evaluation set, while model hosting, evaluation runs after policy changes and upgrades recur. Ask any quote to separate fixed-scope build work from ongoing support, and to state which safety model is assumed, since a GPU-hosted judge and a prompt-based check have very different running costs.
How long does it take to turn an acceptable use policy into working guardrails?
The duration depends mainly on how clear the policy already is and how many categories it contains. A policy with a short list of well-defined categories moves faster than one with overlapping rules that policy owners still disagree on, because those disagreements must be settled before any prompt is written. Evaluation takes a meaningful share of the time, since each category needs examples that should pass and examples that should be blocked, and results must be reviewed before enforcement. No duration is set here. Ask for a timeline in the written scope that lists the policy sign-off, the evaluation set and the staging period as separate milestones.
What do we need to provide before the work starts?
Three inputs decide whether the work moves quickly. First, named policy owners who can make final calls on category boundaries, borderline cases and the refusal wording. Second, labeled examples: prompts and responses marked as acceptable or violating for each category, drawn from real traffic where your privacy rules allow it. Third, test environments that mirror production, including the model endpoints, identity settings and logging your assistant uses, so results carry over. Expect to supply test accounts and a way to review blocked requests. Confirm in the scope who owns the labeled data after the engagement ends.
Can our internal team enforce custom policies without outside help?
Yes, a team with Python experience and a clear policy owner can do this internally, since the NeMo Guardrails library is open source and its configuration uses a config.yml file, optional Python actions and Colang files. The harder parts are usually not the code. They are writing category definitions that a model judges consistently, building an evaluation set that covers edge cases, and keeping the configuration correct across upgrades. Colang 1.0 is the default and Colang 2.0 is also supported, so confirm which version your team will standardize on. Many organizations use a partner for the first build and then take over operations.
How does the Apache 2.0 license affect what we pay?
The Apache 2.0 license lets you use, modify, and deploy NeMo Guardrails inside your own infrastructure without paying NVIDIA a license fee for the library itself. The license does not cover everything around it. Hosting costs, the safety models you choose to run, and any paid services such as hosted moderation APIs have their own terms and charges. Check the licenses of each model you plan to run, since they can differ from the library's license. Also note that NVIDIA has sunset the NeMo Guardrails microservice, so budget for the self-hosted library path rather than the retired container.
What makes the effort go up?
Effort rises with the number of policy categories, the number of languages and channels the assistant serves, and the number of input and output points that must be checked. Effort also rises when the policy is ambiguous, when labeled examples are scarce, or when the judge model needs reasoning traces that add latency and tuning work. Additional rails for dialog, retrieval or tool calls each add configuration and testing. Multiple environments, approval steps and audit evidence requirements add further work. Ask any quote to list each of these drivers so you can see which ones your organization controls.
How do we know custom rules block the right content before we enforce them?
Test the rules against a labeled evaluation set before any enforcement, and measure both false positives, where acceptable requests are blocked, and false negatives, where violating content passes. Run the same set after every prompt, model or configuration change, because a small edit can shift judgments across categories. Use a staging environment that matches production, review borderline results with policy owners, and record each run so you can show what was tested. Confirm with the vendor or your own environment how your chosen judge model behaves on your languages, since results do not transfer automatically.
What does DeployOpen deliver for a custom policy engagement?
DeployOpen plans, implements and tests self-hosted NeMo Guardrails configurations inside your own infrastructure, including custom safety categories, output parsing, and the evaluation needed before enforcement. Engagements are usually fixed-scope, so scope, deliverables and timelines are agreed in writing before work starts, and a quote follows from that written scope. DeployOpen does not issue audit reports or certifications, but it can prepare configurations, test results and records that your compliance team and independent auditors can review. Ongoing support and continuous testing are available as retainers.
How DeployOpen scopes and delivers custom policy enforcement
DeployOpen is a Chainscore Labs company that implements and tests self-hosted NeMo Guardrails inside the client's own infrastructure, including the custom policy work described on this page. Engagements are normally fixed-scope, which means the policy categories, the rails they apply to, the models or prompts that judge them, the hosting target and the deliverables are agreed in writing before any build starts. A written scope is the point where your policy owner, security team and engineering lead settle what "enforced" means: which input and output rails are in scope, which categories block versus flag, which languages must be covered, and what evidence you will receive at the end. DeployOpen does not publish a price list, so the quote follows from that written scope.
The evaluation work is the part most worth reading closely in a proposal. A typical scope covers translating the acceptable use policy into category definitions and prompt text, configuring the rails in the config.yml file and any Colang files, building a labeled set of safe and unsafe examples taken from your own use cases, and running that set against the configuration before anything is enforced. Testing also includes adversarial inputs such as jailbreak attempts against the custom categories, malformed model output that breaks parsing, and false positive review on ordinary business requests. Ask each proposal to name the test cases, the pass criteria, who signs off on the results and how a failed test is retested. Confirm the NeMo Guardrails version and Python version that the work targets, because the current release line changes configuration and API details.
Custom policies rarely stay correct once real traffic arrives, so DeployOpen offers retainers for ongoing tuning. Under a retainer, the work typically covers reviewing blocked and missed requests, adjusting category prompts, rerunning the evaluation set after each change and planning version upgrades. Ask what a retainer includes, how changes are requested and approved, and how policy edits are tracked in version control. Responsibilities should be explicit: your team owns the policy text and the final risk decisions, while DeployOpen implements, tests and documents the configuration. DeployOpen prepares systems, controls and test evidence that your compliance or audit teams can review, but it does not issue audit reports, attestations or certifications, and independent auditors or certification bodies make those determinations.

