Dialog rails vs input rails in NeMo Guardrails

Dialog rails in Colang suit multi-turn, scripted conversations, while input rails on IORails can enforce a topic or safety policy with less latency. This page explains how to choose, configure and verify each.

On this page

Dialog rails vs input rails: which NeMo Guardrails rail should enforce your policy

If your assistant must stay on approved topics or walk users through scripted steps, you have to choose which NeMo Guardrails rail enforces that policy. NeMo Guardrails provides five rail types: input rails, dialog rails, retrieval rails for RAG chunks, execution rails for custom actions and tools, and output rails. For topic and conversation control, the choice usually sits between two of them. Input rails are checks that run on the incoming user message before the main model answers, and they can be served by classifier models such as NemoGuard TopicControl. Dialog rails are Colang flows that match the user's intent, decide how the conversation should proceed, and steer the next turn, which makes them the place to define scripted steps and multi-turn behavior.

The main trade-off is between expressiveness and cost in calls and engine constraints. Dialog rails let you write the conversation as flows, but the matching step relies on LLM tasks for each turn, so every flow adds model calls and latency, and the Colang version and runtime you choose shape what is possible. Input rails on a classifier are typically the lighter path for a single policy such as off-topic refusal, since they evaluate the message without walking a conversation design. Confirm with your own tests, not with general claims, how much latency each option adds in your deployment, and check the NeMo Guardrails documentation for which configurations the IORails engine accepts before you commit to a design.

A practical decision rule is to ask whether the policy depends on conversation state. If the rule is a property of each message, such as whether a question falls inside the approved domain, start with an input rail and measure it. If the rule depends on where the user is in a process, such as collecting values in order or handing off to the model after a fixed step, plan for dialog rails and budget for the extra calls and review time. Many teams combine both, so write down which rail owns each policy and test the boundary cases where a message could match either one.

How a user turn moves through input rails and dialog rails

A user message enters NeMo Guardrails and passes the input rails first, where a classifier-based check can refuse it before any dialog logic runs. If it passes, the dialog rails match the message to a canonical user intent and select a Colang flow. A matched flow can answer the user or short-circuit the LLM entirely, while an unmatched turn falls through to the LLM. Check each branch in your own configuration, because every extra LLM task on the path adds latency.

Branches where input rails block early and dialog flows skip the LLM.

When each rail type fits your assistant

When the goal is to keep an assistant away from unrelated subjects without scripting every path, a classifier-based input rail is usually the first fit. The classifier judges each incoming message against allowed and disallowed topic descriptions, so the team does not have to write a flow for every subject a user might raise. The design stays small, and the policy lives in one place that security and product owners can review together.

  • Broad scope: One topic policy covers many possible questions, so you avoid enumerating each off-topic subject in advance.
  • Fewer moving parts: There are no per-refusal intent examples to maintain for every subject.
  • Colang 1.0 for IORails: IORails accepts only Colang 1.0, so choose that version first if you want the low-latency engine.
  • Model dependency: The classifier needs its own model endpoint, which must be sized, monitored and included in your hosting plan.
  • Refusal wording: Custom refusal phrasing is usually less flexible than a Colang flow, so confirm what the input rail returns in your configuration.

Before enforcement, check how the classifier handles borderline requests, and confirm with your model provider how the classifier is hosted.

Configuration options compared for dialog and input rails

This table compares dialog rails written in Colang with classifier-based input rails on the IORails engine across matching, model calls, Colang support, conversation state, latency and upkeep. Read each row as a question to answer for your assistant, then use the final row to choose a starting point. The choice often depends on whether the policy needs multi-turn steering or a check on every message.

DimensionDialog rails in ColangClassifier input rails on IORails
What it controlsConversation paths, intents and bot responses across turnsScreening of each user message before the main model answers
Matching methodUser intents matched to canonical forms and example utterances, with embedding searchA classifier model scores the message against the configured policy
LLM calls per turnSeveral model tasks per turn; count them in your own tracesFewer calls, centered on the classifier step; confirm the count for your setup
Supported Colang versionColang 1.0 is the default and 2.0 is supported; confirm 2.0 feature status for your releaseConfirm which Colang versions the IORails engine accepts before writing flows
Multi-turn stateFlows track where the user is and can collect values in sequenceEvaluates each message on its own; confirm any context handling in the docs
Latency driversNumber of intents, example utterances and model round trips per turnClassifier model size, where it is hosted and its placement before the main model
Maintenance effortExample utterances and flows change with the product; converted configurations need manual reviewPolicy wording and thresholds change; retest after any model or policy change
Typical fitScripted intake, required steps and guided conversationsBroad policies such as off-topic or unsafe requests across many flows

How to configure both rail types in one config.yml

This sequence builds one NeMo Guardrails configuration that runs a classifier-based input rail and Colang dialog flows side by side, then proves both paths behave as designed before users reach the assistant. Each step closes with a check you can record. The output is a config folder, Colang files, a wired endpoint and a test suite that your team owns.

  1. Install nemoguardrails on a supported Python version

    The platform or application engineer creates a virtual environment on Python 3.11, 3.12 or 3.13, the versions the 0.25.0 release requires, and installs the nemoguardrails package from PyPI. Pin the exact version you tested so later upgrades happen on purpose and not as a side effect of a fresh install. Done means the library imports cleanly in Python and the installed version matches the pin, which is 0.25.0 at the time of the latest release on PyPI. If the install fails, change the interpreter before touching any configuration.

  2. Create the config folder and config.yml with rails

    The engineer creates a config folder containing config.yml, the model settings for the main assistant and for the input rail, and the rails section that lists the input rails to run. Keep dialog flows out of this file, since they are defined in Colang files that the folder also holds. Done means the configuration loads with no validation errors when the library reads the folder, and the startup output names each input rail it found so you can confirm the file was read as intended.

  3. Write Colang flows for dialog rails

    The conversation designer writes Colang files that define user intents with example utterances, the bot responses tied to them, and the flows that steer multi-turn conversations. Colang 1.0 is the default, so start there unless the team has chosen Colang 2.0 for a new project and confirmed its status in the documentation. Keep the intent list small enough that the policy owner can review every example. Done means each intent fires on its own examples in the chat CLI, and an off-topic probe reaches the refusal path the designer wrote.

  4. Enable the input rail and confirm its model

    The engineer adds the chosen input rail to the input flows in config.yml. Choose a classifier-based check, such as self-check input or a safety or topic model the library supports, and confirm which model serves it, where that model runs and whether it adds a model call before every user turn. Check the NeMo Guardrails documentation for compatibility between the input rail and the Colang version and engine you selected. Done means a message the policy forbids is blocked by the input rail, and a permitted message passes through to the dialog layer unchanged.

  5. Wire the Python API or guardrails server

    The application engineer loads the config folder in the Python application through the Guardrails class, which the 0.25.0 release uses in place of the deprecated LLMRails class. Alternatively, the platform engineer runs the guardrails server against the same folder, building the container from the Dockerfile the project provides, and calls its HTTP API. Use one configuration folder for both paths so tests exercise the same rules production will use. Done means a request to the wired endpoint returns the same allow, block and refusal results as the chat CLI for identical messages.

  6. Verify both rail types with the chat CLI

    The conversation designer and engineer run the chat CLI against the config folder and work through a scripted set of messages. The set covers each intent, each blocked category, and several multi-turn sequences where a dialog flow hands off to the model. Record which rail or flow handled each message, using verbose output or logs where your installed version provides them, and confirm command options in the documentation. Done means every scripted case produces its expected outcome, and each surprise is logged as a defect against a named flow or rail and fixed before the next step.

  7. Automate the tests and lock the configuration

    The engineering team turns the scripted cases into automated tests that run on every change to the config folder, the Colang files or the input rail settings. Store the configuration in version control so each change has a reviewer and a history. Include at least one test per rail type and one message that both rails must handle, so a change in rail ordering is caught. Done means the suite passes in a clean environment built from the pinned version, and a deliberate edit to one intent makes the matching test fail.

Security risks when relying on dialog flows versus input checks

Dialog flows match what users say against the patterns a team wrote, so their coverage is only as wide as those patterns and the path a request takes through the bot. The cards below cover the gaps that appear when a team relies on flows alone, and the controls that close them.

Paraphrased and adversarial phrasing

A Colang flow matches intent through example utterances and embedding search, so a request worded in a way nobody wrote an example for can fall outside the flow. Attackers test rephrasings, translations and obfuscated text until one passes. Test a sample of paraphrases, adversarial variants and other languages against each flow, and add a classifier-based input rail for policies that must hold regardless of wording.

NeMo Guardrails docs

Bypass paths that skip the dialog

Dialog rails only run when a message reaches the flow logic. Requests handled by a different path, such as a tool call, a retrieved document or a direct call to the model endpoint, may never pass through the dialog layer. Map every route into the model and confirm which rail types apply to each one, so a policy is not enforced on the chat path alone.

NeMo Guardrails docs

Logging of user content

Guardrail traces and debug output can record full user messages, retrieved content and model responses, which may include personal or confidential data. Decide which fields are logged, who can read them and how long they are kept. Ask your security team to review the log configuration before the assistant handles real user traffic, and mask sensitive fields where the logs leave your controlled environment.

Configuration changes without review

Colang files and config.yml define what the assistant refuses and how it routes conversations, so a small edit can open a gap. Store these files in version control, require review for every change and run the regression tests for dialog changes before release. Record who approved each change so the history can be shown during an audit.

Engine version drift

Dialog flow behavior can change between releases, and Colang 1.0 and 2.0 handle some constructs differently. A version upgrade can silently alter which flows match. Pin the NeMo Guardrails version in your build, rerun the full test set after each upgrade and review converted configurations manually, since NVIDIA's migration guide says they still need manual review.

Current release
0.25.0
Colang 2 migration guide

Questions teams ask before choosing dialog or input rails

Which costs should I expect when choosing between dialog rails and input rails?

Most of the cost is people time and model calls, not the library itself. NeMo Guardrails is Apache 2.0 licensed, so the software carries no license fee. The cost components are engineering time to write and test flows or classifier thresholds, compute or hosted model usage for each LLM or classifier call, and infrastructure to run the guardrails server. Dialog rails with Colang usually add extra LLM calls per turn, so their running cost rises with traffic. Input rails on a classifier add fewer calls. Ask any partner for a quote that separates one-time build work from recurring model and hosting costs.

How much does the Apache 2.0 license cost to use NeMo Guardrails?

The Apache 2.0 license allows you to use, modify and deploy the NeMo Guardrails library without a license fee from the license itself. Costs come from the infrastructure you run it on, the model endpoints your rails call, and the work to build and operate your configuration. Before adopting, confirm with NVIDIA which hosted or enterprise services, such as NVIDIA AI Enterprise or hosted NIM endpoints, carry their own terms, because those are separate from the open-source library. Read the NeMo Guardrails repository license file and check the terms of every model you plan to call.

How long does it take to build and test dialog rails compared with input rails?

Duration depends on how many intents, flows and policy cases you need, and on how many conversations your test set covers. Dialog rails take longer because each flow needs example utterances, bot responses, multi-turn tests and regression checks after every change. Input rails on a classifier are usually shorter to wire up, but they still need threshold tuning and tests with borderline requests. No general timeline is supplied here, so ask for a written schedule tied to your intent list, number of flows and test coverage. Your team should also plan time for Colang debugging and a review before go-live.

What skills and team roles does a NeMo Guardrails project need?

You need someone who understands your assistant's policy, an engineer who can write config.yml and Colang files and Python actions, and a tester who can build a regression set. Platform engineers should own deployment, the guardrails server, secrets and logging. Security or compliance staff should approve the policy and review evidence. Dialog rails need stronger conversation design skills, because flows must match real user phrasing and handle hand-offs to the LLM. Input rails need classifier configuration and evaluation skills. Confirm your team has these roles before fixing the scope.

Can our own team implement dialog rails and input rails without an outside partner?

Yes, if your team has Python and LLM application experience and time to learn Colang. The library is open source and documented, so an in-house team can build a working setup. The risks are slow learning curves, weak test coverage and unclear ownership after launch. A partner is often considered for fixed-scope work such as deployment hardening, evidence preparation or a review of the flows before production. Whichever route you choose, write down who owns each rail, each model endpoint and each change to the configuration.

What breaks when dialog rails are added to a NeMo Guardrails assistant?

The most common problems are flows that fire too often, flows that miss rephrased requests, and extra latency from additional LLM calls on each turn. Colang 1.0 and 2.0 also differ in behavior, so a configuration written for one version needs review before you move it. Check that every flow has examples for the phrasing your users actually use, that legitimate requests are not refused, and that latency stays within your service target. Keep a regression suite of conversations and run it after every change.

How do I migrate Colang 1.0 flows to Colang 2.x?

NVIDIA documents a conversion path using the nemoguardrails convert tool, which turns Colang 1.0 files into Colang 2.x syntax. NVIDIA states that converted configurations still need manual review, so budget time to read every converted flow, rerun your tests and check behavior that depends on intent matching or action outputs. Start by freezing your current test conversations, run the conversion on a copy, and compare results. The Colang 2 migration guide describes the steps. Confirm the version you will target against the releases page before you start.

How DeployOpen scopes and delivers NeMo Guardrails rail design

DeployOpen plans, builds, tests and documents NeMo Guardrails configurations inside the client's own infrastructure, including the choice between Colang dialog flows and classifier-based input rails. Each engagement starts from a written scope that names the policies, models, conversation paths and evidence the client needs before the work begins.

How we scope

  • Inventory the assistant's policies, conversation paths and the turns that must be scripted versus left to the model
  • Record which Colang version and engine the project will run, and why, before any flow is written
  • Agree latency, model hosting and extra LLM call budgets with your platform team in the written scope
  • Confirm the test cases and sign-off criteria that define a finished rail set

How we build

  • Implement dialog rails in Colang and input rails with the chosen classifier models in your environment
  • Compare both approaches against the same policy set so the trade-off is measured, not assumed
  • Tune intent matching with example utterances so legitimate requests are not refused
  • Version the configuration folder in your source control with reviewed, reproducible changes

How we hand over

  • Deliver the configuration, Python actions, model deployment notes and a rail decision record
  • Document test results for on-topic, off-topic and borderline requests, with the expected outcome for each
  • Walk your engineers through debugging flows and reviewing blocked requests before handover
  • Provide a findings list of open items, including any Colang conversion steps that still need manual review

How we support

  • Support is available as a retainer for model updates, NeMo Guardrails version upgrades and policy changes
  • Retesting after each change to rails, prompts or underlying models keeps decisions documented
  • Confirm the support scope, response expectations and upgrade responsibilities in writing before work starts

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.