What the PyRIT Foundry RedTeamAgent scenario runs and when to use it
If you need repeatable red teaming of a model or application you run yourself, the Foundry RedTeamAgent scenario in PyRIT is a packaged starting point. According to the PyRIT documentation, it combines converter-based attacks, multi-turn attacks and technique composition across EASY, MODERATE and DIFFICULT levels, and it uses HarmBench as its default dataset. The PyRIT Foundry scenarios documentation is the source to read for the exact technique list in your installed version, because the grouping is what determines how much time and model traffic a run consumes.
The level structure matters for planning. EASY techniques are single-turn transformations of the prompt, such as encoding and obfuscation converters, so they are cheap to run and useful for checking whether a target handles disguised harmful requests. DIFFICULT techniques are the multi-turn attacks, including Crescendo, Pair and Tap, which need an adversarial model to generate follow-up turns and therefore add cost and run time. Confirm which techniques your PyRIT version places at each level before you commit a budget, since the lists can change between releases.
Teams usually reach for this scenario when they want a broad first sweep of a target before writing application-specific tests, or when they need a repeatable baseline to compare against after a model or system prompt change. It does not replace a scenario built around your own objectives, your data and your harm categories, and it does not produce a compliance finding on its own. Scoring, scenario-specific datasets and human review of flagged conversations remain your responsibility to design and document.
How EASY, MODERATE and DIFFICULT techniques differ
The EASY level is built from converter-based attacks. A converter rewrites the harmful objective before it reaches the target, so the request arrives encoded, disguised or stylized instead of in plain language. The PyRIT documentation for the Foundry scenario lists Base64, ROT13, Leetspeak, Morse, Caesar, Flip, Jailbreak and Unicode confusables among the EASY techniques, and notes that the list includes others. These attacks test whether a safeguard recognizes harmful intent only when it appears in plain text.
- Encoding converters: Base64, ROT13, Morse and Caesar change the characters of the prompt. A model that decodes them without a check may follow instructions it would refuse in plain text.
- Obfuscation converters: Leetspeak, Flip and Unicode confusables alter spelling, order or lookalike characters while keeping the meaning readable to a person.
- Jailbreak converter: The Jailbreak entry in this level is a single-turn wrapper rather than a conversation, so it is quick to run across a dataset.
- Low request cost: Each EASY attack is one request per objective, so a first run over a small dataset stays inexpensive to execute.
- Limit of the signal: A refusal under EASY techniques does not show resistance to multi-turn pressure, so results should not be read as a full safety verdict.
Before running this level, confirm the exact converter names and parameters in the documentation for your PyRIT version.
The MODERATE level sits between single-turn converter attacks and the multi-turn strategies in DIFFICULT. The PyRIT Foundry scenario page describes the three levels as part of how the RedTeamAgent scenario combines converter-based attacks, multi-turn attacks and technique composition. This page does not supply a verified list of MODERATE techniques, so the exact contents should be taken from the documentation for the version you run.
- Check the version first: Open the Foundry scenario page for the PyRIT release you have installed, since technique sets can change between releases.
- Confirm the technique list: Record which techniques the MODERATE tier includes in your version and whether each is single-turn or multi-turn.
- Expect a mix: Because the level sits between the other two, plan for it to combine converter work with some conversation handling, which affects request volume.
- Compare against the other tiers: Run the same dataset through EASY, MODERATE and DIFFICULT so the results show where a target begins to fail.
- Record the tier in results: Label each run with its level so findings from one tier are not read as coverage of another.
Ask your team, or the maintainers' documentation, to confirm the MODERATE list before writing it into a test plan or an evidence record.
The DIFFICULT level uses the attacks that depend on conversation and adaptation. According to the Foundry scenario documentation, its techniques are Crescendo, MultiTurn, Pair and Tap. Each one keeps state across turns or generates new attempts from the target's previous responses, so cost and runtime rise with the number of turns and candidate prompts. Results from this level usually say more about how the target handles sustained pressure.
- Crescendo: Escalates a request gradually over several turns, starting from an innocuous topic and moving toward the objective.
- MultiTurn: Runs a conversation-based attack in which the adversarial model continues the dialogue, so the target sees accumulated context.
- Pair: Uses an attacker model to refine a prompt based on the target's replies, repeating the cycle until a stopping condition is reached.
- Tap: Explores several candidate branches in a tree, pruning weak ones, which multiplies the number of requests per objective.
- Cost drivers: Adversarial model choice, the number of turns and branches, and dataset size all increase model calls and the time a run takes.
Before a DIFFICULT run, confirm the adversarial model, the turn limits and the branch settings you have configured, because these determine the request volume and therefore the bill.
How converters, multi-turn attacks and composition fit together
The Foundry RedTeamAgent scenario combines three building blocks, and understanding how they relate tells you what each result actually measures. Converters transform a prompt before it reaches the target, for example encoding it in Base64 or ROT13, changing its leetspeak form, or wrapping it in a jailbreak template. Multi-turn attacks such as Crescendo, Pair and Tap hold a conversation with the target and adjust the next message based on the replies so far. Composition layers these techniques so that a converted prompt can also be delivered through a multi-turn attack. The scenario groups its techniques into EASY, MODERATE and DIFFICULT levels, so a run tells you which level of effort your safeguards withstood, not just whether they refused a single request.
The request flow starts with an objective from a dataset, which defaults to HarmBench. The scenario applies the selected converter or attack strategy, sends the resulting prompt to the registered target, and receives the response. A scorer then decides whether the response meets the objective, and PyRIT records the conversation and result in memory, which stores them in SQLite or Azure SQL. For multi-turn techniques, each turn passes through this loop, so the memory record holds the full exchange that an assessor will need to review. Confirm which scorer the scenario applies to each technique in your PyRIT version, because scoring behavior is the step most likely to change how you read the outcome.
Before you schedule a full run, decide which composed techniques you need and check the cost of each. Multi-turn techniques make more requests per objective than a single converted prompt, so the number of target and adversarial model calls grows with both the dataset size and the technique level. Record the converter, attack and dataset in the run labels so results can be compared across runs. Ask your team to confirm that the target registration and memory location are set up before the first run, because a failed run without persisted memory leaves no evidence to review.
How a RedTeamAgent run moves from dataset to findings
A run starts with HarmBench objectives, which the scenario pairs with techniques chosen by difficulty: converter-based attacks at the easy level, and multi-turn attacks such as Crescendo, PAIR and TAP at the difficult level. Each prompt is sent to the registered target, and the responses are scored before results land in PyRIT memory. Check that the target registration, the dataset and the technique tier match the scope you agreed, and review the scored conversations in memory before drawing conclusions from the summary.
Objectives flow through technique tiers to the target, then to scoring and memory.
Which difficulty level and dataset fit each test goal
This table compares the EASY, MODERATE and DIFFICULT levels of the Foundry RedTeamAgent scenario and the HarmBench default against a custom dataset. Read each row as a trade-off between coverage and run length, and start with the smallest option that answers your current question. Costs are qualitative because no request counts or run times are published for this comparison, so confirm them with a trial run in your own environment.
| Option | When it fits | Cost in requests and time | Trade-off |
|---|---|---|---|
| EASY level | A first baseline, a smoke test after a model or system prompt change, or a pipeline check | Lowest of the three levels because it relies mainly on single-turn encoding and obfuscation converters | Broad but shallow: catches naive filter bypasses, misses persuasion and multi-turn escalation |
| MODERATE level | A mid-cycle review where you want more coverage than a baseline without the full multi-turn cost | Moderate; more converter combinations and some multi-step attacks than EASY | Balanced coverage, but confirm the exact technique list for your PyRIT version before relying on it |
| DIFFICULT level | Pre-release or assessment evidence where multi-turn attacks such as Crescendo, PAIR and TAP matter | Highest; multi-turn attacks call the adversarial model repeatedly per objective, so run time grows with dataset size | Deepest coverage of the three levels, but the longest run and the most adversarial model usage |
| HarmBench default dataset | When you need a recognized, shared set of harmful objectives to compare results across models or releases | Scales with the number of objectives; the default is convenient but can be large for a first run | Repeatable and widely referenced, but it reflects general harm categories, not your application's specific risks |
| Custom dataset | When your application, users or regulated use case create harms that generic objectives do not test | Depends on how many objectives you write; start with a small, reviewed set | Most relevant to your deployment, but you must write, review and maintain the objectives and expected outcomes yourself |
| Limited dataset size for a first run | Any new target, new credentials or first CI integration | Keeps the first run short and reveals configuration errors early | Lower statistical confidence, so treat early results as a setup check rather than a risk finding |
Setting up the RedTeamAgent scenario in a PyRIT environment
This sequence takes a team from a bare machine to a verified first run of the Foundry RedTeamAgent scenario, with each step checked before the next begins. The result is a working PyRIT environment, a registered target and a small set of memory records the team can inspect.
Confirm a supported Python version
The platform engineer or security engineer who will run the scans checks that a supported interpreter is available on the machine or runner. The PyPI package supports Python 3.10 up to but not including 3.15, and the PyRIT documentation recommends Python 3.13, so 3.13 is the safer starting point. Confirm the version with the interpreter's version command before installing anything. The step is done when the reported version falls inside that range.
Install PyRIT with pip
Create an isolated virtual environment and install the package with pip from PyPI. Pin the version your team intends to use, and record it, because the scenario output and configuration keys can change between releases. The PyRIT documentation for the 1.1.0 release is the reference to read next for the current install command. The step is done when importing the package in Python succeeds and the pyrit_scan command is available on the path.
Create the credentials file
Create the directory
~/.pyrit/and add a.envfile in it that holds the keys for the model services you will test and any service the scorer calls. Restrict the file's permissions so only the scanning account can read it, and keep it out of source control and out of shared runner logs. The step is done when the file exists with restricted permissions and the scanning account can read it while other local accounts cannot.Set the configuration file
Create
~/.pyrit/.pyrit_confand set the settings the scan needs, such as the default memory location, concurrency and the default objective target. Keep values that differ between environments, such as endpoints, in this file rather than hard-coding them in scripts. Confirm each key name against the PyRIT documentation for your pinned version, because misspelled keys are easy to miss. The step is done when a configuration check reads both files without error.Register the target
Register the model or application you will test as a target, so the scenario can address it by name. Use the target type that matches your system, whether a hosted model endpoint, a custom HTTP or WebSocket endpoint, or a web app driven through Playwright. Send one benign test message through the registration to confirm the endpoint responds and that authentication works. The step is done when the target returns a normal reply to the benign message.
Run a small first scan
Run the RedTeamAgent scenario from pyrit_scan against the registered target, limiting the dataset to a few objectives and choosing a small technique set so the first run is short and easy to inspect. Use the Foundry Scenarios page in the PyRIT documentation to confirm the scenario name and the options your version accepts. Expect the run to end with a summary of results rather than an error. The step is done when the scan completes and the summary lists the objectives and techniques that ran.
Check the output and memory records
Read the scan output and then open the memory store, which is SQLite unless the team has configured Azure SQL. Confirm that each objective has a conversation record, that the technique names match what you requested, and that the scores are attached to the responses. Keep the run identifier so later runs can be compared. The step is done when every expected objective appears in memory with its conversation and score, and any gap is explained before the scale-up begins.
Composing techniques without inflating run cost
Foundry RedTeamAgent lets you stack converters, multi-turn attacks and DIFFICULT techniques in one run, and each addition multiplies the requests your target and adversarial model must handle. The cards below cover the decisions that keep composed runs interpretable and affordable, and the records that let you explain later which combination produced a finding.
Stacking an encoding converter on multi-turn attacks
An encoding converter such as Base64, ROT13 or Leetspeak changes the prompt before it reaches the target, and a multi-turn attack such as Crescendo then runs on top of that transformed input. Each converter adds a separate axis to the result, so a success under composition can come from the encoding, the escalation or both. Check whether the target decodes the encoded text reliably before reading a low success rate as safety.
Foundry scenarios docsDeciding when DIFFICULT is worth it
DIFFICULT techniques in RedTeamAgent are Crescendo, MultiTurn, Pair and Tap, and each objective can require many target and adversarial model calls before a verdict. Run a small EASY pass first and move to DIFFICULT only for objectives or harm categories where the cheaper techniques found nothing or where your risk profile demands depth. Record the request budget per technique so the cost decision can be reviewed later.
Holding variables fixed for comparisons
A comparison between two targets, two system prompts or two model versions only means something when the dataset, technique list, converters, scorer and adversarial model stay identical. Change one variable per run and keep the HarmBench default dataset or your chosen set constant across runs. Confirm the dataset size and random seed settings match, since differences in sampled objectives can look like differences in model behavior.
Recording which combination produced each finding
A finding is only reproducible if you can name the exact technique, converter chain, dataset entry, scorer and target version that produced it. Store the scenario name, labels and run identifier with each result, and export the conversation for reviewers. Without that record, a retest after a fix may not exercise the same path, and the fix cannot be verified.
Questions buyers ask about running the Foundry RedTeamAgent scenario
Can our own team run the Foundry RedTeamAgent scenario without outside help?
Yes, if your team has Python engineering skills, access to the model or application under test, and someone who can read and act on the results. PyRIT installs with pip, supports Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13. The harder part is not the install. It is deciding which target to test, which dataset and difficulty levels match your risk, how to score responses, and who reviews the output. Teams that want an outside party usually ask for help with scope design, target wiring, memory and evidence handling, or a retest after fixes. DeployOpen plans and runs this work as a fixed-scope engagement, with scope and deliverables agreed in writing before work starts.
What drives the effort and duration of a RedTeamAgent run?
Four factors do most of the work. The target type matters most: a hosted model API is simpler to connect than a custom web application driven through Playwright or a WebSocket endpoint with session logic. Dataset size sets the number of objectives, and every objective multiplies the requests sent to the target. Difficulty level changes the cost per objective, because the DIFFICULT techniques (Crescendo, MultiTurn, Pair and Tap) are multi-turn and need many more exchanges than EASY converter-based attacks such as Base64 or ROT13. Scorer and adversarial model choice also affect both runtime and cost, since multi-turn attacks use an adversarial model and scoring calls add more requests. Ask any partner to show how each factor changes their estimate.
What does the work need from our organization before it starts?
Four inputs are needed before a scan can run. First, target access: a registered endpoint or application that PyRIT can reach from the environment where it runs, ideally a non-production instance that matches production safeguards. Second, credentials: API keys or service identities stored in ~/.pyrit/.env or a managed secret store, with the least privilege the test needs. Third, an environment: a host or runner with the chosen Python version, enough storage for the SQLite or Azure SQL memory, and network rules that allow the test traffic. Fourth, reviewers: people who own the risk categories being tested and who will read flagged conversations and decide on fixes. Confirm with your security and legal teams that testing with harmful-content prompts is permitted under your policies and your model provider's terms.
How does the self-hosted RedTeamAgent scenario differ from Microsoft's managed Foundry agent?
The managed Foundry AI Red Teaming Agent runs inside Microsoft's service, while the PyRIT RedTeamAgent scenario runs in your own environment under your control. With PyRIT, you choose the host, the target wiring, the scorers, and where memory and results are stored, so you own the operational duties that the managed service handles for you. These include upgrades, dependency management, credential rotation and backup of the memory database. The attack families are similar in concept, but you should compare them directly rather than assume equivalence. Check which risk categories, attack strategies and scoring methods each option covers, and what evidence each produces. The related topic on moving from the Foundry agent covers this comparison in more detail.
What should we confirm about PyRIT versions before we start?
Confirm the PyRIT version you will run, because scenario names, options and behavior can change between releases. The latest release that the project's GitHub releases page lists is v1.1.0, released 4 September 2026, and the documentation for that version covers the Foundry scenario. Also confirm that you are using the development repository at github.com/microsoft/PyRIT, since the original Azure/PyRIT repository was archived on 27 March 2026 and is read-only. Pin the version in your environment so that results can be reproduced later, and record it with each run for audit purposes.
Which dataset licenses and terms apply to the HarmBench default dataset?
The Foundry scenario uses HarmBench as its default dataset, and you should confirm the license and usage terms of that dataset with its publishers before you run it in your organization. PyRIT's own license is MIT, but the license of a dataset it loads is separate and is not granted by PyRIT. Also check whether your internal policies allow storing and exporting the prompts and model responses that a run produces, because memory and reports will contain them. Ask your legal team to review the dataset terms together with your model provider's acceptable use policy, and document the decision as part of your test records.
What are the first things that usually go wrong in a RedTeamAgent run?
Most early failures come from setup rather than attack logic. Common causes include:
- Credentials not loaded from
~/.pyrit/.env, or loaded from a different user's home directory on a shared runner. - A target that rejects requests because of rate limits, session expiry or a changed request format, which causes many failed objectives.
- Memory written to a location that is not backed up or that other runs overwrite, which makes results hard to reproduce.
- Scoring that does not match your harm definitions, so the results look clean or noisy for reasons unrelated to the target.
Start with a small dataset and a single EASY technique, check that the target responds and that scores match what a reviewer would decide, and only then increase scope.
How do we know whether a partner's scope for this work is complete?
A complete scope names the target and its environment, the difficulty levels and dataset to run, the scorers and their configuration, the adversarial model used for multi-turn techniques, the memory store, and the outputs you will receive. It should also state who reviews findings, how fixes are retested, and what happens if a target cannot be reached. Ask the partner to state which items are included and which are your responsibility. Because most engagements are fixed-scope, the written scope is the basis of the quote, so any gap you find before signing is cheaper to close than a change request during the work.
Where to read the scenario documentation
Start with the Foundry Scenarios page in the PyRIT documentation for version 1.1.0, because it is the reference for what the RedTeamAgent scenario runs and how its techniques are grouped. Read it alongside the scenario definitions in your installed version, not from memory. Technique names, difficulty groupings and default dataset choices can change between releases, so check the page against the release you plan to deploy. Keep a note of the version you read, since the documentation is versioned and the same scenario name may behave differently in another release.
Then read the microsoft/PyRIT repository on GitHub. The source shows exactly which converters, attacks and scorers a scenario calls, how the default dataset is loaded, and which parameters control the number of objectives. Review the release notes before any upgrade, because scenario behavior and configuration keys are the first things to change. The original Azure/PyRIT repository is archived and read-only, so follow the microsoft/PyRIT location for current code and issues.
Before you rely on the scenario in a review, confirm three things with your own engineers: which techniques run at each difficulty level in your version, whether HarmBench is the dataset your run uses, and what the scenario records in memory. Write those answers into your assessment plan so an auditor or internal reviewer can trace each reported result back to the documented configuration.
How DeployOpen scopes and delivers PyRIT red teaming
DeployOpen plans, runs and documents PyRIT Foundry RedTeamAgent scenario assessments inside the client's own infrastructure. The work starts with a written scope that names the target, the techniques, the datasets and the evidence the client needs, so results can be reviewed by the client's own security and compliance teams.
How we scope
- Written scope names the target system, the Foundry RedTeamAgent techniques and the datasets to run
- Scope states which EASY, MODERATE and DIFFICULT technique groups are in and why
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
How we build
- Target connection and PyRIT configuration are set up in the client's environment, with credentials kept out of shared files
- Scenario runs use the agreed dataset and technique selection, with run settings recorded for repeatability
- Scoring results are checked against sample conversations so findings reflect real responses from the target
How we hand over
- Findings report lists each technique group, the observed behavior and the conversations behind it
- Runbook covers how to rerun the scenario, change its settings and read the memory and output
- Client receives configuration files and a retest plan so the team can repeat the assessment itself
How we support
- Retesting after fixes confirms whether each finding has been addressed in the target
- Ongoing support, upgrades and continuous testing are available as a retainer
- Ask for the support scope, upgrade handling and retest terms in the written quote

