Writing a custom garak probe

A custom garak probe encodes an attack your team actually worries about, so scans test your application's real exposure. This page covers the base class, detectors, tags and tier, and how to verify the probe before it joins scans.

On this page

Why teams write a custom garak probe for their own attacks

A team usually reaches for a custom probe when it has an attack or policy concern that the built-in probe families do not exercise. Perhaps the application has a refund workflow that an attacker could manipulate, or a prompt set from an earlier internal red-team exercise that nobody has run against the current model. garak, the Generative AI Red-teaming and Assessment Kit, is a free command-line tool licensed under Apache 2.0. It is installed from PyPI and requires Python 3.11 or newer. Its functionality is split into five plugin categories: probes, detectors, evaluators, generators and harnesses. A probe is the plugin that supplies the attack prompts. Detectors judge the responses, generators talk to the target, and harnesses decide how the pieces run together.

Before writing anything, check whether the existing probes already cover the attack. Start with the probe list and the tags that group them, and run the candidate prompts through the target once by hand. If the built-in family covers the technique and only the wording differs, a sibling topic is often the better fit. A custom detector is the right tool when the probes already send the right attacks but the pass or fail judgment misses your policy, such as a leaked internal identifier or a forbidden tool call. A custom generator is the right tool when the target is a proprietary protocol. Porting an existing spreadsheet of prompts is usually faster than writing a probe class from scratch. Write a custom probe when the attack itself is new to garak and needs its own prompt set and metadata.

Confirm three things before you commit to a probe. First, who owns the attack definition and the expected safe behavior, because the detector that goes with the probe will encode that decision. Second, whether the attack needs one prompt or a generated set, since that determines the base class you choose. Third, whether the team will keep the probe current as the policy changes. A probe that encodes a policy nobody maintains will produce scan results that look authoritative but measure an outdated rule. Ask your engineers to name the owner and the review cadence in the project plan before the first line of code is written.

How to build and test a custom garak probe step by step

This sequence takes a team from an installed garak environment to a custom probe that runs in a scheduled scan. Each step ends with a check, so problems surface in a test run instead of in a target's results.

  1. Install garak in a development environment

    The engineer who owns the probe installs garak from PyPI with pip into an isolated virtual environment on Linux or macOS, using Python 3.11 or newer as the PyPI package requires. Keep this environment separate from the one used for production scans so experimental probes cannot enter scheduled runs. The step is done when garak starts without errors and the first run creates a garak.log file in the working directory, since that file continues across runs and is where load errors appear first.

  2. Choose the base class for the attack

    Review the probe base classes in the installed package and the user guide at docs.garak.ai, then select the one whose behavior matches your attack. A static probe sends fixed prompts, while dynamic and adaptive probes generate or change prompts based on model responses, so the choice determines how much logic you write. Start with a simple fixed prompt list on a static base class, which is easier to verify. The step is done when you can state in one sentence what the probe sends and what it expects back, and the class imports cleanly in the development environment.

  3. Write the prompts and metadata

    Write the prompts that express the attack and the descriptive metadata garak uses to document the probe, including its name, purpose and the weakness it tests. Phrase each prompt the way a user would send it to the target, and record the policy or threat behind it so a reviewer can trace any result back to its reason. Store large prompt sets in a separate file the probe loads, so reviewers can edit wording without changing code. The step is done when the module imports and printing the probe's prompt list shows the number of prompts you expected.

  4. Attach primary and extended detectors

    Set the primary detector, which decides whether a single output shows the weakness, and add extended detectors only where you need deeper checks. Begin with an existing detector that already fits your policy, because writing a new detector is a separate task with its own false-positive testing. Extended detectors add evidence to the report but also add work to each run. The step is done when loading the probe resolves every detector name, and garak.log shows no warnings about misspelled or missing detectors.

  5. Set tags and tier

    Add tags so scan configurations can select the probe by family or by the policy it supports, and set its tier to place it within garak's probe organization. Choose tag names your team will recognize when they write config files later. Confirm the probe appears when you filter the probe listing by its tag. Check the user guide for how tiers affect selection in the version you installed, and record your choice in the probe's documentation. The step is done when the filtered listing returns your probe and the tier matches what you intended.

  6. Run the probe against the blank generator

    Run the probe with garak's blank generator, which returns no model output, so the run tests the pipeline itself instead of a model. Name your probe explicitly in the command, and lower the generations per prompt below garak's default of 5 while you debug. Open the JSONL report and confirm that each prompt has an attempt entry, that each attempt has an evaluation from the detector, and that the entry count equals prompts multiplied by generations. The step is done when those counts match and the detector runs without errors. Fix any gaps before you test a model.

  7. Add the probe to a scan against your target

    After the blank run produces the expected entries, add the probe to a scan configuration that targets an endpoint your team controls, such as a test deployment. A probe that passes the blank run can still produce different detector results on a model, because model responses drive the evaluations. Review the first report for detector errors and failure rates that do not match your expectations, and keep the scan configuration in version control so reruns use the same setup. The step is done when the scan writes a report whose entries show the detector results you designed.

Probe design options and when each fits

This table compares the design choices you make when writing a garak probe: the base class, detectors, tags and tier. Read each row against the attack you want to test, then check its effect on scan length, verdicts and reports. The main takeaway is that the base class and primary detector shape most of what your team will see in results, so settle them before writing prompts.

Design choiceChoose it whenWhat it changes in the scan and report
Static prompt-list base classThe attack is a fixed set of prompts you can write down in advance, such as a known jailbreak set.Sends the same prompts each run, so results compare directly across runs and releases.
Dynamic base classAttack prompts should vary, built from templates or payload slots filled at run time.Prompt variety grows with each run. Confirm the seeding and reproducibility behavior before comparing scores.
Adaptive base classThe next attack turn depends on how the model or application replied.Adds turns and model calls per attempt, lengthening scans and making exact replay harder.
Primary detectorYou can name one clear signal that marks the failure you care about.Runs by default in the probewise harness and drives the FAIL verdict and failure rate in the report.
Extended detectorsYou want narrower checks or a second signal to confirm a primary hit.Run only when the probe or scan configuration requests them. Expect more findings to review and possible false positives.
TagsThe probe should be selected by a shared taxonomy label or a team-specific group.Scans pick the probe by spec and tag. A missing or wrong tag leaves the probe out of scans that should include it.
TierYou are deciding whether the probe is ready for broad use or is still experimental.Confirm in the garak user guide how tier affects default selection before setting it.

How garak runs a probe through detectors and the JSONL report

When you run a custom probe, the probe itself only supplies prompts. The generator sends each prompt to the target and returns the outputs, and the detectors decide whether each output is undesirable. By default garak uses the probewise harness, which runs your probe with the detectors the probe recommends. Those recommended detectors are set in the probe class, so the detector choice you make when writing the probe directly determines what counts as a failure. Each attempt, its output and its evaluation are then written to the JSONL report, one record per attempt, which is the file your team will read, diff and feed into pipelines.

By default garak makes 5 generations per prompt. This matters for your pass criteria: a probe is marked FAIL with a failure rate as soon as any attempt produces undesirable output, so a prompt that the target refuses four times out of five still fails the probe. Confirm the generation count you use in your scan configuration before comparing results, because a changed count changes the failure rate even when the target has not changed. When you test a new probe, check whether the failure rate is driven by one prompt or spread across many, since that tells you whether the attack is consistently effective or only occasionally succeeds.

garak also writes a garak.log debugging file, and that file continues across runs rather than being replaced each time. Keep this in mind when you troubleshoot a probe that loads, runs or evaluates differently from one run to the next, because older entries from earlier runs will be in the same file. Before you rely on a log entry, confirm the run it belongs to, for example by matching timestamps to the JSONL report. Plan for log and report retention in your own environment early, since both files grow with every scan you run against the probe.

Where a custom probe sits in a garak run

A run starts with your custom probe, which supplies the prompts and names its primary and extended detectors. Prompts pass to a generator. During testing, the blank generator returns empty output so you can check prompt loading and detector wiring without calling a model. In a scan, the generator is the target application, and its responses go to the detectors for evaluation. Results land in the JSONL report, while garak.log records the run for debugging. Check that the blank path runs cleanly before you point the probe at a live endpoint.

The blank generator path for testing is separate from the scan path to the target.

Common mistakes that make a custom probe misleading

A custom probe produces a clean-looking report whether or not it measures anything useful. The mistakes below share one pattern: the probe runs, the numbers print, and the result says less about your application than it appears to. Check each one before a custom probe enters a scan that feeds a review or a comparison.

Duplicating built-in probes

A prompt set that repeats an existing garak probe family adds run time without adding coverage, and its results look like a second opinion when they are the same test. Before writing anything, list the probes already loaded and compare the attack technique, not just the wording. Keep the custom probe only for attacks the built-in set does not already cover, such as a policy or workflow specific to your application.

Detectors that miss the policy

A probe can be well written and still score nothing useful if its detector looks for the wrong output. A detector that only matches a forbidden phrase will miss a leaked identifier written in a different format, and one that is too broad will flag harmless refusals. Pair each probe with a detector built for the exact policy, and review a sample of hits and misses by hand before trusting the failure rate.

Tier and tags that hide the probe

A probe with the wrong tier or tags will never run in a targeted scan, so the team believes a control was tested when nothing ran. Confirm the probe appears in the list output when filtered by the tags your scan uses, and check that it is included when a scan is selected by tier. Record the tags in the scan config so the probe stays selected when the config is reused.

Skipping blank generator tests

Running a new probe straight against a production endpoint mixes probe bugs with model behavior, and a crash or a misconfigured detector looks like a finding. Run the probe with the blank generator first to confirm prompts load, attempts are written to the JSONL report, and the detector scores the output as expected. Only add the probe to real scans after that run is clean.

Prompts too generic to matter

Generic jailbreak phrasing tells you little about how your application handles its own data, tools and users. A probe that asks a model to ignore its rules without naming the sensitive record, function or workflow at risk produces a number that cannot guide a fix. Derive prompts from the actual exposure, such as the account lookup or refund tool, and state in the probe description which assets the attack targets.

Changing probes between runs

Editing prompts, detector logic or the failure threshold after a baseline scan makes the new report impossible to compare with the old one. A score change may reflect the edit rather than the model or application. Version the probe, record its version in the run notes, and treat any change to prompts or detection as a new baseline before comparing trends.

Questions teams ask before writing a custom garak probe

How much effort does a custom garak probe take to build?

Effort depends mostly on how many attack variants you need, how many detectors the probe requires, and how much validation the results need before anyone trusts them. A probe with a handful of prompts and a simple string detector is a small job. A probe with hundreds of variants, multiple detectors and a false-positive review against real model outputs is a much larger one. Ask any partner to split the estimate into writing the probe, writing or choosing detectors, and validating against a test target, because each part scales differently.

Can an in-house engineer write a garak probe without outside help?

Usually yes, if the engineer can read Python and the team has someone who understands the attack well enough to judge whether the probe measures it. garak is installed from PyPI with pip and the PyPI package requires Python 3.11 or newer, so the tooling barrier is low. The harder part is domain knowledge: knowing which phrasings, languages or encodings actually matter for your application. Teams that lack that expertise tend to produce probes that run cleanly but test the wrong thing.

What does the team need to provide for a custom probe?

The team needs three things. First, someone with domain expertise on the attack, such as the policy being violated or the data that must not leak. Second, a test target, which can be the blank generator at first and a real endpoint later. Third, time for validation with the blank generator before the probe joins a scan, so that detector logic and tags are checked before results are reported. Ask the team to confirm who will own the probe after delivery, because it needs a named maintainer.

Is writing a garak probe a one-time job or ongoing work?

The first build is one-time, but the probe needs upkeep. garak is an actively released tool, and the releases page on GitHub shows that the project changes between versions, for example v0.17.1 released on 16 October 2026. Changes to base classes, detector behavior or report fields can alter how a probe runs or how scores compare over time. Plan for a periodic check after each upgrade, and confirm with any partner whether that check is included or sold as a retainer.

Will a custom probe need a separate detector, or can it reuse existing ones?

A probe can reuse existing detectors when the failure you are looking for is a common one, such as a refusal check or a known harmful output. A separate detector is needed when the policy is specific to your application, such as a forbidden internal term or a tool call that should never happen. Writing and testing that detector is often the largest part of the work, because false positives and false negatives must be measured before the results are used for decisions.

How do we know a custom probe produces false positives?

Run the probe against the blank generator and against a target where you know the right answer, then read the JSONL report line by line. Each garak run writes a JSONL report of every attempt and its evaluation, so you can compare what the detector flagged with what a human reviewer says the output means. Count disagreements, fix the detector or the prompts, and repeat. Ask any partner to show their validation method and the sample of outputs they reviewed, not only the final pass rate.

When should we hire a partner instead of building the probe ourselves?

Hire a partner when the attack needs expertise your team does not have, when the probe must be defensible to an auditor or customer, or when your engineers cannot take on the maintenance that follows each garak release. DeployOpen plans, builds and tests self-hosted tooling inside the client's own infrastructure and most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. Ask for a written scope that names the probe count, detectors, validation method and handover, and compare that against your own team's capacity.

How DeployOpen scopes and delivers custom garak probes

DeployOpen plans and builds custom garak probes as fixed-scope engagements. DeployOpen is a Chainscore Labs company that implements, customizes and tests self-hosted open-source platforms, and it also runs AI security testing, including red teaming of LLM applications. A custom probe engagement starts with a written scope that names the attack or policy to be tested, the target the probe will run against, the base class and detectors to be used, the tags and tier to be assigned, and the blank generator tests that will show the probe loads and behaves as intended. The deliverables, timeline and acceptance checks are agreed in writing before any build work begins, so the client knows what it will receive and how it will be verified.

A quote follows from that written scope. DeployOpen does not publish a price list, because the effort depends on the attack, the number of probes, how many detectors need tuning, and whether the target endpoint is already reachable from the test environment. When you request a quote, ask for the scope items to be listed separately (probe design, detector work, generator changes, documentation and handover), and ask which items are one-time and which are needed again when garak is upgraded or the target changes. Confirm with your own team who will review false positives, who owns the probe code after handover, and where the code will be stored. DeployOpen does not hold any partner status with garak or NVIDIA, and the scope should reflect the open-source project as published.

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.