Customizing NeMo Guardrails prompts per task and model for your own LLM stack
Prompt customization means replacing the default prompts that NeMo Guardrails sends to your LLM for its internal tasks, and you need it when those defaults do not fit your model or your policy. Teams usually hit this when a model follows instructions differently from the one the defaults were written for, when a self-check policy needs organization-specific wording, or when a smaller model returns output the built-in parsers reject. The prompts behind the library's internal work sit in configuration files alongside config.yml and any Colang files. The main tasks with prompts are intent generation, which maps user messages to canonical intents; bot message generation; and self-check input and output moderation, where the model judges whether a message breaks policy. Each task can have a default prompt and, where the configuration declares one, a variant for a specific model, so one deployment can run different wording for different LLMs.
Before you edit anything, confirm which NeMo Guardrails version you run. Prompt keys, task names, the way variants are matched to models and the parsers that read model output all change between releases, so a prompt file written for one version can silently stop applying after an upgrade. The current release is 0.25.0, and it deprecates the LLMRails class in favor of Guardrails, which affects how your code loads the configuration that contains the prompts. Record the exact library version in your configuration repository, pin it, and rerun your guardrail test suite after any change to prompts or to the library. Treat a prompt edit as a code change that needs review, because a wording change can alter what gets blocked, and a parser mismatch can turn a block into a pass. Check the migration notes in the NeMo Guardrails documentation for the version you plan to run before you carry custom prompts forward.
Which prompt tasks NeMo Guardrails lets you override
NeMo Guardrails drives several decisions through prompts sent to the configured LLM. Each task below shapes a different part of behavior, so a team should decide which ones it needs to change before editing anything. Confirm the exact task names against the version you install, since they can change between releases.
Intent generation
The intent generation prompt asks the model to classify a user message into one of the intents your Colang flows define. It controls whether a request is recognized as a known topic or falls through to a default path. Teams change it when their domain uses terms the default wording misreads, or when intent names in their flows need clearer labels. Check that the output format still parses into the intent names your flows expect.
NeMo Guardrails docsBot message generation
The bot message prompt controls how the model phrases a reply when a flow asks it to generate a response rather than returning a fixed message. It governs tone, length and how the assistant declines out-of-scope requests. Teams adjust it to match brand voice or regulated wording. Review generated replies against your approved language, because a prompt change can alter refusal behavior.
Self-check input
The self-check input prompt asks the model to decide whether a user message should be allowed before it reaches the main application model. It is the default input moderation task that many teams extend with policy text. Changing it changes what gets blocked, so every edit should be tested against a fixed set of allowed and disallowed examples. Record which version of the prompt each test run used.
Self-check output
The self-check output prompt asks the model to judge whether a generated response complies with policy before it is returned to the user. It is the counterpart to input moderation and covers content the application model produced. Teams change it to reflect output rules such as disallowed advice categories or required disclaimers. Confirm how a failed check is handled in your flows, since blocking and rewriting are configured separately.
Fact-checking
The fact-checking prompt asks the model to decide whether a response is supported by the evidence supplied to it, typically retrieved context in a RAG application. It determines how strictly answers must match source material. Teams revise it when their sources use specialized terminology or when they need stricter grounding. Confirm whether the task receives the retrieved chunks in the form your prompt expects.
Prompt configuration options and when each fits
This table compares four ways to change how NeMo Guardrails prompts behave, plus keeping the defaults. Read each row for when the change fits and what it asks you to maintain. The main takeaway is that every override adds upkeep, so make the smallest change your tests require and confirm key names in the current NeMo Guardrails documentation before you build.
| Option | When it fits | Main trade-off |
|---|---|---|
| Keep default task prompts | The built-in prompts for intent generation, bot messages and self-check tasks already match your policy wording and language. | Lowest maintenance, but you still need to retest when NVIDIA changes default prompts in a new release. |
| Override a default task prompt | Your organization needs specific wording for a task, such as a stricter self-check policy or domain terms the default misreads. | Your override no longer tracks upstream prompt changes, so each upgrade needs a diff and a retest. |
| Add a model-specific prompt variant | One model in your configuration follows instructions differently and needs its own wording for the same task. | Each variant is another prompt to review. Confirm in the documentation how the model is matched to a variant. |
| Set token limits per task | A task produces long completions that get cut off, or you need to cap the output length of a particular check. | A limit that is too low truncates classifications or flow output, while a high limit adds latency to every call. |
| Customize an output parser | The model returns a structure, labels or formatting that the default parser does not read correctly. | The parser and the prompt's output format must match. A change to either side can produce wrong decisions without a clear error. |
| Change prompts together with model changes | You plan to switch models or upgrade the model version used by a rail. | Prompt, token limit and parser choices may need retuning for the new model, so treat them as one change set. |
How to set up custom prompts in a NeMo Guardrails project
This sequence takes a working NeMo Guardrails configuration to prompt overrides and model-specific variants that are tested against each model you run. It ends with a per-model record showing which prompts were used and how the output parser handled actual model responses.
Pin the NeMo Guardrails version
The platform engineer creates a virtual environment on Python 3.11, 3.12 or 3.13, then installs the library with
pip install nemoguardrails==0.25.0from PyPI. Pinning matters because default prompts and their task names can change between releases, so every prompt override depends on one known version. Record the pinned version in your dependency file and in the project README. The step is done when the environment reports 0.25.0 and a fresh install from the dependency file produces the same version.Copy a baseline configuration folder
Start from a configuration folder that already loads, with its
config.yml, Colang files and any Python actions. Copy it into a new project directory under version control and leave the source folder untouched so you can compare behavior later. Load the unchanged copy and run a fixed set of test messages that cover the flows you use. The step is done when the copy produces the same responses as the source folder for every test message, which confirms that any later difference comes from your changes.Identify the default prompts in use
The engineer lists every rail and flow that calls the model, such as intent generation, bot message generation, and self-check input or output checks. For each one, find the default prompt the pinned version uses for that task in the library source or its documentation. Confirm the exact task names and the placeholders the library fills in, since overrides must keep both. The step is done when you have a written table that maps each active rail or flow to its task name, its default prompt and the model it calls.
Add task overrides and model variants
Using the prompt configuration for your version, the engineer overrides only the tasks in the table and keeps the placeholders intact. Where one model needs different wording or formatting, add a variant scoped to that model's identifier from
config.yml, and change only what that model requires. Set token limits for each task where the version supports them, and confirm the key names in the documentation for 0.25.0 first. The step is done when the configuration loads without errors and every override maps to one named task.Run the configuration against each target model
The team runs the same fixed test set against each target model, using the variant that applies to it and the unchanged baseline for comparison. The test set should cover normal requests, edge cases, and inputs that the rails should block or allow. The team records the prompt used, the response, and the rail decision for each case, then notes which results differ from the baseline. The step is done when every target model has a results log with a pass or fail result for each test case.
Verify the output parser on actual responses
The engineer captures raw responses from each model during the test run, including refusals, extra explanatory text and unexpected formatting. Each captured response is passed through the output parser for its task, and the team checks that yes or no decisions, intents and messages are read correctly. Every parse failure is added to the test set and fixed in the prompt or the variant before the next run. The step is done when the captured responses show no parse failures for the test set and the parser behavior is recorded for each model.
How model-specific prompt variants are selected at runtime
A prompt override is bound to a task and, when it is model-specific, to the model it was written for. In the configuration, that binding tells the runtime which text to send for a given task, such as intent generation, bot message generation, or a self-check input or output step. When you change the model in your configuration, the runtime compares the active model identifier against the models listed on each prompt entry for that task. Before you rely on any particular behavior, confirm in the NeMo Guardrails documentation for your installed version how identifiers are written (provider prefix, casing, whether wildcards are accepted) and how precedence is applied when more than one entry could match. These rules are version-specific, so check them against the release you deploy rather than against older examples or community posts.
The harder question is what happens when nothing matches, because that case is easy to miss in review. Confirm whether the runtime falls back to the generic prompt for the task, skips that step, or raises an error, and whether the failure appears at startup or on the first request. Then design around the answer. Keep a default variant for every task that a rail uses, and treat a silent fallback as a risk, since a generic prompt written for one model can produce output that the output parser or a Colang flow handles poorly with another. The reliable way to confirm behavior is a test per model: load the configuration for each model you plan to run, log the rendered prompt for each task, send representative inputs, and check that the parsed result matches what the rail expects. Repeat that test whenever the model, the NeMo Guardrails version, or the prompt file changes.
Prompt choices for hosted, self-hosted and gateway-run models
When NeMo Guardrails calls a model hosted by a commercial provider, the provider controls the model version, its updates, its rate limits and its deprecation schedule. Prompt tuning for intent generation, bot messages and self-check tasks has to be tested against the exact model identifier in your configuration, because an alias can move to a newer model without any change on your side.
- Pinned model identifiers: Use a fixed or dated model name where the provider offers one, so prompt behavior does not shift silently.
- Token and output limits: Check the context and output limits the provider enforces, and size self-check responses so output parsers receive complete text.
- Output format stability: Confirm that the model returns the structure your parser expects under load and after retries.
- Data handling terms: Self-check prompts and the content they contain leave your network, so the contract and retention terms cover guardrail traffic as well.
Confirm with the platform owner which model identifier is pinned, who receives provider deprecation notices, and whether every prompt change runs a regression test before it reaches production.
A model served on your infrastructure through an OpenAI-compatible API usually looks like a hosted model at the protocol level, but the model family, quantization, chat template and serving settings are yours to control. Prompt variants often depend on the family, since instruction formats, system message handling and stop sequences differ between families. A prompt that parses cleanly on one model can produce extra text on another.
- Chat template and family: Confirm which template the server applies, because the same prompt text can be wrapped differently by different families.
- Context and generation limits: Set the serving context length and maximum generated tokens to match what your prompts and parsers assume.
- Quantization and weight changes: A new weight file or quantization level can change self-check decisions, so treat it as a prompt-relevant change.
- Parser tolerance: Test each output parser against every model variant in service, including verbose or malformed responses.
Confirm with the platform owner which model, template, quantization and serving version run in production, and who approves a model swap before any prompt is retuned for it.
When requests pass through a gateway, the gateway decides which model answers, applies its own routing and can apply guardrail configurations to model endpoints. NVIDIA's NeMo Helix guardrail documentation describes NeMo Guardrails running as inference gateway middleware, so a prompt change can reach every route that uses that configuration and, in a shared gateway, many applications at once.
- Shared blast radius: A prompt edit applies to all models and applications behind the gateway unless routing limits its scope, so review that scope before any change.
- Route-level model differences: The same task may reach different model families on different routes, so confirm that each prompt variant is selected by the route the gateway actually uses.
- Gateway-side transforms: Confirm whether the gateway rewrites requests or responses before guardrails see them, since that changes what a prompt receives.
- Versioning and rollback: Keep prompt configurations in version control, and confirm how the gateway reloads them and how a rollback is performed.
Confirm with the gateway owner which routes use the configuration, how changes are deployed, and what a rollback looks like before any production prompt change is made.
Security risks in custom prompts and how to control them
Custom prompts change how a NeMo Guardrails configuration decides what to allow, block and say. The risks below share one root cause: prompt text is code-like behavior that often lives in files, models and reviews outside the usual security checks. Each card names a risk and the control that keeps it visible and testable.
Prompts that expose internal policy
Intent generation and bot message prompts often contain the rules that decide what the assistant refuses, along with role descriptions and internal terminology. A user who coaxes the model into repeating its instructions can read that policy and plan around it. Control it by keeping sensitive decision logic in actions and rail code rather than prompt text, and by testing prompt extraction attempts against every custom variant before release.
NeMo Guardrails docsOverrides that weaken self-check rails
Self-check input and output prompts decide whether a message is blocked, so a small wording change can make a check stop catching violations for a given model. An override written for a smaller or differently tuned model may pass content the default prompt would block. Control it by running each self-check override against the same labeled test set used for the default prompt and recording the difference before deployment.
Parsers that accept malformed output
Custom output parsers and token limits determine how the rail reads the model reply. A parser that defaults to allow when the reply is empty, truncated or off-format can turn a model failure into a passed message. Control it by making the parser fail closed on unexpected output, setting token limits that leave room for the verdict, and adding malformed-reply cases to the test suite.
Unreviewed prompt changes in Git
Prompt files stored in Git are easy to change and easy to merge without a security reader, especially when they sit next to ordinary configuration. A single edited line in a self-check prompt can change behavior for every assistant that loads it. Control it by requiring review from the security owner for any change under the prompts directory, protecting the main branch, and tagging releases so each deployed prompt set can be traced to a commit.
Secrets written into prompt text
Teams sometimes paste API keys, internal hostnames, database identifiers or customer data into prompts while testing, and those values then sit in version history and in model provider logs. Anything in the prompt is sent to the model and may be echoed back to users. Control it by keeping credentials in the secrets store your deployment uses, scanning prompt files in the commit pipeline for credential patterns, and confirming with each model provider how it retains prompt data.
Drift from untracked prompt edits
Prompts drift when they are edited directly on a server, copied between model variants, or changed to fix one false positive without review of the others. Over time the running configuration no longer matches what the security team approved. Control it by deploying prompts only from the reviewed repository, comparing the running configuration with the approved commit on a schedule, and rerunning the evaluation suite after every change to any prompt or model variant.
Questions teams ask before customizing NeMo Guardrails prompts
How much effort does customizing NeMo Guardrails prompts take?
Effort depends mainly on how many tasks and models you override, how much evaluation you need before a change ships, and how many of your flows depend on the default prompt behavior. Overriding one prompt for one model is a small change. Overriding intent generation, bot messages and self-check prompts across several model variants, then proving each one still blocks and allows the right content, is a multi-stage project. No duration is set here, so ask any provider for a phased plan that lists each prompt, each model variant and the test cases behind it.
Can our internal engineers customize prompts without outside help?
Yes, many teams can, provided they already work with the config.yml file and Colang files and can read the Python code that loads prompts. The harder skills are writing prompts that behave consistently across models, checking output parsing when a model answers in an unexpected format, and designing evaluation cases that show a change is safe. Ask yourself whether someone on the team has run a repeatable test set against a model before. If not, an outside partner can cover that gap while your staff learn the approach.
What do we need to provide for prompt customization work?
Plan to provide three inputs before work starts:
- Model access: credentials or endpoints for every model the configuration will call, including any internal model gateway.
- Evaluation datasets: representative user messages, expected intents, blocked examples and allowed examples that reflect your domain.
- A test environment: a non-production copy of the guardrails configuration, the same Python version the release requires, and a way to run the server or Python API against it.
Without these, prompt changes can only be checked by hand, which makes regressions hard to find.
How do prompt changes interact with NeMo Guardrails upgrades?
Custom prompts are copied into your configuration, so a new release can change the default prompt text, the task names or the output format your override depends on. Before any upgrade, compare your overrides against the new release's default prompts and re-run your evaluation set. NVIDIA also deprecates some interfaces over time; for example, the LLMRails class is deprecated in favor of Guardrails in 0.25.0 with removal planned no earlier than 0.27.0, so check the migration guide when you move. Keep prompt overrides in version control so each change has a clear history and can be reverted.
What should a quote for prompt customization include?
A quote should follow from a written scope and list the work in terms you can check:
- The tasks in scope, such as intent generation, bot messages and self-check input or output.
- The model variants covered and the token limits or output parsers you expect to adjust.
- The evaluation datasets, test cases and reports that will show each change is safe.
- The handover items: documented prompts, test runs, runbooks and the upgrade checklist.
- Which costs are one-time, such as the initial build, and which recur, such as retesting after a release.
- Your responsibilities, including model access and the test environment.
DeployOpen agrees scope, deliverables and timelines in writing before work starts, and a quote follows from that scope.
Which model-specific prompt issues should engineers check first?
Engineers should first confirm that each model returns output in the structure the output parser expects, because a small formatting change can break intent matching or self-check decisions. Next, check token limits: a prompt that fits one model's context window may be truncated or cut off on another. Finally, compare responses for the same test inputs across models so you can see where a variant behaves differently. Confirm the supported model list and parser behavior with the NeMo Guardrails documentation for your release.
Does prompt customization change the security controls around our assistant?
It can. A weaker self-check prompt may let harmful or off-topic content pass, and a changed bot message may expose internal wording. Treat each prompt change as a change to a security control: record who approved it, test it against blocked and allowed examples, and keep the old version so you can roll back. Confirm which controls your compliance team expects to see evidence for before you begin, since DeployOpen prepares evidence but does not issue audit reports or certifications.
How a request flows through prompt-driven rails
The flow starts when a user message enters the input rails, which call the model with a task-specific prompt such as intent generation or a self-check. The variant selected for the configured model determines the prompt text and token limit applied at that step. The model's raw output then passes through an output parser before the rail decides whether to block the request or return the response. Check where each prompt override and token limit takes effect, because a limit set for one task does not carry over to the others.
Where custom prompts, model variants and token limits apply within a request.
How DeployOpen scopes and delivers NeMo Guardrails prompt work
DeployOpen plans, implements, tests, documents and supports self-hosted open-source platforms inside the client's own infrastructure, and prompt customization for NeMo Guardrails follows the same method. Work starts from a written scope covering which tasks, models and prompt overrides are in play, so the team and the client agree on what will be changed and how it will be checked.
How we scope
- Inventory the Guardrails version, config.yml files and which tasks use the default prompts for intent generation, bot messages and self-checks.
- List the target models, their prompt variants, token limits and the output parsers each task depends on.
- Agree the scope in writing before work starts, with deliverables and timelines, since most engagements are fixed-scope.
How we build
- Override task prompts in your configuration files, keeping model-specific variants separate so changes for one model do not affect others.
- Test each prompt change against representative inputs for every task and model in scope, recording expected and actual outputs.
- Check output parsing and token limit behavior for each model, and confirm the result on the Guardrails version you run in production.
How we hand over
- Deliver the configuration with a document that explains each override, the model it targets and the reason for the change.
- Provide the test cases and results so your team can rerun them after a model swap or a Guardrails upgrade.
- Walk your engineers through the prompt structure, the parser assumptions and the points where a prompt change needs review.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers for prompt configurations that change over time.
- Retesting after a Guardrails release is scoped separately, since upgrade notes can change prompt templates and parsers.
- Ask any partner for a quote that lists the prompt tasks, models, test coverage and handover documents included.

