Testing NeMo Guardrails with garak

Scanning a guarded LLM application with garak's NeMo Guardrails generators shows how well input and output rails hold up against jailbreak and injection probes. This page covers the method, prerequisites, setup sequence and common failures.

On this page

Testing NeMo Guardrails with garak: what the scan measures

A team that has placed NeMo Guardrails rails in front of an LLM application needs evidence that those rails hold up against jailbreak and injection attempts. garak's NeMo Guardrails generators answer that question by sending probe prompts through the rails configuration before they reach the model, then recording what the application returns. The scan can run in process, where the generator loads the rails configuration directly through the Python API, or against a guardrails server that loads configurations from a folder and exposes an HTTP API. Either way, the result describes the guarded application, not the bare model. A probe that fails tells you the combination of input rails, output rails, prompts and the underlying model let undesirable output through. A probe that passes tells you the same thing about that combination, which is why the rails configuration and model must be fixed and recorded before you read the numbers.

garak is built from five plugin categories: probes, detectors, evaluators, generators and harnesses. For this work, the generator is the part that changes. It wraps the guarded application so each probe prompt travels through the rails, while the probes supply the attack text, the detectors judge each response, and the default probewise harness runs each probe with its recommended detectors. Because garak makes 5 generations per prompt by default and marks a probe as FAIL when any attempt produces undesirable output, a single lucky refusal does not hide a weakness. Confirm which probe families your scan includes, and check the generator's current options in the garak user guide before you set the attempt count, since those settings change how strict the result is.

Before the first run, confirm the environment with your own team: the Python version for garak and for the NeMo Guardrails release you pin, the rails configuration under test, and whether that configuration is hosted by NVIDIA or by your organization. NVIDIA has retired the NeMo Guardrails microservice, so a guardrails server you run should be built from the open-source library in infrastructure you control. Record the garak version, the NeMo Guardrails version and the configuration hash with each report, because the JSONL report and garak.log only explain a result if you can tie them to the exact application that produced it.

What you need before the first guarded scan

A guarded scan depends on four things lining up: the garak install, the NeMo Guardrails version and its configuration, the model the rails call, and the network path to any guardrails server. Confirm each one before you choose a deployment target, because the guardrails server option depends on a product whose support status has changed.

garak installed on a supported Python

Install garak 0.17.1, released on 16 October 2026, from PyPI into a dedicated virtual environment. The PyPI package requires Python 3.11 or newer, and garak is developed on Linux and macOS, so confirm your scan host matches those platforms before you plan the install. Record the exact version in your scan notes, because scores can shift between garak releases and a later comparison needs to know which version produced each report.

garak on PyPI

NeMo Guardrails on a supported Python

NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13. Pin the version in the same environment or a separate one, and confirm that the rails you configure use features in that release. The 0.25.0 release deprecates the LLMRails class in favor of Guardrails, so check your configuration code and any scan harness against the 0.25 migration guide before you start.

nemoguardrails on PyPI

Rails configuration folder

The guarded application is defined by a configuration folder that holds the rails your scan will exercise, including input rails, output rails and any dialog or execution rails. Confirm which rails are enabled, where the self-check prompts live, and whether the folder is under version control. Freeze a copy of this folder for each scan, because a change to a single rail can change every result in a comparison.

Model the rails call

Rails usually call a separate model for self-check moderation, jailbreak detection and the main answer. Identify each model, its provider, and the endpoint and credentials it needs, and make sure the scan host can reach them. Your scan will measure the combined system, so a weak or differently configured rail model changes the result even when the application model stays the same. Ask the model owner for the exact version in use.

Guardrails server network and credentials

If you scan a guardrails server over HTTP, confirm the host and port, the route your scan host uses to reach it, and how the server authenticates callers. Decide where the API key or token is stored, and keep it out of the garak configuration file that you share with reviewers. Confirm that the server image and configuration match the version you tested, since a server built from a different configuration will not produce a comparable scan.

Confirm the NeMo microservice sunset

NVIDIA has retired the NeMo Guardrails microservice container, and its NGC notice says there will be no new releases or support. NVIDIA's archived NeMo Microservices documentation directs existing users to their NVIDIA account team, and the NeMo Platform repository now points to an open source control plane that runs guardrails as gateway middleware. Before you choose between in-process scanning and a server, ask your NVIDIA contact which deployment path is supported for your organization.

NeMo Microservices archive

In-process generator or guardrails server: which to choose

In the in-process path, the garak process imports the NeMo Guardrails library and sends each probe prompt through the rails configuration loaded in the same Python environment. This is the simplest setup to start with because there is no service to run, no port to open and no image to build. It suits a security engineer who wants to iterate on a rails configuration quickly and compare results between edits.

  • Fewer moving parts: You install garak and nemoguardrails into one environment and point the generator at a configuration folder.
  • Shared dependencies: The NeMo Guardrails library and its model dependencies must install alongside garak, and version conflicts become your problem to resolve. NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13.
  • Weaker deployment fidelity: You test the library's behavior, not the container or server configuration that users actually reach.
  • Local secrets and models: Any model or provider credentials the rails need live in the scanning host's environment, so this host needs the same access controls as the application.
  • Good for iteration: Scans run quickly in a loop while rails are being written.

Before relying on this path, confirm the generator name and its options in the garak user guide, and confirm which configuration keys are read from the folder you supply.

How to configure the scan, step by step

This sequence takes a team from a clean Python environment to a repeatable pair of garak runs, one against the unguarded model and one against the guarded application, so the difference in results can be attributed to the rails. Each step ends with a file or check you can verify before moving on.

  1. Create a pinned Python environment

    Create a dedicated virtual environment on a Linux or macOS host using Python 3.11 or newer, because the garak PyPI package requires it. Install garak from PyPI and nemoguardrails at versions you record in a requirements file, noting that NeMo Guardrails 0.25.0 supports Python 3.11, 3.12 and 3.13. Run garak's version command and a Python import of nemoguardrails to confirm both install cleanly, and save the frozen package list next to the scan configuration so later runs can reproduce the setup.

  2. Prepare the rails configuration folder

    Create a configuration folder that holds the model settings and the input and output rail definitions your application uses, following the NeMo Guardrails documentation for the Colang version you target. If you are writing new configurations, check the Colang 2 migration guide before you start, and note that LLMRails is deprecated in 0.25.0 in favor of Guardrails. Load the folder once with the NeMo Guardrails Python API and send a benign message and a known-bad message to confirm that the rails respond as written.

  3. Choose the NeMo Guardrails generator path

    Decide whether garak calls the library in process or talks to a guardrails server over HTTP. In-process testing exercises the same Python code path as your application, while a server test covers the HTTP layer, authentication and any gateway in front of the rails. Start the server from the configuration folder if you use that path, and confirm its HTTP API responds to a test request. Record the choice in the scan configuration, because the two paths can produce different results for the same prompts.

  4. Select jailbreak and injection probes

    Choose probe families that match the rails under test, such as jailbreak and prompt injection probes, and list them by name or tag in the configuration file rather than on the command line. Keep the same probe set for the baseline and the guarded run so the comparison is fair. Run garak's list command for the probe names available in your installed version, and confirm that each selected probe appears in the output before starting a scan.

  5. Set generations and the output directory

    Set the number of generations per prompt in the configuration. garak's default is 5 generations per prompt, and a probe is marked FAIL when any attempt produces undesirable output, so a higher count finds rarer failures but lengthens the run. Point the report prefix to a dated output directory, and make sure the directory is writable. Record the generation count with the results, because changing it later changes the failure rates you compare.

  6. Run the baseline against the unguarded model

    Run garak against the bare model that sits behind the application, using the same probes, generation count and detectors you will use for the guarded run. This baseline shows how the model behaves without rails, so you can tell whether the guardrails reduce failures or the probes simply do not fire. When the run ends, confirm that a JSONL report exists in the output directory with one record per attempt, and that garak.log has appended the new run's entries.

  7. Run the guarded application and compare results

    Run the same configuration against the guarded application, changing only the generator so it calls the NeMo Guardrails library or server. Confirm that the new JSONL report contains attempts routed through the rails, and check garak.log for errors that could invalidate the run, such as connection failures or timeouts. Compare the per-probe failure rates from the two JSONL reports, and keep both files together with the frozen package list so the result can be reproduced later.

Why a baseline scan against the unguarded model matters

A guarded result means little on its own. A garak run against a NeMo Guardrails configuration tells you which probes still succeed, but not whether the rails caused the difference. Run the same probes against the bare model first, then against the guarded application, and the gap between the two runs shows what the input and output rails actually stop. If the bare model already refuses most jailbreak and injection prompts, the guardrails are doing less work than the headline numbers suggest. If the bare model fails widely and the guarded application fails rarely, you have evidence the rails are contributing. Record both reports together so the comparison is traceable.

The comparison only holds if the two runs are identical except for the target. Keep the same garak version, the same probe selection (by name, family or tag), the same generation count and the same detectors across both runs. Use one configuration file for both, and change only the generator settings that point at the bare model or the guarded endpoint. Note that the default is 5 generations per prompt, so if you change that value for one run, you must change it for the other. Confirm the exact generation setting and any buffs or system prompts in your configuration file before comparing results, since a mismatch will shift the numbers without any change in the model's behavior.

Read the FAIL marker with care. garak marks a probe as FAIL when any single attempt produces undesirable output, so a failure rate reflects how often the attempts succeed across the generations, not whether the probe ever succeeded once. A probe with a low failure rate on the guarded application can still be worth fixing, because one successful attempt in five is enough to count as a failure. Compare failure rates per probe between the baseline and the guarded run in the JSONL report, and treat a rail as holding only where the guarded rate falls clearly below the baseline rate for that probe.

How rails, probes and report fields map to each other

This table links each NeMo Guardrails rail type to the garak probe families most likely to exercise it, and to the report fields a reviewer reads to trace a bypass. Use it to decide which probes to run against each rail and where to look in the JSONL output. Confirm exact probe names in the garak user guide before building a configuration.

Rail or componentProbe families likely to exercise itJSONL fields to read
Input railsJailbreak and prompt injection probes that arrive as direct user messages, including encoding-based variantsprompt and status fields on each attempt, plus the detector result showing the model reply was flagged
Output railsProbes whose undesirable content appears in the model reply, such as toxicity and data leakage probesoutput text and detector score, compared with the status field to see whether the reply reached the user
Dialog railsMulti-turn jailbreak and persona probes that try to steer the conversation off its defined flowsconversation or turn context in the attempt record, to confirm which turn broke the flow
Execution railsProbes that push the model toward unauthorized tool or custom action calls, where a tool is configuredtool or action fields in the attempt record, if the generator returns them, and the garak.log entries for that run
Retrieval rails (RAG chunks)Indirect injection probes only if your application retrieves documents, so the malicious text enters through contextthe prompt field, which shows the injected context, and the output field for the resulting reply
Run-level tracingAny probe family, since every attempt is recordedrun identifier and timestamp, so a finding can be matched to a specific configuration and rail version

Security settings for guardrails test environments

A guardrails scan puts three things in one place: the rails under test, the model credentials they call, and the attack prompts and outputs garak records. Each card below covers one of those exposures, so the test environment is itself controlled while garak measures the application.

Scope the model API key

The guardrails server calls the underlying model with its own credential, so the key set in the environment is a production-grade secret even on a test host. Issue a separate, low-quota key for the scan, store it in your secrets manager, and pass it to the server at runtime rather than writing it into configuration files. Ask the model provider whether the key can be restricted by model, spend limit or IP range, and revoke it when the test window closes.

Isolate the guardrails server

Run the guardrails server and the garak host on a test network that cannot reach production data stores, internal tools or the open internet beyond the model endpoint. Attack prompts routinely try to make an application call tools or fetch URLs, so execution rails and any connected actions should have no path to systems you care about. Confirm egress rules with a packet capture before the first scan.

Limit who can edit rails

The rails are the control under test, so their configuration folder should be read-only for the scan and writable only by the people who own the change. Record a checksum of the configuration directory before the run and compare it afterward. If a rail is modified mid-run, the results describe a mix of two configurations and cannot be attributed to either.

Protect reports with attack content

garak's JSONL report stores every attempt, including the jailbreak prompt and the model's response, which can contain sensitive text if the application retrieves private data. Store reports in an access-controlled location with retention rules that match your data policy, and avoid copying them into tickets or chat channels. Treat each report as a record of successful attacks against your application.

garak README

Keep garak.log free of secrets

The garak.log file is continued across runs and is useful for debugging, so it can capture configuration details, endpoint addresses and error messages that include headers. Check the log for key fragments after a test run, and set the log level and file location deliberately. Rotate or delete the log with the reports when the scan evidence is archived.

Common failures when scanning NeMo Guardrails

This table lists the failures teams most often hit when pointing garak at a NeMo Guardrails setup, with the likely cause and the fix for each. Work through the rows in order before reading any scan result, because several of these failures produce output that looks like a clean pass.

FailureLikely causeFix
Installation fails or garak will not startNeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13, and garak's PyPI package requires Python 3.11 or newer. An older interpreter in the virtual environment causes the install to fail.Create the virtual environment with a supported Python version, install both packages in that environment, and confirm the versions before running any scan.
Missing or invalid rails configuration folderThe guardrails server or Python API cannot find the configuration folder, or the folder lacks the expected configuration files, so the server starts without the rails you intended to test.Pass the configuration folder path explicitly, confirm that it contains the expected files, and check the startup log for the rails that actually loaded before scanning.
Deprecated LLMRails class in 0.25.0NeMo Guardrails 0.25.0 deprecates the LLMRails class in favor of Guardrails, with removal planned no earlier than 0.27.0. Generator code written against LLMRails still runs in 0.25.0 but will need changes before a later upgrade.Migrate the generator and any scripts to Guardrails using NVIDIA's 0.25 migration guide, then rerun a baseline scan so the new results can be compared with earlier ones.
Server connection or authentication errorsThe REST or server endpoint is unreachable from the host running garak, the port or base path in the generator configuration does not match the server, or an API key expected by the server is missing from the environment.Test the endpoint with a simple request from the scanning host, match the host, port and path in the garak configuration, and set any required key through an environment variable rather than in the config file.
Rails block every prompt and hide real resultsInput rails refuse all probe prompts, so the model never receives an attack and every attempt is recorded as a refusal. The report then looks secure when the rails were never tested against the model.Run a control scan against the bare model and a scan against the guarded application, then compare the refusal rates. If the guarded run refuses nearly everything, review which input rail triggers and whether it fires on benign prompts too.
Reports cannot be compared across garak upgradesProbe sets, detector behavior and scoring change between garak releases, so scores from before and after an upgrade measure different things. Changes in the NeMo Guardrails version or rail configuration also shift results.Record the garak version, NeMo Guardrails version, configuration folder and probe selection with every run. Rerun the baseline on the new versions before reading any change in scores as a change in the application.

How a probe travels through the rails to the model and back

The run starts in garak on the test runner, outside the guarded application. Each probe prompt crosses into the application, passes the input rails, reaches the model, then returns through the output rails before garak's detectors and evaluator score the reply and write the JSONL report. The trust boundary sits between the test runner and the guarded application, so check which side holds the keys, logs and configuration, and confirm that rails blocking a prompt is recorded as a result rather than a crash.

Probe traffic crosses the trust boundary through the input and output rails before scoring.

Questions teams ask before scanning NeMo Guardrails

What drives the cost of a garak scan against NeMo Guardrails?

The cost depends on how many probes you run, how many generations each probe makes, and how much of the work your own team does. garak is free and licensed under Apache 2.0, so the license fee is zero, but scans still consume model calls, compute and engineer time. Model usage is the main recurring cost when the target calls a hosted provider. The default setting makes 5 generations per prompt, so a broad probe selection multiplies quickly. Engineering time covers wiring the rails configuration, writing the endpoint or generator setup, triaging failures and rerunning after fixes. When you ask for a quote, ask for the scope in writing, which probes and rail types are covered, how many retests are included, and whether model usage is billed to you or the provider.

How long does a NeMo Guardrails scan take to set up and run?

Setup time depends on the guardrails configuration, the target architecture and how much of it is already built. The garak run itself depends on the probe selection, the generation count and the speed of the model behind the rails. Your engineers should confirm the scan duration in their own environment with a small probe set before planning a full run, because hosted model rate limits and latency vary. garak writes a JSONL report and a garak.log file for each run, which makes it possible to measure how long a run took and to repeat it. Ask any partner for a timeline tied to a written scope rather than a general estimate.

Which NeMo Guardrails version should we pin for testing?

Pin the exact version your production guardrails use, and test it with garak before any upgrade. The current NeMo Guardrails release is 0.25.0, published on 19 November 2026 to PyPI under Apache-2.0, and the previous release was 0.24.1 on 16 September 2026. NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13. It also deprecates the LLMRails class in favor of Guardrails, with removal planned no earlier than 0.27.0, so configurations that use LLMRails should follow NVIDIA's 0.25 migration guide. Pair this with a garak version, currently v0.17.1 released on 16 October 2026, and record both in your scan reports so results remain comparable over time.

What does the NeMo Microservices sunset mean for our guardrails?

NVIDIA has retired the NeMo Guardrails microservice. The NGC catalog page for its container says NeMo microservices has been sunset as of October 1, 2026, with no new releases and no continued support for the artifact. NVIDIA's archived documentation says new development has moved to NeMo Platform and asks existing users to contact their NVIDIA account team. If your guardrails run as the microservice container, plan a migration to a supported deployment before you rely on scan results for evidence. The NeMo Helix repository, which the old NeMo Platform link now resolves to, describes NeMo Guardrails as an inference gateway middleware plugin. Confirm with NVIDIA which path applies to your environment, and whether the library or the server image is the right target for your scans.

Can an internal team run garak against NeMo Guardrails alone?

Yes, a team with Python and security testing skills can run garak alone, because garak is a command-line tool installed from PyPI and the NeMo Guardrails library can be called in process or through its HTTP server. The harder work is judgment: choosing probes that match your rails, interpreting failures against your policy, and deciding which findings need a fix. Your internal team needs access to the guardrails configuration folder, the model endpoint, and an environment where the scan can run safely. Many teams run a first pass internally and then bring in a partner for a fixed-scope review, a retest, or evidence preparation. Confirm which of these your team can staff and maintain on a recurring basis.

What does the client need to provide for an engagement?

A useful engagement needs the guardrails configuration, the application it protects, and a test environment that matches production as closely as possible. Typically this includes the configuration folder with its input and output rails, the model or endpoint the rails call, the rail types in use among input rails, dialog rails, retrieval rails, execution rails and output rails, and any custom actions or tools. You also need named contacts who can approve test traffic, a Python environment meeting the version requirements, and access to logs. Confirm the exact list with the partner before work starts, because the answer depends on whether the rails run in process or behind a server.

What does a fixed-scope NeMo Guardrails engagement cover?

A fixed-scope engagement covers an agreed list of targets, probes, deliverables and timelines, set out in writing before work starts. For this topic, that typically means configuring garak against the guardrails setup, running the agreed probes against jailbreak and injection categories, reviewing the JSONL reports and logs, and delivering findings with reproduction steps. Ongoing support, upgrades and continuous testing are available as retainers. DeployOpen does not publish a price list, and a quote follows from the written scope. The engagement does not include an audit report or certification, since independent auditors and certification bodies issue those. Ask for the deliverables, the number of retests, and what happens if the rails configuration changes mid-engagement.

Does a passing garak scan prove our guardrails are secure?

No. A scan measures how the rails respond to the probes that were run, under the settings used, on the day of the run. garak marks a probe as FAIL when any attempt produces undesirable output, which means a clean result only covers the prompts tested. Results shift with probe selection, generation count, model version and rails configuration, so a pass should be read as one data point. Keep the garak version, NeMo Guardrails version, configuration files and report files together so you can explain what was tested. Treat the scan as an input to your own risk review rather than a guarantee.

How DeployOpen scopes and delivers guardrails testing

DeployOpen scopes garak runs against your guarded application as a written, fixed-scope engagement, then builds the test harness inside your environment and hands over the results. Work is run against the guardrails configuration and endpoints you operate, so the findings reflect the system your users actually reach.

How we scope

  • Confirm which NeMo Guardrails version and deployment mode your application uses, in process or as a guardrails server.
  • Map the input rails, output rails and any retrieval or execution rails that the scan must exercise.
  • Agree the probe families, jailbreak and injection coverage and the endpoint access needed, in a written scope before work starts.

How we build

  • Set up garak in a controlled environment that meets your Python 3.11 or newer requirement and your network rules.
  • Write the generator configuration that connects garak to your guarded application or server endpoint.
  • Run baseline and rail-specific scans, then verify that each rail is reached and that reports capture every attempt.

How we hand over

  • Deliver the JSONL reports, a findings summary mapped to each rail and the configuration files used to produce them.
  • Document how to rerun the scan, including the generator settings, probe selection and the place where logs are stored.
  • Walk your security and platform teams through the results and agree which findings need fixes and a retest.

How we support

  • Retest guardrail configurations after fixes, using the same probes so results can be compared with the original run.
  • Review results again when you upgrade NeMo Guardrails or move to a newer NeMo platform component, and confirm the generator still works.
  • Continuous testing and scheduled rescans are available as a retainer, with scope and cadence agreed in writing.

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.