Fallback attack chains with PyRIT sequential attacks

How to build a PyRIT compound attack that runs a cheap attack first, escalates to Crescendo or TAP only on failure, and returns one result with each attempt preserved.

On this page

Why a PyRIT fallback attack chain saves testing effort

A PyRIT compound attack runs a list of inner attacks in order toward one objective and returns a single AttackResult, with each inner result kept as a child. The red team lead who needs one answer per objective can therefore ask a cheap attack to go first and reserve an expensive multi-turn attack for the cases where the cheap one fails. The canonical use is this fallback chain, and it suits a team that has many objectives, a fixed budget for adversarial multi-turn runs and a need to report one outcome per objective.

The situation usually looks like this: a list of harmful or policy-violating objectives for a deployed model or application, a budget that covers only a limited number of Crescendo or TAP runs, and a findings report that expects one verdict per objective. Running every objective through the most expensive attack spends the budget on objectives a single-turn probe would have already broken. Running only the cheap attacks risks reporting a clean result that a multi-turn attack would have contradicted. A fallback chain sits between these choices, and the team should decide up front which objectives are worth the expensive stage and what the report will count as a success. Confirm the adversarial model cost and the number of turns each stage allows in your environment before you size the budget, since neither is set by PyRIT alone.

How a fallback chain moves from a cheap attack to Crescendo or TAP

The compound attack receives one objective and runs its inner attacks in order, starting with the cheap single-turn attack. A success ends the chain and the parent AttackResult carries that child. A failure or error hands the same objective to Crescendo or TAP. Under the default FIRST_SUCCESS policy, every child result is kept, so check the children, not only the parent, to see which attack ran and why it stopped.

Decision path of a fallback chain, with every child result rolled into one parent result.

Which inner attacks to chain and when each fits

This table compares candidate first-stage and fallback attacks by cost driver, typical position in the chain, and what a success tells the team. Read it as a starting order: cheap single-turn attacks go first, and adaptive multi-turn attacks such as Crescendo and TAP sit later because their cost depends on the adversarial model and target calls, which you should measure in your own environment.

Attack typeMain cost driverTypical chain positionWhat a success tells the team
Single-turn prompt attacksTarget calls per objective, usually one per promptFirst stage, cheapest to runThe target answers a direct or lightly converted request, so a basic filter or refusal gap exists
Skeleton Key style checksTarget calls for a short fixed exchange, no adversarial modelEarly stage, quick check of system prompt and filtersThe deployment's instructions or filters accept a known jailbreak framing
Crescendo multi-turnAdversarial model calls plus target calls across many turnsLater stage, after cheaper attacks failThe model's conversational defenses erode gradually under escalation
TAP (Tree of Attacks with Pruning)Branching factor multiplied by depth, with calls for each branch and scoringLate stage, when the objective still needs testingSome branch of adversarial prompts reached the objective, which often needs deeper investigation
Failed attack in a chainCost already spent on earlier stagesMoves to the next child in the listUnder the default FIRST_SUCCESS policy, the chain continues, so a failure is not a verdict on the target
Child error versus child failureTime lost to retries or broken targetsAny positionAn error may indicate a configuration problem, not a resistant target, so confirm before reading the result

Building and running a fallback chain in PyRIT

This sequence takes a team from a clean Python environment to a compound attack that tries a low-cost attack first and escalates to Crescendo or TAP only when needed. The output is one parent result with each inner attempt preserved as a child, ready for review.

  1. Install PyRIT on a supported Python version

    Create an isolated virtual environment and install PyRIT with pip from the PyPI package. The package supports Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13, so pin the interpreter to one of those. Confirm the installed version matches the release you intend to test against, since the project moved to microsoft/PyRIT and the original Azure/PyRIT repository is now read-only. Done when the import succeeds in a fresh interpreter and the version check reports the expected release.

  2. Configure credentials, memory and the target

    Place model credentials in ~/.pyrit/.env and shared settings in ~/.pyrit/.pyrit_conf, then initialize memory on SQLite for a local run or Azure SQL for a shared one. Point the target at the system under test, whether that is a hosted model, a custom HTTP or WebSocket endpoint, or a web app driven through Playwright. Send one benign prompt through the target to confirm a response comes back and that the exchange is recorded in memory. Done when that test conversation is visible in the memory store.

  3. Configure the scorer and define one objective

    Choose a scorer that matches the harm being tested, such as an LLM judge, Azure AI Content Safety, or custom logic, and write one objective that every inner attack will pursue. Keep the objective identical across children so that a success in one attack is comparable to a success in another. Run the scorer on a known safe response and a known unsafe example to confirm it returns different results. Done when both test scores are as expected and the objective text is saved in the run configuration.

  4. Order inner attacks from cheapest to most expensive

    List the attacks in the order they will run, starting with a single-turn or low-turn attack that costs few target calls, then the multi-turn attacks such as Crescendo or TAP. Cost depends on how many prompts and model calls each attack makes, along with the adversarial model it uses, so record the expected calls per attack before ordering them. Confirm each attack constructs against the same target and scorer without errors. Done when the ordered list is written down with its expected cost drivers for your team to review.

  5. Choose the sequence completion policy

    Set the completion policy on the sequence. The default FIRST_SUCCESS policy stops the chain when a child succeeds and continues past errors and failures, which is the usual fallback behavior. Decide whether an error in an early child should stop the whole chain or simply move on, and confirm the policy you choose matches that decision. Check the PyRIT compound attack documentation for the exact policy names available in your installed version. Done when the chosen policy is set in code and a dry run shows the expected stop or continue behavior.

  6. Run the compound attack

    Execute the compound attack against the target with the objective, scorer and ordered children in place. The compound attack runs the inner attacks in order toward the single objective and returns one AttackResult. Record the run identifier so the parent and children can be retrieved later. Done when the run completes and returns a parent result without an unhandled exception.

  7. Verify the parent result against each child

    Open the parent AttackResult and confirm it reflects the overall outcome, then inspect each child result it preserved. Check that every attack that ran has its own stored conversation and score in memory, and that children skipped by the completion policy are recorded as not run rather than as failures. Export the conversations for the attacks that ran so a reviewer can follow each step. Done when every child is retrievable from memory, the parent outcome matches the child that succeeded or the absence of success, and the results are saved for review.

  8. Record the chain for repeat runs

    Save the ordered attack list, completion policy, objective, scorer and target configuration together so the same chain can be rerun after a model or filter change. Store the parent and child result identifiers with the run record. Re-run the chain on an unchanged target to confirm the results are consistent enough to compare, and note where scorer variance or model randomness changes the outcome. Done when the saved configuration reproduces the run and the comparison notes are on file.

How child results roll up into one PyRIT result

A PyRIT compound attack returns one parent AttackResult, and each inner attack's result is kept beneath it as a child. The parent tells you the objective was met or not; the children tell you which attack did the work and what it cost to get there. Read the parent for the outcome and always drill into the children before you draw a conclusion about the target. Confirm the exact field names and how child results are exposed in your PyRIT version (the 1.1.0 documentation is the reference for this release) before you build a dashboard or report on them.

Treat a fallback success with care. If the cheap first attack failed and Crescendo or TAP succeeded, the correct reading is that the target resisted the first attack pattern but was still breakable by a more expensive one. It does not show the first attack was never viable, and it does not show the first attack was broken by a bug. Run the first attack on its own against the same target and objective, and record whether it failed, errored or was never reached because an earlier child succeeded. Errors and failures are not the same signal: under the default FIRST_SUCCESS policy, a child that errors does not stop the chain, so an error can hide a weak test rather than a robust defense.

Record provenance on every finding. Store the parent result identifier, the child index and attack class, the adversarial model used, the target version and the objective text together, so a reviewer can see which child produced the outcome. Without that record, a report will count a Crescendo success as a generic jailbreak and overstate how easily the first attack path could be exploited. Decide before the first run how you will report chains: as the outcome of the whole chain, as per-attack success rates, or both, and keep those numbers separate in any executive summary.

Security and operational risks of running chained attacks

A fallback chain sends more traffic, holds more credentials and stores more harmful content than a single attack. The cards below cover the operational and security risks to settle before a chain runs against a system you care about.

Test traffic and rate limits

A chain multiplies requests: each objective can reach the cheap attack, then Crescendo or TAP, and TAP branches further. Against a production endpoint this can trip rate limits, inflate model bills and degrade service for real users. Agree a request budget per objective, run against a staging or pre-production target where possible, and confirm the owner of the endpoint has approved the load profile in writing.

Credentials in the PyRIT environment file

PyRIT reads credentials from ~/.pyrit/.env, so every target and scorer key in a chain sits in one plaintext file on the runner. Use keys scoped to test deployments, rotate them after engagements, restrict file permissions on the host, and keep the file out of shared images and repositories. Confirm with your secrets team whether a managed vault should supply these values instead.

Harmful content in memory storage

PyRIT memory stores conversations and results in SQLite or Azure SQL, and a chain writes every child attempt, including the harmful prompts and responses from the failed cheap attack. Decide who can query that database, how long records are kept, and how the store is encrypted and backed up. Treat the memory file as sensitive data, not as a log.

Scope and authorization of the objective

The objective defines what the chain tries to elicit, and a fallback chain will pursue it through several strategies. Before running, write down which systems, model deployments and data sources are in scope, who authorized the test, and which objectives are excluded. An objective that falls outside the signed scope is a finding about your process, not about the model.

Reporting vulnerabilities in PyRIT

If testing surfaces a defect in PyRIT itself, report it privately through the Microsoft Security Response Center under the project's security policy rather than opening a public issue. Keep your deployment on a supported release, and check the releases page for patches. The original Azure/PyRIT repository is archived and read-only, so track development at the microsoft/PyRIT repository.

PyRIT releases

Questions teams ask before building fallback attack chains

How much effort does a PyRIT fallback chain take to build?

Effort depends mostly on how many attacks sit in the chain, how much each one must be adapted to your target, and how much scoring work the chain needs. A chain of two attacks against a stateless chat endpoint with an existing scorer is a small change to a PyRIT script. Adding a Crescendo or TAP fallback adds an adversarial model, a turn or branch budget, and a target that handles conversation state correctly, so the work grows with each of those. Ask any partner to break the estimate into target adaptation, objective and scorer design, adversarial model setup, and the review of child results. Those four items are where the hours go, not the compound wrapper itself.

Can our in-house team build a fallback chain without outside help?

Yes, if the team already writes Python, can run PyRIT from its published package, and has someone who understands the target's conversation handling. PyRIT is an open source framework from Microsoft under the MIT license, so the chain itself needs no license purchase. The harder parts are judgment calls: deciding what counts as success, deciding when a cheap attack has failed versus errored, and proving that a fallback result is meaningful. Teams often do the first build in-house and bring in a partner for scorer validation, a second review of the completion policy, or a repeatable test suite that runs in CI.

What do we need to provide before the work starts?

Four things drive the start of the work: access to the target, a written set of objectives, a scorer that decides success, and a plan for the adversarial model. For target access, confirm whether the endpoint is stateless, whether it keeps conversation history, and which credentials and test environment are allowed. Objectives should be specific enough that a scorer can judge them. For the scorer, PyRIT supports LLM-based evaluation, Azure AI Content Safety and custom logic, so decide which one your policy accepts. For the adversarial model, decide whether it is a hosted service or a model you run in your own infrastructure, since that choice affects data handling and cost.

How long does setup take for a fallback chain?

Duration depends on scope, and no figure in this answer is a quote. A single-target chain with one cheap attack, one fallback, and a scorer already in use is the smallest case. Adding a second target, a new scorer, multiple objectives, or a repeatable CI run each extends the schedule. Ask for milestones that separate target connection, a working chain against one objective, scorer checks, and the expansion to the full objective set. Your organization's approval steps for test traffic and model hosting can take longer than the engineering itself, so start those early.

How is a fallback chain different from running each attack separately?

A fallback chain is a PyRIT compound attack that runs a list of inner attacks in order toward one objective and returns one AttackResult with each inner result kept as a child. Running attacks separately produces separate results that someone must compare by hand. With the default FIRST_SUCCESS completion policy, the chain stops as soon as a child succeeds and continues past errors and failures, so a cheap attack that fails leads to the next attack in the list. The practical benefit is that cost is spent only where the cheap attack did not already succeed, and the rolled-up result still shows exactly which attack produced the outcome.

What breaks most often in a fallback chain?

The most common failure is a misread result. If a child errors on a timeout or a rate limit, the chain moves to the next attack, so the final result can look like a fallback success when the cheap attack never really ran. Check child results for error status, not only the final outcome. The second common issue is state: a multi-turn fallback such as Crescendo assumes the target keeps conversation context, and a stateless endpoint can distort its results. Confirm target behavior before trusting any multi-turn child, and test the completion policy with a known-failing and a known-succeeding target.

Does a chain's success tell us the model is safe?

No. A success means one of the attacks in the chain produced a response your scorer judged as a violation for that objective. A failure means none did within the configured limits, which is not a guarantee of safety. Record the attack order, the completion policy, the turn or branch budget, and the scorer version with every run, so a result can be reproduced and explained. If your organization needs this evidence for a review, confirm with the reviewers what they will accept before you design the chain.

How DeployOpen scopes and delivers PyRIT attack chains

DeployOpen plans fallback attack chains as a written, fixed-scope engagement: the cheap first attack, the escalation attacks, the target access and the evidence each run must produce. We build the chain in PyRIT, test it against your own target, and hand over the code, configuration and documentation so your team can rerun and maintain it.

How we scope

  • Agree in writing which targets, objectives and inner attacks the compound chain will cover before any build starts.
  • Confirm the target access you will provide, including whether the endpoint is stateful or stateless, since that affects the escalation attacks.
  • Define the completion policy and the success criteria each child attack must meet before the chain stops.
  • Set the adversarial model, scorer and memory location the chain will use, and who in your organization reviews results.

How we build

  • Write the compound attack in PyRIT with a cheap first attack, then Crescendo or TAP as fallbacks, in the order you approve.
  • Test each inner attack alone against the target so failures are traced to a single attack rather than to the chain.
  • Verify that the roll-up returns one AttackResult with every child result preserved and readable in memory.
  • Pin PyRIT and dependency versions, and configure credentials and settings through your own secrets handling.

How we hand over

  • Deliver the chain code, configuration, objective and scorer definitions, and a run guide your engineers can follow.
  • Document the completion policy, the order of inner attacks, and the reasons each fallback step was chosen.
  • Provide a walkthrough that shows how to read parent and child results and export them for review.
  • Record known limits, such as cost per fallback and the need to confirm target behavior, in the handover notes.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover re-running the chain after PyRIT releases and after changes to your model or application.
  • Ask any partner for the written scope, the named deliverables and the retest terms before accepting a quote.

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.