PyRIT AIRT Jailbreak scenario with jailbreak templates

PyRIT's Jailbreak scenario tests whether a model's refusals hold when HarmBench objectives are wrapped in jailbreak templates, and whether the template is sent inline or as a system prompt. This page explains the options, the baseline and how to choose the template count.

On this page

What the PyRIT AIRT Jailbreak scenario tests and when to run it

If your AI feature or model is supposed to refuse harmful objectives, the PyRIT AIRT Jailbreak scenario tests whether those refusals hold when an attacker wraps the request in a jailbreak. It runs HarmBench objectives against your target using delivery techniques and jailbreak templates, then records whether the target complied. The scenario is built to answer one question: does a known jailbreak pattern move the model past its safeguards that a plain request would not?

The scenario is a cross product of three inputs. HarmBench supplies the objectives, delivery techniques decide how the prompt reaches the target, and jailbreak templates supply the wrapper text. The prompt_sending attack renders the objective into the template, so each run sends a complete prompt. With jailbreak_system_prompt, the template is set as the system prompt instead of being placed in the user message. A baseline run without any jailbreak is included by default, so you can compare each template against the plain objective. Confirm the exact template and technique names your PyRIT version exposes with pyrit_scan --list-scenarios and the scenario's documentation before you write a pipeline around them.

Run the scenario before a release, after any change to the model, its system prompt or its safety layer, and when a review asks for evidence of jailbreak testing. A baseline that shows the target already refuses plain objectives is a useful reference, but a template that gets past refusals the baseline held is the finding to fix first. Keep the run record with the target version and template set used, because a result without those details cannot be compared with the next run. The full scenario documentation is in the PyRIT AIRT scenarios guide.

Scenario options and when each fits

This table compares the delivery and run-size choices for the Jailbreak scenario, including inline prompt_sending, jailbreak_system_prompt, the default baseline and a reduced first run. Each row states what the option tests, what it costs in requests and when it fits. Confirm exact option names against the 1.1.0 documentation before you write a run command.

OptionWhat it testsRequest cost and fit
Inline delivery (prompt_sending)Whether the target complies when the objective is rendered into the jailbreak template inside the user messageEach objective and template pair sends one rendered prompt. Fits a first assessment of how the model handles user-supplied jailbreak wrappers.
System prompt delivery (jailbreak_system_prompt)Whether the target complies when the jailbreak template is set as the system prompt and the objective arrives as the user turnCost follows the same objective and template count as inline. Fits applications where a system prompt can be altered by a developer, prompt template or configuration, so the template placement matters.
Un-jailbroken baselineWhether the target refuses the bare objective with no template, which shows the harm is refused without helpIncluded by default, so it adds one request per objective. Keep it on, because a jailbreak result means little without a baseline refusal rate to compare against.
Reduced first run (small objective and template subset)Whether the wiring, target, scorer and memory labels work before a full sweepLowest cost. Limit objectives and templates to a small set and confirm the exact dataset-size option in the 1.1.0 documentation. Fits any first run against a new target.
Full cross-product run (all objectives and templates)The complete grid of HarmBench objectives across the jailbreak templates and delivery techniquesRequest count grows with objectives multiplied by templates and delivery modes, so it is the most expensive option. Fits a scheduled assessment after the reduced run has been reviewed.
Templates limited to a chosen subsetWhether the templates most relevant to your application succeed, such as role-play or instruction-override stylesCost scales with the number of templates selected. Fits when the application's threat model points to specific attack styles and the team wants repeatable results at a controlled cost.

Setting up and running the Jailbreak scenario

This sequence takes a team from a clean Python environment to a small, verified Jailbreak run in which the un-jailbroken baseline and the template results are both recorded in memory. Confirming those results before scaling keeps the first run diagnosable.

  1. Install PyRIT on a supported Python version

    An engineer on the team creates an isolated virtual environment and installs the pyrit package from PyPI with pip. The PyPI package supports Python 3.10 up to but not including 3.15, and the PyRIT documentation recommends Python 3.13, so use 3.13 unless your platform team has a reason not to. Confirm the install by running pyrit_scan with its help flag and checking that the command resolves and lists the available options. If the command is not found, check that the virtual environment is active before troubleshooting the package.

  2. Configure credentials in the PyRIT environment file

    The engineer creates ~/.pyrit/.env and adds the credentials for the target model and, if you use one, the scorer model. Keep this file out of source control and restrict its permissions to the account that runs scans. Confirm the setup by loading the environment and verifying that PyRIT reads the variables without printing their values to the console or to logs. Do not paste keys into shared chat or tickets while you test.

  3. Set run defaults in the PyRIT configuration file

    Next, the engineer creates ~/.pyrit/.pyrit_conf and sets the memory location and the default initializers and registries for this environment. Record which memory backend is in use, SQLite or Azure SQL, because the baseline and template results will be queried from it later. Confirm the configuration by running a no-op listing command and checking that it reports the settings you expect. A mismatch here usually means PyRIT is writing results to a different memory database than the one you planned to inspect.

  4. Register the target system under test

    The engineer registers the model or application endpoint that the Jailbreak scenario will attack, using a target type that matches the system, such as an OpenAI, Azure, Hugging Face or custom HTTP target. Use a non-production endpoint or a model version the owner has approved for testing. Confirm registration by listing the registered targets and sending a single benign test prompt, then checking that a response comes back and is stored in memory. If the response is empty or an error, resolve connectivity before any attack runs.

  5. Run a small Jailbreak scenario first

    The engineer runs pyrit_scan with the Jailbreak scenario against the registered target, limiting the objective dataset to a small number of HarmBench objectives and a small number of jailbreak templates. The scenario crosses objectives, delivery techniques and templates, and includes the un-jailbroken baseline by default, so a small selection keeps the first run short and readable. Confirm the run completes and that the command output lists the scenario name, the target and the count of attempts. Record the exact flags used so the run can be repeated.

  6. Check that baseline and template results are in memory

    The engineer queries PyRIT memory for the conversations from this run and confirms that two kinds of result appear: baseline attempts that send the objective without a jailbreak, and template attempts in which the objective is rendered into a template. Check that inline delivery through prompt_sending and system prompt delivery through jailbreak_system_prompt both appear if you selected both. A missing baseline or a missing delivery technique means the scenario configuration did not run as planned, and you should review the selection before going further.

  7. Review scored outcomes and confirm before scaling

    Before adding objectives or templates, the engineer reviews the scored outcomes for the small run and compares the baseline against the template results for the same objectives. Confirm that the scorer output is readable, that refusals and successes are labelled as the scorer defines them, and that a sample of responses matches the scores. Only after this review should the team widen the dataset or template count, and each widening step should be followed by the same memory and scoring checks.

Picking how many jailbreak templates to run

When you first test a model, the goal is to learn where it is weak, not to certify it. Breadth matters more than depth here, because a template that never gets tried cannot reveal a failure. Running several templates against the same HarmBench objectives shows whether the model's refusals depend on the wording of the attack or hold across many framings. The un-jailbroken baseline is the anchor: if the model already produces harmful output without any template, a template count tells you little, and the finding is the baseline itself.

  • Start broad, then narrow: run a spread of templates on a small objective set, then extend only the templates that moved the result.
  • Read templates against the baseline: a template is interesting when it raises compliance above what the bare objective achieved.
  • Account for request cost: every template multiplies the objectives, so the request count grows with each one added.
  • Keep the delivery method fixed: compare inline and system prompt delivery in separate runs so differences are not mixed together.
  • Record the set used: write down the templates, objectives and target configuration so the first run can be repeated.

Before you run, confirm the template list and objective count your version of the scenario will use in the PyRIT documentation for your release.

Security and operational considerations for jailbreak testing

A jailbreak run produces harmful prompts and harmful model replies, and it needs credentials to reach the target. The cards below cover where that material lands, who can read it, and how to keep it out of shared logs. Each one applies to a PyRIT AIRT Jailbreak scenario run, whether it is run once from a workstation or repeatedly from a pipeline.

Harmful outputs stored in memory

PyRIT records every prompt, converted prompt, and response in its memory store, so a Jailbreak run leaves a full archive of the harmful text the templates elicited. Treat that archive as sensitive content, not as scan metadata. Before the first run, confirm where the memory database is written, how long it is kept, and who on your team can query it. Plan deletion or retention rules before results start accumulating.

AIRT Scenarios docs

Restricting the SQLite or Azure SQL store

PyRIT memory runs on SQLite for local work or Azure SQL for shared use. A local SQLite file is only as protected as the workstation's file permissions and disk encryption. An Azure SQL database needs its own network rules, authentication model, and role assignments. Decide which store each team uses, restrict read access to the people reviewing results, and confirm that backups inherit the same controls.

Protecting credentials in .env and Key Vault

PyRIT reads target credentials from ~/.pyrit/.env, which is a plaintext file on whichever machine runs the scan. For shared or automated use, move target keys into Azure Key Vault and reference them from configuration rather than copying them onto every runner. Limit who can read the secrets, rotate keys used by the scanner on a schedule, and confirm that the .env file is excluded from version control and from container images.

Keeping attack content out of job logs

Pipeline and job logs are often readable by a wider group than the red team, and they are retained by the CI system for its own period. A jailbreak run that prints prompts or responses to stdout exposes that content to everyone with log access. Set the scan to report aggregate results only where possible, store detailed output in the memory store, and review the CI log settings for retention and access before wiring the scenario into a build.

Testing only authorized systems

A jailbreak scenario sends adversarial prompts to whatever endpoint the target registration points at. Before any run, confirm in writing that the system is owned by your organization or that its owner has approved the test, including the environment, the model version, and the time window. Check that the target name in configuration matches that approved system, because a copied configuration can quietly point a scan at a production endpoint.

How objectives, templates and the target meet in a run

The run starts with HarmBench objectives and jailbreak templates feeding the Jailbreak scenario, which crosses each objective with each template and delivery technique. The prompt_sending attack renders the objective into the template, or the jailbreak_system_prompt option sets the template as a system prompt, and the target responds. Scorers then judge each response, and every conversation and result lands in memory next to the un-jailbroken baseline. Check that the baseline is present in memory, because it is the comparison that shows whether the template changed behavior.

Objectives and templates pass through the scenario to the target, scorers and memory.

Limits to confirm in your environment

A Jailbreak scenario run produces numbers that only mean something if the template set, the scorer and the target behave the way you assume. The cards below list the checks that connect a PyRIT release to a result your security and compliance teams can rely on.

Template and dataset versions

The templates and HarmBench objectives shipped in your PyRIT release are the ones your run uses, and they can change between releases. Record the installed version and the exact template and objective files used in each run, so a later rerun can be compared fairly. Ask whether the scenario's defaults pick a fixed set or a sample, because a sampled set changes what a single run covers. Pin the version before the first baseline.

AIRT scenarios docs

Scorer accuracy and success

A jailbreak counts as successful only when the scorer judges the response as harmful, so the attack success rate is only as reliable as the scorer. Measure the scorer against a set of responses your team has labeled by hand, including refusals, partial answers and off-topic text. Check how it handles responses that reframe the harmful request into fiction or role play, since those are where judges disagree most.

System prompt behavior per target

Delivery as a system prompt depends on whether the target model or application accepts a system role at all, and on how it treats system content compared with user content. Some hosted services or custom endpoints silently drop or merge the system message. Confirm with a short test that the template reaches the model in the form you expect, and record that behavior next to the results so the inline and system prompt numbers are not compared blindly.

Rate limits and cost

Every template and objective pair is a request to the target, and multi-turn or scored runs add requests to the adversarial model and the scorer. Your target's rate limits, token quotas and per-request charges set how long a full run takes and what it costs. Ask your provider for its limits and pricing for the models in use, and set concurrency and template counts so the run fits inside them before you start.

Default settings against policy

The scenario's default objectives, delivery techniques and inclusion of the un-jailbroken baseline reflect the project's choices, not necessarily your acceptance criteria. Compare each default with your red teaming policy, including which harm categories are in scope and whether the baseline must be reported. Write down any default you override, so the assessment can explain why the scope differs from the packaged run.

Data handling of attack content

Jailbreak runs store harmful prompts and model replies in PyRIT memory, which is SQLite by default or Azure SQL when configured. Decide where that memory lives, who can read it and how long it is kept, because the attack content itself becomes sensitive data. Confirm that your team's retention and access rules apply to this store before the first run.

Questions teams ask before running the Jailbreak scenario

How much effort does a first Jailbreak scenario run take?

A first run takes more effort in setup than in execution. The work is a registered target, a working ~/.pyrit/.env and ~/.pyrit/.pyrit_conf, a small dataset size for a trial, and a reviewer who reads the output. The effort grows with the number of template and delivery combinations you choose, the number of objectives you include, and how much the target must be adapted to accept the prompts. Scope the first run to a few objectives and a handful of templates, confirm that results land in memory as expected, then widen the run. Ask any partner to price setup, target work, and review as separate line items so you can see which part is one-time and which recurs with each new model version.

Can an internal team run the Jailbreak scenario without outside help?

Yes, if the team has Python experience, access to the target, and someone who can interpret the results. PyRIT installs with pip, supports Python 3.10 up to but not including 3.15, and its documentation recommends Python 3.13, so the runtime is straightforward. The harder parts are target wiring, credential handling, and judgment about what a jailbreak success means for your product. Internal teams often underestimate the review step: each scored conversation needs a person who can decide whether the output is a genuine policy failure. Confirm that at least one engineer can maintain the target connector and that someone outside the build team can sign off on findings.

What does the Jailbreak scenario need from our team?

It needs four things before a run starts:

  • Target access: an endpoint or model deployment PyRIT can reach from the machine or runner that executes the scan, with the rate limits known in advance.
  • Credentials: API keys or tokens stored in ~/.pyrit/.env or a secrets store you control, never in shared job logs.
  • Written authorization: a sign-off that names the system under test, the objectives that apply, and the window in which testing may run.
  • A reviewer: someone who reads the scored outputs, decides which results are real findings, and records how each was handled.

Confirm these with your security and legal owners before scheduling, because a jailbreak run generates prompts and responses that may be sensitive.

How long does a Jailbreak scenario run take?

Run time depends mainly on the number of objectives multiplied by the number of templates and delivery techniques, then divided by how many requests the target can serve concurrently. Each combination sends at least one request to the target, and multi-turn or scorer-heavy configurations add more calls. The baseline without a jailbreak is included by default, so it adds one more pass per objective. To estimate duration, count the combinations in your planned run, measure your target's response time on a small batch, and test concurrency settings before a full run. No fixed duration applies across environments, so ask for a timed trial on your own target before committing to a schedule.

How does template count change the cost and the time of a run?

Template count scales the run more directly than any other setting. Doubling the templates roughly doubles the target requests for each objective and delivery technique, and it doubles the scoring work for the scorer you choose. Scoring by an LLM judge also adds model spend that recurs on every run. Choose templates by coverage: include a representative set across the jailbreak families relevant to your application, keep the baseline for comparison, and add templates only when they test a new failure mode. Record the template list in the run's memory labels so later runs can be compared on the same basis.

Does the Jailbreak scenario run inline or as a system prompt, and which should we choose?

PyRIT supports both delivery styles. The prompt_sending technique renders the objective into the template and sends it as one user message, which tests whether the model can be talked out of its behavior through user input. The jailbreak_system_prompt technique sets the template as a system prompt, which tests whether the model still holds its policy when the attacker controls the instructions. Test both if your deployment accepts system prompts from some users, since those paths carry different risks. If your product never exposes system prompt control, run the inline style first and document why the system prompt style is out of scope.

Can DeployOpen run the Jailbreak scenario for us?

Yes. DeployOpen runs security testing for applications, APIs, AI systems and agents, and it can plan and execute PyRIT assessments inside your environment. Most engagements are fixed-scope, so the target, objectives, templates, reviewer role and deliverables are agreed in writing before work starts, and a quote follows from that scope. Ask for a written statement of what is tested, what evidence is delivered, and how retesting is handled. DeployOpen does not issue audit reports or certifications, so any compliance conclusions still rest with your independent auditor.

How DeployOpen scopes and delivers PyRIT jailbreak assessments

DeployOpen runs the PyRIT AIRT Jailbreak scenario as part of a written, fixed-scope assessment inside your own infrastructure. We agree which HarmBench objectives, delivery techniques and jailbreak templates are in scope, set up the target and memory, and deliver results your security and AI teams can review and rerun.

How we scope

  • Agree in writing which target, objectives, delivery techniques and jailbreak templates the assessment covers
  • Confirm whether the un-jailbroken baseline is included and how baseline results will be compared
  • Record how many templates run and the reason for that count, so the scope is repeatable

How we build

  • Register the target and credentials in your environment, with secrets kept out of shared configuration
  • Configure memory storage and run labels so every Jailbreak run can be traced to a build or test window
  • Verify a small first run against the agreed scope before the full scenario starts

How we hand over

  • Deliver the scenario configuration, run commands and results with the objectives and templates used
  • Document how to read inline and system prompt delivery results side by side, with the baseline
  • Provide a written findings report with reproducible conversations and recommended fixes

How we support

  • Engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as a retainer
  • Retest agreed findings after fixes so the next run shows whether the jailbreak success changed
  • Confirm with your team when a PyRIT upgrade or target change requires the scenario to be rerun

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.