Scanning a NeMo Guardrails app with garak

Running garak against a NeMo Guardrails application shows which vulnerability categories your rails actually stop and which gaps need new rails. This page covers the method, the configuration choices, and what to confirm before you rely on the results.

On this page

Scanning a NeMo Guardrails app with garak to find the gaps your rails miss

A team that has built a NeMo Guardrails app needs evidence of which attacks get through, and garak is the open-source scanner that produces it. garak probes the application with and without its rails and reports protection rates per vulnerability category, so the difference between the two runs shows what the rails actually stop. garak, the Generative AI Red-teaming and Assessment Kit, is licensed under Apache 2.0, runs from the command line, and is built from plugins in five categories: probes that send attack prompts, detectors that judge the responses, evaluators, generators that connect to the model or endpoint, and harnesses that orchestrate the run. The default probewise harness runs each probe with its recommended detectors, which is a sensible starting point before you tune anything.

Run this scan when a rail configuration changes, before a release that touches prompts or models, and when an assessor asks how the application handles known attack families such as prompt injection, jailbreaks, data leakage and toxicity. Point garak at the guardrailed endpoint through its REST generator, which needs a short YAML file describing the endpoint, then point it at the same model with the rails bypassed. Confirm with your own team how the baseline will be reached in your deployment, because the comparison is only meaningful if both runs use the same model, prompts and settings. Each run writes a JSONL report of every attempt, and by default garak makes 5 generations per prompt and marks a probe FAIL when any attempt produces undesirable output, so read the failure rates per category rather than a single pass or fail.

garak complements policy evaluation and red teaming; it does not replace them. garak applies broad, known attack libraries and tells you where the known patterns succeed. It does not know your policies, your dialog flows or your business logic, so it cannot confirm that an off-topic answer is refused or that a tool call is authorized. Use it to find category-level gaps, then turn each gap into a new rail or a tested change, and check that change with your own policy evaluation and unit tests. Record the garak version you ran, since garak v0.17.1 was released on 16 October 2026 and results can shift between releases.

How to set up a garak scan of a guardrailed endpoint

This sequence takes a NeMo Guardrails application from a working Python environment to two comparable garak runs, one without rails and one with rails enabled. The output is a pair of JSONL reports and garak.log entries that show protection rates per vulnerability category for the same endpoint.

  1. Confirm the Python version and environment

    The engineer running the scan confirms that the workstation or scan host runs Python 3.11 or newer, because the garak PyPI package requires that version, and that NeMo Guardrails 0.25.0 is installed in its own virtual environment on Python 3.11, 3.12 or 3.13. Keep the two tools in separate environments so a dependency conflict in one does not block the other. Done when python --version reports a supported version and pip show nemoguardrails reports the expected release.

  2. Install garak from PyPI

    Install the scanner with pip install garak in the scan environment, then run python -m garak --help to confirm the command-line entry point works. Record the installed version, since garak v0.17.1 was released on 16 October 2026 and probe behavior can change between releases. Done when the help output lists the probe, generator and report options and the version is written into your scan notes.

  3. Expose the guardrailed app behind a REST endpoint

    Start the NeMo Guardrails application either as a guardrails server that loads a configuration folder and exposes an HTTP API, or as a small wrapper around the Python API that accepts a prompt and returns the model response. The server option is usually easier to point a REST generator at. Confirm that the configuration folder holds config.yml and the Colang files, then check the server log for a line showing the configuration loaded without errors. Send one benign request with curl and confirm a JSON or plaintext answer comes back.

  4. Write the REST generator YAML file

    Create a YAML file that describes the endpoint for garak's REST generator, including the URL, the HTTP method, the headers and the request and response shape that the endpoint uses. Keep the file in version control next to the NeMo Guardrails configuration so the two stay matched. Run garak against the file with a single probe and a small generation count first. Done when garak reports at least one generation from the endpoint and the response text is readable in the report, which confirms the generator reaches the endpoint and parses its output.

  5. Run the baseline scan without rails

    Run garak against the endpoint with the rails disabled, either by pointing at a configuration that has no input or output rails or by reaching the underlying model directly through a second generator entry, so the baseline measures the model without the guardrail layer. Use the default probewise harness so each probe runs with its recommended detectors. Keep the generation count and probe selection identical to the rails run that follows. Done when the run finishes and writes a JSONL report, and the garak.log file records the run start and end.

  6. Run the scan with rails enabled

    Restart or reconfigure the NeMo Guardrails endpoint with the rails you intend to ship, then confirm in the server log that the configuration loaded and that the input and output rails are registered. Send one prompt that should be blocked and confirm the response shows the rail acting. Then run the same garak probes against the guarded endpoint. Done when the second JSONL report exists and the rails are confirmed active in the log, so the two runs differ only in the guardrail layer.

  7. Check the JSONL report and garak.log after each run

    Open each JSONL report and confirm it contains one record per attempt with its evaluation, then compare the failure rates per probe between the baseline and the guarded runs. Read garak.log for generator errors, timeouts or detector failures, because an endpoint that errored produces misleading pass rates. A run is valid only when the attempt counts match between the two runs and the log shows no unhandled errors. Record any gaps as inputs to new rails.

Which garak generator and comparison setup fits your app

This is the most common setup for a deployed application. You point garak's REST generator at the HTTP endpoint that your NeMo Guardrails server exposes, so every probe travels the same path that real users and client applications use. garak connects to any REST endpoint that returns plaintext or JSON, and you describe the endpoint in a short YAML file. Because the request crosses your real routing, authentication and rails, the results measure the protected application as deployed, including any configuration drift between environments.

  • What it measures: the end-to-end protection rate of the application, including input rails, output rails and any gateway in front of them.
  • What it needs: a reachable staging endpoint, a test credential, and a YAML file that matches the request and response format of your API.
  • Main risk: a misconfigured response parser can make every answer look safe or every answer look broken, so check a few raw responses in the JSONL report first.
  • Cost driver: the number of probes and generations per prompt, since each attempt is a real call to your endpoint and may trigger model and safety model calls.
  • Ask your team: whether the test endpoint uses the same configuration version and model backend as production.

Before trusting results, confirm the endpoint, authentication and rails configuration match the release you intend to ship.

How to read protection rates per vulnerability category

A garak FAIL is a failure rate, not a verdict. By default garak makes 5 generations per prompt, and it marks a probe as FAIL when any attempt produces undesirable output. A probe that fails on one of five attempts is still a FAIL, so the number to read is the failure rate for each probe within a category, not the label alone. When you compare the run with rails against the run without rails, line up the same probes, the same generator settings and the same number of attempts, then compare the failure rates category by category. A category where the rate drops sharply with rails is evidence the rails work, while a category that stays flat points to a gap that a new rail or a changed prompt must close.

Do not treat a single FAIL as proof that a rail is broken. Each probe sends adversarial prompts that are judged by detectors, and a detector decides what counts as undesirable output. Detectors can flag a response that is harmless in your context, or miss a response that is harmful in yours. Before you act on a result, open the JSONL report for the failing probe, read the actual prompt and response pairs, and confirm that the detector's judgment matches your policy. Record the detector names alongside each rate so the results can be reproduced later.

Detector choice and the default probewise harness determine what your numbers mean. The probewise harness runs each probe with the detectors recommended for it, so two teams running the same probes can report different rates if they select different detectors or harnesses. Confirm which harness, detectors and generator settings your team used, and keep the same configuration for the with-rails and without-rails runs. Only then can a change in a category rate be attributed to the guardrails rather than to a different measurement setup.

Turning garak gaps into new rails

A garak category that fails is a gap in the guardrail configuration, not a finding to close in a report. The steps below turn each failing category into a rail, prove the rail blocks the same probes, and keep it from regressing. Each step has a checkpoint you can confirm before moving on.

Map the failure to a rail type

Read the failing attempts in the JSONL report and decide where the bad content enters. Input rails stop hostile prompts, dialog rails steer multi-turn conversations, retrieval rails filter RAG chunks, execution rails guard custom actions and tools, and output rails catch responses. A leak that comes from a retrieved document needs a retrieval rail, and placing it on the input side will miss it. Confirm the rail type before writing any code.

Write the Colang or Python action

Express the rule as a Colang flow for pattern and intent logic, or as a Python action when the check needs code, such as calling an internal classifier or a deterministic filter. Colang 1.0 is the default, and Colang 2.0 is also supported, so confirm which version your config.yml loads before writing flows. Keep the check narrow enough that it targets the failing category rather than everything near it.

Register the rail in config.yml

Add the new flow or action to the rails section of config.yml on the correct side of the pipeline, and keep the change in version control with the prompts it depends on. Check the order of rails, because an earlier rail that already blocks a request can hide whether the new one works. Record which config revision each garak run used so results can be compared.

Rerun the same probes

Run garak against the same generator and the same probe set you used for the baseline, with the same number of generations per prompt. Compare the protection rate for the category before and after the change, and check that the other categories did not get worse. Changing the probes, the detectors or the generator between runs makes the comparison meaningless, so write those choices down before the first run.

Add a regression test

Turn each failing attempt into a unit test that pins the blocked behavior, so a later prompt edit, flow change or library upgrade cannot silently reopen the gap. Keep the test input close to the attack pattern that garak used, and add a benign example beside it. Confirm the test fails when the new rail is removed, which proves it checks the rail and not the model's default behavior.

Measure latency and false positives

A new rail adds processing time and can refuse legitimate requests, and neither effect appears in a garak run. Measure latency on representative traffic and track how often benign requests are refused, as separate work from the security rerun. Ask the team that owns the product to agree on an acceptable trade-off before the rail goes to production, and record the result alongside the garak report.

How garak traffic flows through the guardrailed app

The scan starts in garak, where probes generate attack prompts and detectors judge the replies. A REST generator carries each prompt across the trust boundary to the NeMo Guardrails server, where input rails run before the model and output rails run before the reply returns. Check that the rails sit on the path you intend to test, then confirm the JSONL report and garak.log written at the end.

Attack prompts cross from garak into the app, and results are written to two files.

Security and operational considerations for running scans

A garak scan sends attack prompts to a live application and writes everything it sees to disk. The cards below cover what to authorize, what to protect, what a scan costs to run, and how to keep scans useful over time.

Authorize every target first

garak sends adversarial prompts to the target by design, so the scanned endpoint must belong to you or to a party that has approved the test in writing. Confirm which endpoints the scan may reach, including any downstream tools or retrieval services the guardrailed app calls. Also check where prompts and responses are stored by the target provider and by your own logging, since a scan can route sensitive test content through third-party model APIs.

garak user guide

Protect the JSONL reports

Each run writes a JSONL report of every attempt and its evaluation, and garak.log keeps debugging output across runs. Model outputs in these files can contain harmful text, leaked data or fragments of your system prompt, so treat them as sensitive. Restrict read access to the people who triage findings, set file permissions on the report directory, and decide how long reports are kept before they are deleted.

Plan cost and load on production endpoints

Each probe sends many prompts, and by default garak makes 5 generations per prompt, so a scan multiplies traffic against the target. Against a production endpoint this can consume rate limits, degrade service for real users and bill your account on a paid model API. Run scans against a staging copy where possible, agree a request budget with the model owner, and set a ceiling on the run before it starts.

Keep API keys out of YAML

Generator configuration files for garak and the guardrails configuration often sit in version control, so a key written into a YAML file can leak with the next commit. Pass credentials through environment variables or your secrets manager, and keep only the variable names in the configuration. Confirm that garak.log and the JSONL reports do not echo request headers or keys, and rotate any credential that appears in a shared report.

garak README

Scan on a schedule and on change

A scan proves a guardrail held on the day it ran, so results go stale when prompts, rail configurations, models or the garak version change. Run the same probe set on a fixed schedule and again after every configuration or model change. Keep the probe list and garak version pinned between runs, so that a drop in protection rate reflects the application and not a changed test.

Questions buyers ask before scanning a guardrailed app

Is garak free to use, and what does running a scan actually cost?

The garak tool is free. Its maintainers describe it as a free tool, and it is licensed under Apache 2.0. The costs of a scan are the model API charges for every probe attempt sent to your application and the judge or detector calls that some probes make, plus the engineering time to set up the endpoint, read the reports and triage findings. API charges recur with each run and grow with the number of probes and generations, so ask your provider for per-token pricing and estimate the request volume from the probe set you choose. Engineering time is largely one-time setup and recurs for each retest after a rail change.

How long does a garak scan take, and what makes it longer?

Duration is driven by three things: how many probes run, how many generations each prompt gets, and how fast your application responds. garak makes 5 generations per prompt by default, so each probe multiplies the calls your application must answer. A narrow probe selection against a fast endpoint finishes far sooner than a full sweep against a slow, rate-limited chain with several rails in the path. Before committing to a schedule, run a small subset, measure the response time, and extrapolate to the full probe list. Ask any partner to show the calculation behind its schedule.

What do we need to provide before a garak scan can start?

You need three things. First, network access to the application endpoint from the machine running garak, usually an HTTP API exposed by the NeMo Guardrails server or a gateway in front of it. garak's REST generator can reach any endpoint that returns plaintext or JSON, configured with a short YAML file. Second, test credentials for a non-production environment with the same rails and model settings as production, so scan traffic does not pollute real user data or trigger real account controls. Third, a named owner who receives the findings and decides which gaps become new rails or accepted risks.

Can our own team run garak against a guardrailed app without a partner?

Yes, for a single application with a clear configuration. garak is a command-line tool installed from PyPI with pip, it requires Python 3.11 or newer, and it writes a JSONL report of every attempt plus a garak.log file. A team that owns one NeMo Guardrails configuration can run the default probewise harness, read the protection rate per category, and fix obvious gaps. The work gets harder when many applications share rails, when results must be defensible to auditors, or when findings require changes to Colang flows, actions and model settings across several teams at once.

What does a partner add beyond running the scanner?

A partner adds scoping, gap analysis and the engineering that turns gaps into controls. Scoping decides which probe categories match your threat model, so the scan reflects real attack paths rather than a generic list. Gap analysis compares results with and without rails, showing which rail blocked each attempt and which attempts passed through. Then the work includes writing or tuning input, output or dialog rails, rerunning the scan to confirm the fix, and documenting the evidence. The scope, deliverables and timeline are agreed in writing before work starts, and a quote follows from that scope.

How should we read the protection rates that garak reports?

Read each category separately and check the failure definition before comparing numbers. garak marks a probe as FAIL with a failure rate when any attempt produces undesirable output, so one leaking generation out of five counts against the whole probe. Compare the same probes with and without rails, using the same model and generation settings, or the difference reflects configuration drift rather than your guardrails. Treat a high protection rate as evidence only for the probes and generations you ran, and confirm with the detector used by each probe whether its judgments match your own policy.

Does running garak create security or data risks of its own?

It can, so manage the run like any other security test. Scan traffic is adversarial by design, and the JSONL report and garak.log can contain prompts, model outputs and any sensitive content the model reveals. Store them in a controlled location, restrict access, and avoid pointing the scanner at production systems that have real users, billing or external side effects. Confirm with your security team which environments, source IP ranges and rate limits are approved before the first run, and record who authorized the test.

What DeployOpen scopes when it runs this scan for you

DeployOpen agrees the scope of a garak scan in writing before any probe is sent. The scope fixes the target endpoints: the guardrailed application's HTTP interface, and, for the baseline, the same application with its rails switched off or the underlying model reached directly. It also lists the vulnerability categories in scope, the probe families and detectors that will run against them, and the number of generations per prompt. Garak's default of 5 generations per prompt is a starting point that the scope should confirm or change. Your team should also confirm which environment the scan targets, because a staging endpoint with production-like rails is usually the right choice.

The scope also covers authorization and handling. Before testing starts, the client confirms in writing who may approve the scan, which accounts and API keys the tool will use, the testing window, and how the JSONL reports and garak.log files are stored, since they will contain adversarial prompts and model output that may echo sensitive data. The baseline comparison is defined here too: the same probes run with and without rails, so every protection rate can be read against an agreed starting point. DeployOpen does not issue audit reports or certifications. The output is a findings report that the client can use as evidence in its own assessments.

The deliverable is a findings report with protection rates per vulnerability category, a gap list that ties each failed category to the rail or configuration change that addresses it, the rail fixes DeployOpen implements or recommends, and a retest of the changed categories after the fixes are in place. Ask for the retest scope to be written into the same agreement, so the fixes are checked against the same probes and thresholds that exposed the gap. Confirm the report format and the retest window with DeployOpen during scoping rather than assuming them.

How DeployOpen scopes, delivers and supports garak scans

DeployOpen approaches a garak scan of a NeMo Guardrails application as a written, fixed-scope piece of work. We agree which endpoints, rail configurations and vulnerability categories are in scope, then run the scans, turn gaps into tested rails and document the evidence for your team.

How we scope

  • Agree in writing which application endpoints, rail configurations and garak probe families the scan covers
  • Confirm the Python version, garak release and NeMo Guardrails release that the test environment will use
  • Define which protection-rate results count as acceptable for your threat model and who signs off on them

How we build

  • Configure the REST generator for your endpoint so scans run with and without rails under identical settings
  • Run the probes, keep the JSONL reports and garak.log files, and map every FAIL to a vulnerability category
  • Write and test new input or output rails for confirmed gaps, then rerun the affected probes to confirm the change

How we hand over

  • Deliver a findings report with per-category protection rates, before and after results, and the exact garak settings used
  • Provide the rail configuration, Colang files and any custom actions in your own repository with a clear change history
  • Walk your security and engineering teams through how to repeat the scan and read its reports

How we support

  • Offer ongoing retesting after prompt, model or NeMo Guardrails upgrades as a retainer, if your organization wants it
  • Confirm with your team how often scans should run, and which events in your release process should trigger them
  • Review new garak releases in the written scope so that changes in probes and detectors are reflected in later reports

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.