Red teaming an LLM app protected by NeMo Guardrails

Plan adversarial testing of a NeMo Guardrails application with open-source tools, scoped to your threat model and repeated after every change.

On this page

How red teaming a NeMo Guardrails app proves the rails hold up

A security reviewer will not accept that attacks were considered when a guardrailed assistant ships. They will ask which attacks were run, against what, and whether the same tests run again after the next change. Red teaming answers that question for the whole application, and it goes further than the rail-level evaluations. Those evaluations check whether a single rail blocks what it was built to block. Red teaming checks whether an attacker can reach a harmful outcome through the assembled system: the prompt, the retrieval layer, the custom actions and tools, the system prompt, the model endpoint and the logs that record what happened. The target is the application, not only the Colang and config.yml files.

Teams need red teaming at three points: before launch, after any change to a rail, prompt or model, and before an external audit or customer security review. The plan should be scoped to your threat model first. List the assets the assistant can reach, the users who can reach it, and the outcomes you must prevent, such as leaking customer data through a tool call or being steered off approved topics. Then choose tools for the scope. garak probes an endpoint for weaknesses such as prompt injection, jailbreaks and data leakage, and it writes a JSONL report for each run. promptfoo runs red team suites in CI/CD pipelines and can be installed as a CLI or library. PyRIT suits multi-turn attacks, such as Crescendo, where a single prompt scan misses the risk. Confirm each tool's current version and Python or Node.js requirement before you pin it.

Repeatability is what makes the plan credible. Save the attack set, the scoring criteria and the report from each run, and rerun the same suite after every rail, prompt, model or NeMo Guardrails version change. Ask your testers to document which failures were fixed by a rail, which were accepted as residual risk and who approved that decision. Also confirm the test harness itself: if your team hosts promptfoo, the community self-hosted app stores data in a local SQLite database and has no built-in authentication, so it needs additional controls before it holds sensitive findings. Keep the findings, retests and owners together, because that record is the evidence the reviewer asks to see.

Choosing garak, promptfoo or PyRIT for each test goal

garak, the Generative AI Red-teaming and Assessment Kit, is licensed under Apache 2.0 and is developed in the NVIDIA GitHub organization. It is a command-line tool installed from PyPI with pip, and the PyPI package requires Python 3.11 or newer. It is the strongest fit when you want a broad, repeatable vulnerability sweep across many weakness categories and a per-category protection rate for the guardrailed app.

  • License and install: Apache 2.0, installed with pip install garak on Python 3.11 or newer. Confirm the platforms your security team supports, since the project describes development on Linux and macOS.
  • Probe catalog: Static, dynamic and adaptive probes cover hallucination, data leakage, prompt injection, misinformation, toxicity and jailbreaks, each run with recommended detectors by default.
  • REST generator: Point garak at any REST endpoint that returns plaintext or JSON, described in a short YAML file. This is how you test the guardrailed API as a client would see it.
  • Reports: Each run writes a JSONL file of every attempt and its evaluation, plus a garak.log file that continues across runs, which supports evidence collection.
  • Default sampling: The default is 5 generations per prompt, and a probe is marked FAIL with a failure rate when any attempt produces undesirable output.

Before relying on garak results, check the probe versions and detectors you run against your own endpoint, and confirm the report format your evidence process expects.

Test configuration options and when each fits

This table compares the target you test (direct model or guardrailed application), the attack style (single-turn or multi-turn), and the artifacts each tool leaves behind. Use it to choose a setup for a pre-launch campaign versus a repeatable check that runs after every change.

OptionWhat it testsArtifacts to keepWhen it fits
Direct model endpoint, no railsThe base model's own refusals and weaknessesgarak JSONL report and garak.log; promptfoo local results; PyRIT memoryBaseline to show what the rails add; not a measure of the shipped app
Guardrailed app endpoint via garak REST generatorThe full stack: input rails, dialog flows, retrieval and output railsgarak JSONL report and garak.log, kept per run for comparisonPre-launch campaign and scheduled regression runs against the real endpoint
Guardrailed app via Python APIRails in-process, with custom actions and test doubles possibleTool-specific outputs plus your own run logsDeveloper-side checks where the endpoint is not yet exposed
Single-turn attacksPrompt injection, jailbreak and harmful request patterns in one messagePer-attempt results showing pass or fail per probeFast coverage in CI after each prompt or config change
Multi-turn attacks (for example Crescendo, TAP, Skeleton Key in PyRIT)Gradual escalation and context drift that single messages missPyRIT memory holding full conversation historyPre-launch deep testing of dialog rails and conversational flows
promptfoo local runConfigured red team plugins against your app, run on your machineLocal results and config files, kept in version controlDeveloper loop and CI pipeline checks with minimal shared infrastructure
Self-hosted promptfoo appShared result review for a teamSQLite database, which cannot be shared across replicasSmall team review only; confirm current production guidance with the vendor
PyRIT with SQLite or Azure SQL memoryScored multi-turn campaigns with reviewable conversationsConversation and score records in the chosen memory storeHuman-led investigation and sign-off evidence for a release

Setting up a repeatable red team run

This sequence turns a one-off red team exercise into a run you can repeat after every prompt, flow, model or library change, with each step producing a checked output that the next step depends on.

  1. Confirm the target endpoint and environment

    Identify the exact endpoint that users reach, the environment it runs in and the model behind it, then record the version of NeMo Guardrails and the configuration folder in use. Confirm that the target is a non-production copy with the same config.yml, Colang files and actions as production, and that test traffic cannot reach real customer data or live tools. Check that the target answers through the rails path, not only the raw model, by sending a benign request and confirming the response carries the guardrail behavior you expect. Store these details with the run so every finding can be traced to a build.

  2. Write the threat-model scope for the run

    Work with the product owner and security team to list the assets, user types and harms that matter for this assistant, such as system prompt disclosure, off-topic misuse, data leakage from retrieval and unsafe tool calls. Map each harm to the vulnerability categories the chosen tools cover, and state which categories are out of scope for this run and why. Record the scope in a short document that names the rails expected to block each harm. The check is that every in-scope harm has at least one planned probe or attack and an owner who will review its results.

  3. Configure the generator for the target

    Point the tool at the guardrailed application. For garak, write a REST generator YAML file that describes the request body, the response field to read and the authentication header, following the garak README for the REST generator. For PyRIT, build a custom HTTP target that sends the same request shape. Keep credentials in environment variables, not in the YAML or the repository. Check the configuration by sending one known prompt through the generator and confirming the returned text matches what you see in a browser or API client.

  4. Run baseline tests with and without rails

    Run the same probe set twice: once against the application with rails enabled and once against the raw model path, if your environment offers one. Keep the tool version, probe list and generation settings identical across both runs so the difference reflects the rails. garak uses 5 generations per prompt by default, and you should record any change to that setting. The check is that both runs complete without generator errors and that each run writes its own report directory, so no result overwrites another.

  5. Review failures and separate noise from gaps

    Read the failing attempts, not only the summary counts. Confirm that each failure is a real undesirable output, and sort them into detector false positives, configuration gaps that a rail should catch, and gaps the rails cannot catch with the current design. For garak, check the JSONL report and garak.log for each flagged attempt. For PyRIT, review the scored conversations in memory. The check is a triaged list in which every failure has a label and a proposed next action, and each confirmed gap has a ticket.

  6. Record findings in a versioned register

    Write each confirmed finding into a register with the threat-model harm, the probe or attack that produced it, the build and configuration version, the evidence file and the planned fix. Include the attempts that passed, since they show what the rails already stop. Archive the raw reports, the generator configuration and the scope document together under the run identifier. The check is that a reviewer who was not present can open the register, find the evidence file and reproduce one failure from the recorded details.

  7. Wire the chosen tool into CI or a scheduled job

    Move the working command into a pipeline job that runs on every change to the Colang files, config.yml, custom actions or the library version, and optionally on a recurring schedule. The job should fail or raise a review flag when a previously blocked category starts to fail. Store secrets in the CI secret store and keep the report artifacts with a retention setting your security team approves. The check is a deliberate test run, where a known weakness is introduced on a branch, that causes the job to report it, proving the gate works before you rely on it.

  8. Retest after each fix and archive the result

    After a fix ships, rerun the affected probes against the same endpoint and compare the new report with the register entry. Close a finding only when the retest shows the harm is blocked and the rest of the probe set has not regressed. Keep the previous report so the history of protection rates is visible to auditors and product owners. Confirm that the archived run lists the tool and library versions used, which lets you explain later why a result changed. The check is a closed register entry linked to a passing retest report.

How attacks flow through the rails to the model and back to a report

The flow starts in the test environment, where a harness such as garak, promptfoo or PyRIT sends adversarial prompts over HTTP to the guardrailed endpoint. Each prompt passes the input, dialog, retrieval, execution and output rails before reaching the model, and the response returns through the same rails. Detectors or scorers then judge each attempt and write the results to a report. Check that the trust boundary is where you expect, that the harness sees the rails' decisions rather than only the raw model output, and that the report records which rail blocked each attempt.

Adversarial prompts cross the trust boundary, pass the rails, and return as scored report entries.

Security considerations for running attacks against live systems

Red teaming sends hostile prompts, captures sensitive model output and often uses real accounts, so the test harness itself becomes part of your attack surface. The cards below cover the data, third-party, storage, credential and tooling decisions to settle before the first probe runs against the guardrailed application.

Test data handling

Attack suites are usually built from public probe libraries, but the scenarios that matter most often include real customer records, internal document names or production system prompts. Decide which data may appear in a prompt before the run starts, and use synthetic records wherever a test only needs the shape of the data. Confirm whether the application logs full prompts and responses, because the test traffic will be stored there too and must be covered by the same retention rules.

Third-party model API exposure

Garak and PyRIT can send attack payloads to hosted model APIs, and every payload is processed by that provider under its own terms. Confirm the provider's data use and retention commitments for test traffic, check whether your agreement covers jailbreak content, and make sure the API key used for testing is scoped to a test project with spending limits. Prefer a self-hosted model endpoint for the highest-risk attack classes where the platform allows it.

Storing reports with sensitive outputs

Each garak run writes a JSONL report of every attempt and its evaluation, and the garak.log file continues across runs. A successful data leakage probe can therefore store recovered secrets, personal data or internal instructions in plain files. Restrict report directories, encrypt them at rest, set a deletion schedule, and redact findings before they are shared with developers or ticketing systems.

Generations per prompt
5
garak README

Test account credentials

Red teaming usually needs accounts with the same roles real users have, and those accounts are attractive targets if their credentials leak. Create dedicated test identities with the least privilege needed to reach the rails under test, keep their passwords and API tokens in a secrets manager rather than in YAML configuration files, and rotate them after each engagement. Record who holds each credential and when it expires.

Keeping self-hosted promptfoo off production

The self-hosted promptfoo app stores data in a local SQLite database that cannot be shared across replicas, and its documentation states it has no RBAC, no horizontal scaling and no built-in authentication or SSO, and is not recommended for production use. Run it on an isolated test network, put it behind your own identity-aware proxy if others must reach it, and move to the Enterprise or On-Premise tier if team access control is required.

promptfoo self-hosting docs

Questions buyers ask before red teaming a guardrailed app

What drives the cost of red teaming a NeMo Guardrails application?

Scope breadth drives cost most: how many attack categories are in play, how many application endpoints and tools are exposed, and whether the tests cover single-turn prompts only or multi-turn conversations that build up over several messages. Each added endpoint or user role multiplies the attack surface to exercise, and multi-turn strategies take longer to set up and read. Remediation work is a separate cost component. Finding a gap is one step, while writing and tuning a new rail, then retesting it, is another. Ask any quote to split testing, remediation and retesting, and to state which endpoints, roles and attack categories are covered. Because the open-source tools are free to download, your own staff and any partner are paid for time, not for the scanners.

Can our own team run garak, promptfoo and PyRIT without a partner?

Yes, a capable security engineering team can run these tools itself, and the tools are free to use. garak is a command-line tool installed from PyPI, promptfoo runs locally on Node.js, and PyRIT installs with pip. The harder work is judgment: choosing which threats matter for your application, writing attacks that fit your workflows, interpreting results that are not clear-cut, and deciding which failures justify a new rail. Community promptfoo includes red teaming with 10k probes per month, which is enough for many internal programs to start with. Ask yourself whether you have an owner for the threat model, time for repeated retests and someone who can write and review fixes in Colang or Python.

What does DeployOpen need from our team to start?

Most of the work depends on access and decisions you control. The team typically needs a non-production test environment that matches the guardrailed application, with its configuration, models and tools as they run in production. We also need endpoint access for the application, test accounts for each user role, and documented tool permissions. Threat model owners must confirm which harms, data and actions are in scope, and a named sign-off owner must accept the scope, the findings and the retest results. Agree these items in the written scope before work starts, including who approves production-like test traffic and how long test accounts remain active.

How long does a retest take compared with how often we change the guardrails?

Retest time depends on how many prior findings you need to recheck and how much of the attack set is rerun after each change. A small prompt edit to one rail usually needs a targeted rerun of the related probes, while a Colang flow change or a library upgrade affects more paths and calls for a broader run. garak runs each probe with five generations per prompt by default, so run length grows with the number of probes and generations selected. If your team ships guardrail changes weekly, plan a fast regression subset in CI and a full run before each release. Ask the provider how it will scope retests after each change type.

Does red teaming replace a compliance audit?

No. Red teaming produces evidence about how the application behaves under adversarial input, but it does not issue an audit report, attestation or certification. Independent auditors and certification bodies make those determinations against the framework you are assessed under. Red teaming can support a readiness review by showing which threats were tested, what was found, and how fixes were retested. Frameworks such as the OWASP LLM Top 10 and the NIST AI Risk Management Framework are useful references for mapping test categories to your threat model. Confirm with your auditor which evidence they expect before scoping the test.

Which attacks should be in scope for a guardrailed chatbot?

Start from your threat model rather than from a tool's default list. For most guardrailed applications, the scope includes prompt injection and jailbreaks, data leakage of system prompts and personal data, off-topic or policy-violating outputs, hallucinated facts in retrieved answers, and abuse of tools or internal APIs the assistant can call. Multi-turn attacks, where a user builds context across several messages, should be included if your dialog rails rely on conversation state. garak's probes cover hallucination, data leakage, prompt injection, jailbreaks and toxicity, and PyRIT offers multi-turn strategies such as Crescendo. Ask the threat model owners to rank these categories before testing starts.

Should we test the guardrails in production or in a separate environment?

Test in a separate environment that mirrors production as closely as you can, with the same rail configuration, model versions and tool connections, but with test data and accounts. Running adversarial traffic against production can trigger alerting, consume model quota and expose real customer data if a probe succeeds. Some teams add a narrow, approved production smoke test after a release. Whatever you choose, record the exact configuration version tested, so findings can be traced to a specific build. Confirm with your provider how they will handle logs and credentials produced during testing.

Limits to confirm in your environment

A red team run only tells you what the tools tested, against the endpoint and version you pointed them at. The cards below list the limits to confirm before you plan scope, read results or report them to a product owner or auditor.

NeMo Guardrails version and runtime

Confirm which NeMo Guardrails release and Colang version your application runs before you write attacks against it. Release 0.25.0 requires Python 3.11, 3.12 or 3.13, and Colang 1.0 is the default unless your configuration selects 2.x. A probe set run against one Colang version can miss flows that behave differently in the other, so record both the library version and the Colang version in every test report.

NeMo Guardrails repository

NeMo microservice sunset and control plane

NVIDIA has sunset the NeMo Guardrails microservice container, and the NeMo Platform repository now points to NeMo Helix as the open source control plane. If your architecture depends on the microservice, plan the migration and retest the rails after the move. Ask NVIDIA or your account team which control plane applies to your deployment before you scope the red team engagement.

Microservice sunset
Oct 1, 2026
NeMo Helix guardrail docs

Tool support for your model and endpoint

Each scanner supports a different set of model providers, hosting options and endpoint types. Confirm that garak, promptfoo or PyRIT can reach your model, gateway or REST endpoint, and that the generator or target you configure sends the same system prompt and history your users send. If a tool cannot drive your endpoint directly, the results describe a substitute setup, not your production application.

Probe coverage against your threat model

Automated probe libraries cover common attack families such as prompt injection, jailbreaks, data leakage and toxicity. They do not cover every abuse case in your application, such as a specific tool misuse path, a business rule bypass or an attack that depends on your internal data. Map each threat in your model to a probe, a custom attack or a documented gap, and list the gaps in the report so readers know what was not tested.

Tool and dataset versions

Attack libraries, detectors and datasets change between releases, and a scanner update can change pass and fail results without any change to your application. Pin the versions of garak, promptfoo or PyRIT used in each run, and record the probe set and detector configuration. Confirm the current release of each tool before you start, since projects may move repositories or change license terms.

A passing run is not certification

A clean red team run shows that the listed attacks did not succeed against one configuration on one day. It is not an audit report, an attestation or a certification under any framework. Ask your compliance team and independent assessors which evidence they accept, and describe the run as a test with stated scope and limits, not as a certified result.

Retesting after each change to prompts, rails and models

Any change that can alter what the guardrailed application refuses or allows should trigger a red team retest. In a NeMo Guardrails application that means system prompt and template edits, changes to the Colang files and flows that define input, dialog, retrieval, execution and output rails, changes to the config.yml model settings, swaps of the underlying model, and new tools or retrieval sources wired into the app. Library upgrades count too. The current release is 0.25.0, which followed 0.24.1, and 0.25.0 deprecates the LLMRails class in favor of Guardrails, with removal planned no earlier than 0.27.0. Confirm with the NeMo Guardrails releases page and the 0.25 migration guide what changed in your version before you decide how much of the suite to rerun. Colang 1.0 to 2.x conversions also need manual review, so treat a converted configuration as a new build.

Keep a baseline for every run and compare protection rates, not pass or fail counts. Store the JSONL report that each garak run writes, the probe and detector set used, the generator configuration, the NeMo Guardrails version, the model identifier and the commit of your configuration folder together. garak marks a probe as FAIL when any of its default five generations produces undesirable output, so a single run is noisy. Compare the failure rate per vulnerability category against the previous baseline and investigate any category that moved, even if it still passes your threshold. Record the same attack set against the application with rails enabled and with rails disabled, so a regression in the rails shows up separately from a regression in the base model.

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.