E2E Testing for Chat, Voice, Phone and Video AI Agents
Run Thousands of Test Scenarios against Your Agent and Catch Hallucinations, Bias, and Toxicity Before Users Do.
NVIDIA garak: How to Scan an LLM for Prompt Injection and Jailbreaks
NVIDIA garak tutorial: install the LLM vulnerability scanner, run probes for prompt injection and jailbreaks, read the report and fail CI on hits.
NVIDIA Garak is a free, open-source command-line scanner which sends a set of known attack prompts to a language model and reports back on which of them got through. You install it via pip, point it at a model or a REST endpoint, select the probe modules you're interested in (e.g. prompt injection, DAN jailbreaks, etc.), and you get an attack success rate per probe in a JSONL and HTML report.
This guide is using garak 0.17.1 (PyPI, released 16th October 2026). Flag names have changed in more recent releases, so commands copied from older tutorials may fail. The flags section below shows the current names.
TL;DR
NVIDIA garak is a free, Apache-2.0 LLM vulnerability scanner. It sends known attack prompts, such as prompt injection, encoding tricks and DAN jailbreaks, to a model or a REST endpoint, scores every reply with a detector, and writes a JSONL report, an HTML summary and a hit log of the attacks that got through.
How Do You Run a garak Scan?
- Install check: garak is free (Apache-2.0) and needs Python 3.11 or newer. Install it with pip, then run the offline
test.Blankgenerator so no tokens are spent. - Target: garak's
--target_typeflag picks the generator (openai, huggingface, litellm or rest); a REST option file maps$INPUTand$KEYonto your chat API. - garak probes: Start with
probes.promptinject,probes.latentinjectionandprobes.sysprompt_extractionfor OWASP LLM01, and pin garak 0.17.1 so the probe set stays fixed.
What Does a garak Hit Mean, and Where Does garak Stop?
- Hit log: Each row of the garak hit log is an attempt a detector scored as a successful attack. String-based detectors err both ways, so read every row before reporting a score.
- CI gate: garak defines no exit code for findings, so a gate script fails the job when the report is missing or the hit log has rows.
- Deployed agents: garak probes are mostly single-turn. TestMu AI Red Teaming runs multi-turn attacks against deployed chat, voice and phone agents.
What Is NVIDIA garak?
garak is an LLM vulnerability scanner maintained by the NVIDIA GitHub organization. The name stands for Generative AI Red-teaming and Assessment Kit. It's Apache 2.0 licensed and had approximately 10.3k stars on GitHub as of 1st December 2026.
The design is described in the paper "garak: A Framework for Security Probing Large Language Models" (Derczynski et al., arXiv 2406.11036, June 2024).
Garak is an open-source scanner which probes a language model with known attack prompts and scores each response with a detector so a team can see which attack classes work before the users do.
Garak sits in the second group of AI testing tools (the ones that test the AI itself rather than the AI being used to test a web or mobile app). Within that group it's the equivalent of a tool for scanning networks in infrastructure security.
It performs a broad, repeatable sweep of the model endpoint. It doesn't have a real conversation with your deployed agent, and it has no knowledge of your business rules.
Typical reasons a team runs garak:
- A new model or model version is due to take over the current one.
- The system prompt (or guardrail) configuration has changed.
- A security review requested evidence of prompt injection and jailbreak testing.
NVIDIA's own NeMo Guardrails documentation uses garak in exactly that way: they've scanned the same sample bot under the four different guardrail configurations and looked at the protection rates per probe module.
For a quick visual walkthrough of this concept, watch the video below from TestMu AI.
Subscribe to the TestMu AI YouTube channel for more tutorials on testing and automation.
How Does garak Work?
garak runs a pipeline of plugins. A spec selects probes, a generator sends each probe prompt to the target, detectors score each response, and an evaluator writes the report.
| Plugin | What it does | In garak |
|---|---|---|
| Probe | Sends attack prompts of one kind | probes.promptinject, probes.dan.Dan_11_0, probes.encoding |
| Generator (target) | Talks to the model under test | openai, huggingface, bedrock, litellm, rest, test |
| Detector | Scores each response as a hit (attack worked) or not | Each probe's recommended detector by default; -d overrides it |
| Buff | Transforms prompts before sending (for example, re-encoding) | Selected through --spec |
| Evaluator | Aggregates detector scores into the report | Writes report JSONL, HTML summary and hit log |
The generator list in the garak README covers Hugging Face models, Replicate, OpenAI (chat and completion), AWS Bedrock, LiteLLM, Cohere, Groq, ggml, NIM and "pretty much anything accessible via REST".
The garak reference index has 44 probe modules in it including the base and test helpers.
How Do You Install garak?
Garak requires Python 3.11 or later. The conda example in the project pins Python 3.11 to 3.14. A virtual environment keeps those dependencies separate from your app.
python3 -m venv .venv-garak
source .venv-garak/bin/activate
python -m pip install -U garak
garak --versionBefore you go and spend tokens on a real model, run garak against its built-in test generator. That command is adapted from the README test-plugin examples and the basic-test page, using the built-in test.Blank generator and probe and makes no network calls to a model at all:
python -m garak -t test.Blank -S probes.test.Blank -d always.Pass
If that run completes and produces a report path, then the install has worked. Use the dev build only if you need an unreleased fix:
python -m pip install -U git+https://github.com/NVIDIA/garak.git@mainNote: Want a quick read before you go and install anything? TestMu AI has a free Agent Red-Team Scan which will fire 25 single-turn probes across 7 classes (direct injection, jailbreak personas, encoding bypass, system prompt extraction, PII leak, indirect injection, excessive agency) against an OpenAI-compatible Anthropic or Gemini API from your browser and return a 0 to 100 score. It's a first look, not a substitute for a full garak sweep.
How Do You Run Your First garak Scan?
A first scan requires three choices: the target type, the target name and a spec which determines which probes run. The garak README shows this run against an OpenAI model with the key coming from an environment variable:
: "${OPENAI_API_KEY:?Set OPENAI_API_KEY first}"
TARGET_MODEL="${TARGET_MODEL:-gpt-5-nano}"
python -m garak \
--target_type openai \
--target_name "$TARGET_MODEL" \
--spec probes.encoding \
--generations 3 \
--seed 42 \
--report_prefix first_scan--generations determines how many responses Garak collects per prompt (the config reference lists 5 as the default). A lower number will keep the first run cheap. --seed is used to fix Garak's own random choices (responses from a hosted model will still vary from run to run).
Every probe prompt is a paid API call, so you want to start with one module and a small model and then expand from there.
For a Hugging Face model, the README example is:
python -m garak --target_type huggingface --target_name gpt2 --spec probes.dan.Dan_11_0Why Do the Older garak Tutorials Fail?
Several flags were renamed. The online CLI reference docs v0.17.2.pre1 (one pre-release ahead of the 0.17.1 used in this guide) list:
| Old flag | Current flag | Status |
|---|---|---|
--model_type / -m | --target_type / -t | Alias still accepted |
--model_name | --target_name / -n | Alias still accepted |
--probes / -p | --spec / -S | Deprecated |
--buffs / -b | --spec | Deprecated |
--probe_tags | --spec with a tag | Deprecated |
If a probe name from an old post errors out, list what your installed version has:
garak --list_probes -v
garak --plugin_info probes.dan.Dan_11_0How Do You Point garak at Your Own Chat Endpoint?
Most teams would rather be scanning their app's chat API rather than a raw model as the system prompt, and guardrails are all in there. garak's REST generator (rest.RestGenerator) will connect to any endpoint that returns plain text or JSON, via a JSON options file.
Save this as chat_service.json. $INPUT will be replaced with each probe prompt and $KEY will be replaced with the value of the REST_API_KEY environment variable so no secret ends up in the file:
{
"rest": {
"RestGenerator": {
"name": "support-chat-staging",
"method": "post",
"headers": {
"Authorization": "Bearer $KEY",
"Content-Type": "application/json"
},
"req_template_json_object": {
"message": "$INPUT"
},
"response_json": true,
"response_json_field": "reply",
"request_timeout": 30,
"ratelimit_codes": [429]
}
}
}Change the message and the reply to use the field names your API uses. If the reply is nested, then response_json_field can take a JSONPath expression which starts with $. Inject the endpoint URL at run time so the same file can be used for both staging and production (garak 0.17.1 reads it only from uri in the option file, not from --target_name):
: "${REST_API_KEY:?Set REST_API_KEY first}"
: "${CHAT_ENDPOINT_URL:?Set CHAT_ENDPOINT_URL first}"
python -c 'import json,os; c=json.load(open("chat_service.json")); c["rest"]["RestGenerator"]["uri"]=os.environ["CHAT_ENDPOINT_URL"]; json.dump(c,open("chat_service.run.json","w"))'
python -m garak \
--target_type rest \
-G chat_service.run.json \
--spec probes.promptinject \
--generations 3 \
--report_prefix chat_promptinjectWhat if Your Team Just Routes Their Models Through LiteLLM?
garak also has a LiteLLM generator. The garak LiteLLM reference shows it pointed at a local OpenAI-compatible server through a small option file; LiteLLM reads provider keys from the usual environment variables, such as OPENAI_API_KEY:
cat > litellm_base.json <<'JSON'
{"litellm": {"LiteLLMGenerator": {"api_base": "http://localhost:11434/v1", "provider": "openai"}}}
JSON
python -m garak --target_type litellm --target_name "${TARGET_MODEL:?Set TARGET_MODEL}" \
--generator_option_file litellm_base.json --spec probes.dan --generations 3Change api_base to the gateway you use. If your gateway is sitting behind your own chat API with its own system prompt, then scan that API with the REST generator instead.
The REST generator reference covers the other fields too (skip_codes, verify_ssl and key_env_var for a different variable name). Scan the staging environment or a dedicated test deployment and check your model provider's usage policy before you send any attack prompts to a hosted model.
Which garak Probes Should You Run First?
Start with the probe modules that map to the risks your reviewers are asking about. Prompt injection is LLM01 in the OWASP Top 10 for LLM Applications 2025, and is defined as user prompts that alter the LLM's behavior or output in unintended ways.
For payloads, see direct vs indirect injection and testing beyond garak in the prompt injection testing guide.
| Probe module | What it tests | When to run it |
|---|---|---|
probes.promptinject | Prompt injection attempts | Every release of a customer-facing chat feature |
probes.encoding | Instructions hidden in encoded text (README example) | When your input filter checks plain text only |
probes.dan | DAN-style jailbreak prompts | After any system prompt change |
probes.latentinjection | Instructions planted inside content the model reads | When the app summarizes user documents or web pages |
probes.sysprompt_extraction | Attempts to reveal the system prompt | When the system prompt holds business rules |
probes.packagehallucination | Invented software package names | For coding assistants |
Module descriptions do, of course, change between releases, so always check each one via garak --plugin_info prior to relying on it. --spec can also be used to select by tag (the garak configuration reference has a spec that includes tag:owasp:llm01). A scan that uses three of the modules from the table:
python -m garak --target_type rest -G chat_service.run.json \
--spec probes.promptinject,probes.latentinjection,probes.sysprompt_extraction \
--generations 3 --report_prefix chat_owaspHow Do You Read a garak Report?
Every run writes three outputs, described in the garak reporting guide:
- Report as JSONL (
<prefix>.report.jsonl,garak.<uuid>.report.jsonlby default). Each row contains anentry_typeof 'attempt', 'eval' and a final digest. - HTML report. Scores grouped by module (or taxonomy), then by probe, then by detector.
- Hit log. A JSONL file with every attempt a detector scored as a successful attack.
Reports go into a garak_runs folder in your XDG data directory (i.e. ~/.local/share/garak/garak_runs on most Linux machines) and garak will print out the path to the report as it starts and as it finishes. To rebuild the HTML from a JSONL file:
python -m garak.analyze.report_digest -r path/to/first_scan.report.jsonl -o first_scan.html
The numbers mean:
| Metric | What it means |
|---|---|
| Attack success rate | Share of attempts that breached the target, shown with a confidence interval |
| Absolute score | A pass rate in the digest |
| hit@k | Whether at least one of k generations breached the target, averaged across prompts |
| Z-score | Comparison with recently tested models; 0 is average, negative is worse |
| DEFCON grade | 1 (worst) to 5 (best); module grades use the minimum so one bad probe is not hidden |
Treat every score as a lead to verify. The detectors are largely string or small classifier checks, so errors go both ways. A refusal which contains a trigger string can be a hit and an oddly worded partial compliance can be a pass.
Open the hit log, read each response and record a disposition (real breach, false positive, needs a fix). Spot check a sample of the passing attempts in the report JSONL as well before anyone reports a number up.

How Do You Run garak in CI and Fail the Build on Hits?
garak's documentation doesn't define an exit code for "vulnerabilities found", so we'll need to have our own gate in the CI job. The script below fails closed (fails if the report file is missing and fails if the hit log has any rows at all).
Save as scripts/garak_gate.sh:
#!/usr/bin/env bash
# Fails the job if garak produced no report, or if any attack succeeded.
set -euo pipefail
: "${GARAK_PREFIX:?Set GARAK_PREFIX to the --report_prefix used for the run}"
RUN_DIR="${GARAK_RUN_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/garak/garak_runs}"
REPORT="${RUN_DIR}/${GARAK_PREFIX}.report.jsonl"
if [[ ! -s "$REPORT" ]]; then
echo "FAIL: no garak report at $REPORT"
exit 2
fi
HITLOG="$(find "$RUN_DIR" -maxdepth 1 -name "${GARAK_PREFIX}*hitlog*.jsonl" | head -n 1)"
if [[ -n "$HITLOG" && -s "$HITLOG" ]]; then
echo "FAIL: $(wc -l < "$HITLOG") successful attack(s) logged in $HITLOG"
exit 1
fi
echo "PASS: report found, no successful attacks logged for $GARAK_PREFIX"Prove the gate can fail before you trust it. garak ships an always.Fail detector "for testing & prototyping."
Run it against the test generator, then run the gate. It must exit non-zero, and the message tells you the exact hit-log file name your garak version writes:
python -m garak -t test.Blank -S probes.test.Blank -d always.Fail --report_prefix gate_selftest
if GARAK_PREFIX=gate_selftest bash scripts/garak_gate.sh; then
echo "Gate passed a forced failure: fix the hit-log pattern before using it"
exit 1
else
echo "Gate failed as expected"
fi
A GitHub Actions job that scans a staging chat endpoint on every pull request to main:
name: garak-scan
on:
pull_request:
branches: [main]
jobs:
garak:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
REST_API_KEY: ${{ secrets.STAGING_CHAT_API_KEY }}
CHAT_ENDPOINT_URL: ${{ vars.STAGING_CHAT_URL }}
GARAK_PREFIX: pr-${{ github.event.pull_request.number }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- run: python -m pip install garak==0.17.1
- name: Run garak
run: |
python -c 'import json,os; c=json.load(open("chat_service.json")); c["rest"]["RestGenerator"]["uri"]=os.environ["CHAT_ENDPOINT_URL"]; json.dump(c,open("chat_service.run.json","w"))'
python -m garak --target_type rest -G chat_service.run.json \
--spec probes.promptinject,probes.dan \
--generations 3 --seed 42 --report_prefix "$GARAK_PREFIX"
- name: Gate on hits
run: bash scripts/garak_gate.sh
- name: Keep the reports
if: always()
uses: actions/upload-artifact@v7
with:
name: garak-${{ env.GARAK_PREFIX }}
path: ~/.local/share/garak/garak_runs/Pin the garak version in CI. Probe sets differ between releases and an unpinned upgrade can alter your numbers even if there's been no change to your app.
What Does garak Not Cover, and What Comes Next?
garak answers one question very well: does this model or endpoint fall for the known attack prompts? It covers very little of what happens once the model is in a product. The reviewers of the tool cite single-turn bias, stale public probes and a very heavy install as the main drawbacks.
A deployed support agent can fail in other ways too: a caller who says they've already had approval, an agent who gives in on the third push, a refund issued without any verification.
| garak | promptfoo | TestMu AI Red Teaming | |
|---|---|---|---|
| What it targets | Model or REST endpoint | Your prompts and app config | Deployed chat, voice and phone agents (product page) |
| How attacks are chosen | Library of probe modules | Red team mode generates adversarial inputs for your target | 9 attack categories at basic, intermediate or advanced intensity |
| Conversation style | Mostly single prompt per attempt | Config-driven test cases | Phone Caller agents (phone red-teaming doc): persona-driven test calls; the caller pushes up to three times after a refusal |
| Result | ASR, DEFCON grade, hit log | Assertion results per test case | Product page: Green, Yellow or Red readiness verdict. Phone Caller agents (phone doc): Held, Held with issues, Partial, Breached or Inconclusive per probe, with severity and the exact moment in the call |
| Regression tracking | Diff your own JSONL files | Re-run the config | Scheduled regression runs (product page); Run history marked REGRESSED or IMPROVED (Phone Caller agents, phone doc) |
| Cost | Free (Apache-2.0); you pay model API calls | See promptfoo's pricing page | Commercial; free signup on the product page |
TestMu AI's AI Red Teaming covers the deployed-agent side. The product page lists nine attack categories (prompt injection, jailbreak, data exfiltration, PII leakage, harmful content, overreliance, hijacking, policy violation, technical injection), metric thresholds per environment, scheduled regression runs and a CLI exit code as the CI gate.
The step-by-step phone agent red teaming guide shows the flow for inbound and outbound Phone Caller agents: open Scenarios, click Generate Scenarios, select Red Team under Scenario Types, then read the Red Team view in Insights. That guide also states its limits plainly: red teaming is not available for IVR agents, four OWASP risks cannot be tested by phone, and red team results are not counted in the pass rate or the Go-Live assessment.

In a pipeline, the Agent Testing CLI (pip install agent-testing-cli) will start up saved suites from the CLI and the docs list exit code 1 as "a completed test failed". Chat evaluations are async, so a CI job that's gating on a chat suite has to fetch the suite results (results --suite SUITE_ID; the docs just describe it as "Show suite results" and don't currently document the output format) before it can decide whether to pass or fail.
For a side-by-side of nine red teaming tools (including PromptFoo and PyRIT), see the AI red teaming tools comparison.
The garak Release Gate Checklist
Use these seven checks before you call a model change "scanned":
- Pinned version. garak is pinned in CI, and the version is written in the report folder name or job log.
- Right target. The scan hits the app endpoint with its real system prompt and guardrails, not just the raw model.
- Scoped spec. Probe modules map to named risks (e.g. OWASP LLM01), listed in the PR.
- Seeded run.
--seedand--generationsare set explicitly, and the target model version is recorded. - Proven gate. The
always.Failself-test caused the gate exit to be non-zero at least once. - Triaged hits. Every hit log row has a disposition and false positives are logged with a reason.
- Deployed agent pass. Multi-turn pressure on the live agent (social engineering, refusals under repeated pushing) is tested separately prior to release.
Videos
Turning OWASP AI/LLM risks into QA checks (TestMu Conf 2026, Thejes Sree Satheesh Kumar). Map the OWASP risk categories to test cases that a QA team can automate (that's the step prior to selecting garak probes).
AI Applications Security Puzzle (TestMu Conf 2026, Maryia Tuleika). Publicly documented failures of deployed AI assistants as per the OWASP AI Testing Guide.
Note: Run red team tests on the agent your customers talk to. garak tells you how the model handles known attacks. TestMu AI Red Teaming runs persona-driven attacks against your deployed chat, voice and phone agents and gates releases on the result. Start free or book a demo from the product page.
Conclusion
Start with the test.Blank smoke run, then scan a staging copy of your chat API with one probe module and a pinned garak version. Add the gate script to CI once the always.Fail self-test has made it fail, and read every hit-log row before anyone reports a score.
garak probes are mostly single-turn, so test the deployed agent under multi-turn pressure as a separate step before release.
Testing an AI agent? TestMu AI's Agent Testing validates chat, voice and IVR agents before your customers talk to them.
Was this helpful?
Authors

Shantanu Wali
Author · 34 posts
Shantanu Wali is Vice President of Product Management at TestMu AI, where he owns several product lines across the testing platform, including the Real Device Cloud and the Digital Experience Testing Cloud. He has also contributed significantly to the development and scaling of KaneAI, TestMu AI's flagship GenAI-native testing agent that uses natural language to make software testing faster and more reliable in this AI era. He brings 7+ years of experience across software development and product management, starting as a backend developer at Infosys building solutions for Fortune 500 clients. Shantanu holds an MBA from IIM Calcutta and a B.Tech in Mechanical Engineering.

Himanshu Sheth
Reviewer
Himanshu Sheth is the Director of Marketing (Technical Content) at TestMu AI, with over 8 years of hands-on experience in Selenium, Cypress, and other test automation frameworks. He has authored more than 130 technical blogs for TestMu AI, covering software testing, automation strategy, and CI/CD. At TestMu AI, he leads the technical content efforts across blogs, YouTube, and social media, while closely collaborating with contributors to enhance content quality and product feedback loops. He has done his graduation with a B.E. in Computer Engineering from Mumbai University. Before TestMu AI, Himanshu led engineering teams in embedded software domains at companies like Samsung Research, Motorola, and NXP Semiconductors. He is a core member of DZone and has been a speaker at several unconferences focused on technical writing and software quality.
NVIDIA garak FAQs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests




