Testing NVIDIA NeMo Guardrails with promptfoo

Testing NeMo Guardrails with promptfoo shows whether your rails block attacks and let real users through, provided you read rail status correctly. This page covers the two integration paths, setup, and comparing configurations before release.

On this page

Testing NVIDIA NeMo Guardrails with promptfoo before release

Before a NeMo Guardrails configuration ships, the team needs evidence in two directions: the rails must block attacks, and they must not block legitimate users. Measure both block rates and false positives on the same release candidate so a change that tightens one side cannot hide a regression on the other. The reference point is the configuration as it will run in production, including its config.yml, Colang files and any Python actions. Pin the NeMo Guardrails version you test against. The library in the supplied facts is v0.24.1, released on 16 September 2026, and it supports Python 3.10 through 3.13, so confirm your runtime matches before you trust the results.

promptfoo runs locally on the tester's machine and talks directly to the system under test, so the attack and benign datasets stay inside your environment. Connect it to the rails in one of two ways. The first is the guardrails server, which loads configurations from a folder and exposes an HTTP API; point a promptfoo HTTP provider at it and test the same endpoint the application uses. The second is a Python provider that calls the NeMo Guardrails Python API directly, which helps when you need to read per-rail details or run custom actions. Choose one path for a given suite and document it, because the two can differ in what they expose.

Read the rail status with care. A response that was blocked by a rail is a pass for an attack case and a failure for a benign case, and a response that was not blocked is the reverse. Record blocks as guardrail flags, and keep provider errors, timeouts and malformed responses in a separate error count so they do not inflate either rate. When comparing two configurations before release, run the identical datasets against both, store results per version, and review the benign failures by hand before setting thresholds. Confirm with your own tests which rail types your configuration actually uses, since input, output and retrieval rails each need their own attack cases.

What you need before the first NeMo Guardrails eval

Before the first run, you need a promptfoo install, a NeMo Guardrails runtime with a known configuration folder, model credentials the rails can use, and a network path from promptfoo to the guardrails server. Each of these fails in a different way, so confirm them separately before you read any pass or fail result.

promptfoo runtime version

promptfoo's 0.124.1 release requires Node.js 22.22.0 or newer. Run node --version on the machine or CI runner that executes the eval, not only on your workstation. An older Node version can install promptfoo but fail at startup, which looks like a broken eval rather than a version problem. Pin the promptfoo version in your pipeline so results stay comparable between runs.

promptfoo on npm

NeMo Guardrails install

Install the nemoguardrails package in a Python environment that runs Python 3.10, 3.11, 3.12 or 3.13. The supplied release for this guide is v0.24.1. Keep the library version and the server image version recorded with each test run, because a rail or Colang behavior change between releases can move your numbers without any change to your configuration.

nemoguardrails on PyPI

Model provider credentials

Guardrails call a model for self-check moderation, fact-checking and similar rails, so the rails need their own credentials, separate from the model under test. Create a dedicated key with a spend limit, store it in your secrets manager, and expose it only to the guardrails server or Python process. Confirm which model each rail in your config.yml calls, because a missing key often surfaces as a rail that silently fails open.

Network path to the server

If promptfoo calls a guardrails server, the runner must reach its HTTP port, and the server must reach the model endpoints its rails use. Check DNS, proxies, egress rules and TLS trust for both hops. Run a single request with curl from the runner before adding the provider to a config, so a connection error is not mistaken for a guardrail decision.

Configuration folder and language version

The guardrails server loads each configuration from its own folder containing config.yml, any Colang files and any Python actions. Decide whether the configuration uses Colang 1.0, the default, or Colang 2.x, and record it. Set NEMOGUARDRAILS_LLM_FRAMEWORK=langchain only if your configuration depends on the LangChain integration, since that integration is opt-in.

Server image and Helm chart versions

If you run the NeMo Guardrails microservice rather than the open-source server, confirm the container image tag and Helm chart version in your own environment against NVIDIA's current documentation. Do not assume the library release and the microservice image are the same version. Record both identifiers in your test report so a later comparison is meaningful.

NeMo Guardrails docs

Choosing the server or Python provider path

The guardrails server path runs NeMo Guardrails as a separate service. The server loads configurations from a folder you point it at and exposes an HTTP API, and promptfoo sends test prompts to that endpoint through its HTTP provider. This path suits teams that already run guardrails as a service, teams that want tests to hit the same container image production uses, and organizations where a platform team owns the runtime while a security team owns the tests. NVIDIA also offers a production microservice built on the same configuration model and deployed on Kubernetes with Helm, which follows the same pattern at larger scale.

  • Same runtime as production: the test exercises the container image and its network path, so latency and timeouts reflect what the application will experience.
  • Separate ownership: the platform team operates the server while the test team changes only promptfoo files and datasets.
  • Language independence: the test runner sends plain HTTP requests, so CI jobs do not need the NeMo Guardrails package or its Python dependencies installed.
  • Operational cost: you run, patch and monitor an extra service, and a misconfigured server can fail every test for reasons unrelated to the rails.

Before building, confirm the request and response format for your release and the HTTP provider settings in the promptfoo introduction, then check that a health request and one known prompt succeed from the machine that will run the tests.

How to configure the NeMo Guardrails provider in promptfoo

This sequence connects a NeMo Guardrails configuration to promptfoo so that every attack and benign prompt produces a raw response and a rail status you can grade. It ends with a first eval whose output you have checked against the configuration you intended to test.

  1. Lay out the guardrails config folder

    The team that owns the guardrails configuration creates one folder that holds the config.yml file, the Colang files that define the rails and any Python actions the rails call. Keep the folder under version control so the configuration under test can be identified by commit. Confirm the layout by loading the folder with the nemoguardrails command line tool from a clean environment. Check that the load completes without errors and that the rails you expect appear in the configuration. Colang 1.0 is the default, so record which Colang version the folder uses, because the migration guide notes that converted configurations still need manual review.

  2. Start the guardrails server or load the Python API

    Decide whether promptfoo will call NeMo Guardrails over HTTP or in process. For HTTP, start the guardrails server against the configuration folder, either from a local Python environment on a supported version (3.10 through 3.13) or from a container image built with the Dockerfile in the repository. For in-process testing, load the same folder through the Python API in the provider script. Pin the NeMo Guardrails version, since the current release at the time of writing is v0.24.1 published on 16 September 2026, and record the version in your test report. Check that a plain request to the server returns a response for a benign prompt before adding any test cases.

  3. Write the promptfoo provider configuration

    In the promptfoo configuration file, add a provider entry that points at the running server or at your Python provider script. For an HTTP setup, set the endpoint URL and request body so that the user message is sent in the format the server expects, and confirm the field names in the server's API documentation for your version. For a Python setup, return the raw response object from the function so later assertions can read it. Keep the config key names exact and copy them from the promptfoo provider documentation rather than from memory. Check the configuration by running a single prompt through promptfoo's provider test mode and confirming that the response text and any status fields appear in the output.

  4. Add attack and benign test cases

    Create two groups of test cases in the same file or in linked datasets. The attack group should contain prompts that the configuration is meant to block, such as jailbreak attempts, prompt injection and off-topic requests that a topic rail should refuse. The benign group should contain ordinary requests that the application must answer, including edge cases near the rail boundaries. Label each case with its expected outcome so that a blocked benign prompt is visible as a false positive. Keep the two groups separate in reporting so that the missed-attack rate and the wrongly blocked rate can be read independently. Check that every case has an expected outcome before running the eval.

  5. Map the rail status into assertions

    Read the response fields that NeMo Guardrails returns for each rail and map them to promptfoo assertions. A blocked attack should show that an input or output rail intervened, and a benign request should show that no rail intervened and that the model answer came through. Do not treat a generic refusal in the answer text as a guardrail decision unless the rail status confirms it, because the model itself can refuse. Write the assertions against the status field names in your server version, and confirm them by inspecting a raw response first. Check the mapping with one known-blocked and one known-allowed case before running the full set.

  6. Run the first eval and inspect raw responses

    Run promptfoo's eval command against the attack and benign sets and open the results view or the output file. Before reading pass rates, confirm that the provider returned the raw response for each row, including the rail status and the final message, and that no row shows a connection or parsing error. Errors should be counted separately from passes and failures, because a server that is down makes an attack appear blocked. Check that a blocked test case returns the expected rail status and that a benign case returns an answer with no intervention. Only when these checks pass should the pass rates be used to judge the configuration.

  7. Record the configuration version for comparison

    Save the eval output with the commit of the guardrails folder, the NeMo Guardrails version and the promptfoo version, so that a later run on a changed configuration can be compared with this baseline. Use the same attack and benign sets when comparing two configurations, and change only one variable at a time, such as a single rail or threshold. Confirm the comparison by checking that both runs used identical datasets and assertions before comparing results. Promptfoo's npm release 0.124.1, published on 8 October 2026, requires Node.js 22.22.0 or newer, so confirm the Node.js version on the machine that runs the baseline.

Reading rail status correctly in assertions

NeMo Guardrails has five rail types, and a block at each stage should be recorded as a guardrail flag, not as a model failure. Input rails screen the user message before it reaches the model. Dialog rails steer the conversation flow and decide which responses are allowed. Retrieval rails inspect RAG chunks before they are passed to the model. Execution rails check custom actions and tools before they run. Output rails screen the generated answer before it is returned. Each of these can stop a response, so the assertion for a given test should first ask which rail, if any, acted, and only then ask whether the model produced an acceptable answer. Map each stage to a distinct flag in your promptfoo results so that a dashboard can show where blocks happen.

Separate responses that a rail blocked from responses that errored out. A rail block is a successful, intended outcome for an attack case and a failed outcome for a benign case. An error, such as a timeout, a malformed response, a missing configuration file or an upstream model failure, tells you nothing about the guardrail and should be reported as an error so it does not inflate or hide either pass rate. Confirm in your own version, by sending one blocked and one errored request to the guardrails server or Python API and inspecting the returned JSON, which fields indicate a rail decision and which indicate a runtime failure. Do not infer the response shape from documentation alone, and write assertions against the fields you verified.

A benign case that a rail blocks counts as a false positive, even though the response looks like a safe refusal. Benign sets exist to catch exactly this over-blocking, so the assertion for those cases should expect no rail to act and record any block as a false positive for later threshold review. Attack cases use the opposite expectation: a block is a pass, and a response that reaches the user unblocked is a missed attack. Keep the two groups in separate promptfoo test sets so that a single pass rate cannot hide one failure type behind the other.

Mapping rail outcomes to promptfoo test results

This table maps each outcome a NeMo Guardrails configuration can produce to the promptfoo result it should generate, the assertion type that checks it, and the figure the team tracks separately. Read it as the scoring rulebook for your test suite: a blocked attack is a pass, a wrongly blocked user is a failure, and a provider error is never counted as either. The main takeaway is that errors and blocks must be separated, or a broken server will look like a strong guardrail.

OutcomeExpected test resultAssertion typeTracked separately
Attack blocked by an input railPass, with the rail refusal recorded as the guardrail decisionnot-guardrails or guardrails assertion on the attack caseCount of attacks blocked, by rail name
Attack passed to the modelFail for a guardrail assertion, with the model response captured for reviewguardrails assertion on the attack case, plus a model-level grader if the output must be checkedMissed attacks, by attack category
Benign request passedPass, with the model answer checked against the expected behaviorguardrails assertion set to not block, plus a content assertion on the answerBenign pass rate, by dialog flow
Benign request wrongly blockedFail, flagged as a false positive for the rail that firedguardrails assertion on the benign caseFalse positives, by rail and by configuration version
Provider error (server down, timeout, malformed response)Error, excluded from pass and fail totalsNot scored as a guardrail decision; the run is marked erroredError count per run, kept apart from both block and pass figures

Comparing two configurations before release

Before a NeMo Guardrails change ships, run the same attack and benign datasets against both the current config folder and the candidate folder, using identical promptfoo configuration except for the path or server target. Pair the Colang 1.0 configuration in production with the migrated Colang 2.x candidate, so any difference in outcome traces to the configuration rather than the test harness. Keep the rail definitions, config.yml settings, Python actions and model settings as separate variables in the comparison so a reviewer can see which change moved which result.

Do not treat a migrated configuration as equivalent because it loads and answers requests. NVIDIA's migration guide says converted configurations still need manual review after the nemoguardrails convert tool runs, so the comparison must include a deliberate check of each migrated input, dialog, retrieval, execution and output rail. Add targeted cases for every rail the candidate touches, and confirm in the candidate's test report that each rail fired on the prompts it was meant to catch. A passing aggregate score can hide a rail that silently stopped triggering.

Present the results as a side-by-side table with one row per test group and four columns: attacks blocked for current, attacks blocked for candidate, benign requests wrongly blocked for current, and benign requests wrongly blocked for candidate. Review every flipped result individually, since a newly missed attack and a newly blocked legitimate request both justify a stop. Record who approved the release and which differences were accepted, so the evidence supports the release decision and any later audit questions about the change.

Securing the guardrails server and test data

The guardrails server, its credentials and the attack prompts used for testing all need the same care as production systems. Each card below covers one of these exposures, so the team can decide who may reach the server, where secrets live and who can read the test data before the first run.

Restrict network access to the server

A NeMo Guardrails server exposes an HTTP API that accepts prompts and returns rail decisions, so anyone who can reach it can probe your rules. Limit it to the promptfoo runner, your CI runners and the application that calls it, using network policies, firewall rules or a private subnet. Confirm which address and port the server binds to in your deployment, and do not publish it on a public ingress without a gateway in front of it.

NeMo Guardrails docs

Confirm authentication on the server

Before relying on the server in a test pipeline, check how it authenticates callers in your deployment and whether the version you run enforces it. Treat the answer as something to verify in your own environment, not as a default you can assume. Test with an unauthenticated request from outside the allowed network, and record the result as part of the release evidence.

Keep model and rail credentials out of config

Rails and actions often call model APIs, moderation services or third-party endpoints, and their keys can end up in config.yml, Python actions or the repository that holds them. Load these values from your secrets manager or environment at runtime, and keep the configuration folder free of them. Review the folder before each commit, because a copied key in a Colang file is as exposed as one in YAML.

Control access to promptfoo and its results

promptfoo runs locally and sends requests directly to the model or guardrail under test, so the machine running it holds the keys and the prompts. Self-hosted promptfoo stores data in a local SQLite database, has no RBAC and no built-in authentication or SSO, and is not recommended for production use. For a team or a multi-user setup, the documentation points to the Enterprise options, so ask for their scope in writing before you adopt them.

Self-hosting docs

Store attack datasets under access control

Adversarial prompts for jailbreaks, injections and harmful content are sensitive, because they show exactly how your rails can be bypassed. Keep them in a repository or storage location with restricted read access, and separate them from benign datasets if the teams that can edit each differ. Record who can change a dataset, since a silently edited attack set makes a later comparison meaningless.

Separate test and production data

Benign test prompts should be synthetic or approved for use, and should never be copied from production logs without a review of personal and confidential data. Test runs that call a live model send prompts to that provider, so check the data handling terms of each provider before using real customer text. Keep run outputs, including stored responses and rail status, under the same retention rules as the datasets they came from.

Common failures when testing NeMo Guardrails with promptfoo

This table lists the failures teams most often hit when pointing promptfoo at a NeMo Guardrails configuration, with the likely cause and fix for each. Read it in order when a run errors out, then check the guardrails server logs before changing the promptfoo config. Most failures surface as errors, not as wrong pass rates, so separate them from genuine guardrail misses.

FailureLikely causeFix and where to look
Provider timeout on the serverThe guardrails server waits on an upstream model or a rail that calls an external model, and the promptfoo request times out firstRaise the timeout in the promptfoo provider, confirm the upstream model responds from the server host, and read the server log for the step that stalled
Config folder fails to loadThe server was started with a path that does not contain config.yml, or a Colang or Python action file has a syntax errorCheck the folder passed to the server, confirm config.yml sits at its root, and read the startup log for the first file that fails to parse
Colang version mismatchColang 1.0 is the default, but the files are written in Colang 2.x syntax, or the reverseConfirm the Colang version declared in the configuration matches the file syntax. For older files, use the nemoguardrails convert tool and review the output manually, as NVIDIA's migration guide advises
Python version outside 3.10 to 3.13The host runs Python 3.9 or 3.14, which the NeMo Guardrails README does not list as supportedCreate a virtual environment on Python 3.10, 3.11, 3.12 or 3.13 and install nemoguardrails there before starting the server
Missing model credentialsThe API key for the configured model or a safety model is not set in the server environment, so rails fail before they return a decisionSet the key in the environment the server process reads, not only in the promptfoo shell. Check the server log for authentication errors on the first request
Benign cases counted as blocksRail thresholds, such as the self-check or jailbreak detection settings, are stricter than the traffic under test, so normal requests are flaggedSplit results into attack and benign sets, record blocks on benign cases separately, and adjust thresholds in the configuration before comparing versions
Blocked responses counted as passes or errors by mistakeThe promptfoo assertion reads the response text but not the rail status, so a refusal from the model looks identical to a guardrail blockRead the rail status field the server returns and assert on it directly. Track errors separately from passes so timeouts are not scored as blocks
Stale results after a config changeThe server still runs the previous configuration because it loaded the folder at startupRestart the server after editing configuration files, then rerun the suite and confirm the startup log shows the new files loaded

Running the comparison as a release gate

A release gate turns the NeMo Guardrails comparison into a yes or no decision: a candidate configuration ships only if it meets two thresholds, a minimum share of attack prompts blocked and a maximum share of benign prompts wrongly blocked. Set both thresholds before the first run, from the results of your current configuration on the same datasets, so that the gate measures change instead of a number chosen after the fact. Keep the attack and benign sets fixed between runs, and version them alongside the config.yml and Colang files, so a failing gate can be traced to a configuration change rather than to a different test set.

Evaluate both sides of the decision in the same run. An attack-only threshold rewards a configuration that blocks everything, so the false positive ceiling is the half of the gate that protects real users. Treat errors separately from results: a request that times out or returns a server error is neither a block nor a pass, so the gate should fail on error rates above an agreed level instead of counting those rows as successful blocks. Confirm with your own environment how the guardrails server or Python provider reports rail status for each request, and check that the gate reads the field that marks a rail as triggered, not a generic response field.

When a gate fails, the reviewer should first check whether the failure is real or caused by the harness, such as a changed server version or a model provider timeout. The nemoguardrails package has a versioned release history (v0.24.1 was released on 16 September 2026), so record the library version alongside the results. If the failure is genuine, the review should list which attack categories or benign prompts changed status, compare those rows against the previous configuration, and decide whether to tune the rail, adjust the dialog flow or accept the trade-off in writing. Record the decision and the thresholds used, so the next release is judged against the same standard.

Questions teams ask before testing NeMo Guardrails

How much effort does testing NeMo Guardrails with promptfoo take?

Effort depends mostly on how many rails the configuration defines, how much Colang code it contains, how large the attack and benign datasets are, and how many model calls each test triggers. A configuration with a few input and output rails and a small labeled dataset is a contained piece of work. Each added rail type adds cases to write, expected outcomes to define and results to review. Ask any partner for a written scope that lists the rails under test, the dataset sizes, the configurations to compare and the number of runs, because those inputs determine the quote. No duration is fixed by the product itself, so treat any timeline offered without those inputs as unsupported.

What does a NeMo Guardrails testing engagement cost?

DeployOpen does not publish a price list. A quote follows from the written scope, and most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. The cost components are the setup of the test harness, the construction and labeling of datasets, the writing of assertions, the comparison runs and the reporting. Some of these are one-time, such as building the harness and the first dataset. Others recur, such as rerunning the suite after each configuration change or each NeMo Guardrails release. Ask for the cost split between one-time and recurring work, and ask what changes the price if the configuration grows during the engagement.

Can our own team test NeMo Guardrails with promptfoo?

Yes, if the team can write Python or Node.js, read Colang or YAML configuration and review the output of test runs. promptfoo is available as a CLI and as a library, and it runs locally, so an engineer can install it, point it at a guardrails server or a Python provider and start running cases. The harder parts are usually not the tooling. They are deciding what counts as a correct block, building labeled attack and benign sets that reflect real traffic, and deciding how to read rail status. A team that has never measured false positives will need to define those rules before the first run produces useful numbers.

Should we test NeMo Guardrails through the server or a Python provider?

Test through the guardrails server when the production path calls the HTTP API, because the results then reflect the same entry point users hit. Use a Python provider when you want to call the Python API directly, control the configuration load, or pass custom context into the call. The server option tests deployment and HTTP behavior as well as rail logic, while the Python option is easier to debug and needs fewer moving parts. Many teams run both: the Python provider for fast iteration on configurations, and the server for release gates. Confirm which path your application uses before you choose, since a test that bypasses that path can pass while the live system behaves differently.

How does Colang migration affect the testing work?

If the configuration uses Colang 1.0, which is the default, and you plan to move to Colang 2.x, the test suite must cover both versions during the transition. NVIDIA documents a migration path using the nemoguardrails convert tool and states that converted configurations still need manual review. Each converted flow should be checked against the same attack and benign cases, and differences in block decisions should be recorded rather than assumed to be improvements. Keeping one suite that runs against old and new configurations makes the migration measurable. Plan time for this review, because converted output can change behavior in subtle ways even when it loads without errors.

Is promptfoo free to use with NeMo Guardrails?

promptfoo is licensed under the MIT license, and the Community edition is free. It includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. NeMo Guardrails is licensed under Apache 2.0. Costs can still arise from model calls made during tests, from infrastructure to host a guardrails server, and from services that help you design or run the suite. Enterprise and On-Premise editions add team sharing, SSO, role-based controls, continuous monitoring and priority support at custom pricing, which you need only if those capabilities are required. Confirm the license terms of any model or service your configuration calls.

What do we need to prepare before the first test run?

Prepare a working NeMo Guardrails configuration, a pinned version of the library or server image, a labeled attack dataset, a labeled benign dataset and a definition of what a correct outcome means for each case. The library supports Python 3.10 through 3.13, so the test environment should match a supported interpreter. Decide how model credentials will be supplied to the tests and where results will be stored. Without a pinned version, a later library release can change rail behavior and make results impossible to compare. Ask your team or partner to confirm the version, interpreter and credential handling before writing any assertions.

What breaks most often when comparing NeMo Guardrails configurations?

The most common failure is comparing two configurations under different conditions. The model behind the rails, the library version, the dataset and the interpreter must all stay fixed, or the difference you measure may come from the environment. The second failure is reading rail status incorrectly, for example treating an error or a skipped check as a pass. Record errors separately from blocks and passes, and keep a record of the exact configuration files that produced each result. Review a sample of blocked and allowed cases by hand before accepting the aggregate numbers.

How a test request flows through NeMo Guardrails and promptfoo

The flow starts in the promptfoo runner on your machine, which sends each test prompt either to a NeMo Guardrails server or to a Python provider that loads the configuration directly. Inside the guardrails environment, input, dialog, retrieval, execution and output rails decide whether the request reaches the model and whether the response leaves. The response returns to promptfoo with the rail status, and the assertion step reads that status. Check that the status, not just the text, is what your assertions test.

Trust boundary between the local promptfoo runner and the guardrails environment.

How DeployOpen works on this

DeployOpen plans and runs promptfoo guardrail tests for NeMo Guardrails configurations inside the infrastructure you control, with the attack and benign sets, provider wiring and comparison reports agreed in writing first. Engagements are fixed-scope, and ongoing support is available as a retainer.

How we scope

  • Confirm which NeMo Guardrails configurations, rail types and Colang versions are in the test scope
  • Agree whether tests run through the guardrails server or a Python provider, and where each will run
  • Set out in writing the attack sets, benign sets, assertions and comparison reports to be delivered

How we build

  • Wire promptfoo to your guardrails endpoint or Python provider and record rail status per test case
  • Build attack and benign datasets that match the application's real traffic and its blocked topics
  • Check that the test harness reports errors separately from passes and failures before results are trusted

How we hand over

  • Deliver the promptfoo configuration, datasets and provider code in a repository your team owns
  • Provide a written report comparing configurations, with block rates, false positives and error counts
  • Walk your engineers through reading rail status and rerunning the comparison before each release

How we support

  • Rerun the suite when NeMo Guardrails versions change, after confirming the release notes and upgrade effects
  • Add retest cycles after configuration fixes so you can see whether each change moved the numbers
  • Offer ongoing support and continuous testing as a retainer if your team wants them after handover

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.