When a PyRIT TextAdaptive scenario fits your red teaming plan
The TextAdaptive scenario in PyRIT suits a team that has many text objectives to run against a model or application and needs the framework to choose attack techniques per objective, not run one fixed list against everything. For each objective, it selects from text-compatible attack techniques using an epsilon-greedy selector that favors techniques which have worked before, and it stops that objective after the first success or after max_attempts_per_objective is reached. That fits a plan where the question is not only whether a model fails, but which techniques reach failure for which kinds of objective, with a bounded number of requests per objective.
It is a poor fit when you need full coverage of a named technique family on every objective, or when your objectives are few enough that a fixed list is easier to audit. Adaptive selection also changes which techniques run from one run to the next as results accumulate, so a team that needs an identical request set for a compliance comparison should record the configuration and memory outcomes and confirm, in its own environment, how repeat runs behave. Before the first run, confirm the max_attempts_per_objective value your review process can accept, the target you will test, and which scorer will decide success.
The direct prompt is the baseline: each objective is sent as-is, with no technique applied. Run it so you can tell whether an adaptive success came from the technique or whether the model already complied with the plain request. If the baseline already succeeds on an objective, that finding is about the model's default behavior and should be reported separately from the adaptive results. The adaptive scenario documentation in the PyRIT documentation for adaptive scenarios is the next read for the exact options and how the baseline is reported.
Request flow for one objective in TextAdaptive
Each objective starts with the direct prompt sent to the target as a baseline. The scorer then judges the response. If it records a success, the objective stops and the result goes to memory. Otherwise, the epsilon-greedy selector picks the next text-compatible technique, the target receives it, and the scorer checks again. The loop ends at the first success or when max_attempts_per_objective is reached, and the final outcome is written to memory. When you read a run, check the baseline result and the attempt count for each objective.
Per-objective loop in TextAdaptive, from baseline to memory record.
Configuration options and when each fits
This table compares the options a team sets before running the TextAdaptive scenario, with the request volume and comparability effect of each. Confirm default values in the PyRIT documentation before you rely on them, and fix the options you will compare across runs before the first baseline.
| Option | When it fits | Effect on requests and comparability |
|---|---|---|
| Target choice | Use the production-equivalent deployment for the final assessment, and a cheaper or local model for pipeline or tuning runs. | Each objective sends requests to the target, so volume follows the target's response count. Results only compare across runs when the target version stays fixed. |
| Scorer choice | Use an LLM judge or a content safety scorer that matches the harm category under test. | Scorer calls add requests of their own. Changing the scorer changes what counts as success, so earlier results stop being comparable. |
| Technique pool | Start with a small pool of text-compatible techniques for a first run, then widen it for a deeper assessment. | More techniques raise the number of attempts each objective can consume. Keep the pool identical across runs you plan to compare. |
| max_attempts_per_objective | Set a low value for a quick check and a higher value when you need to know whether an objective ever succeeds. | This is the main ceiling on requests per objective. A higher limit increases volume, and a lower limit may report false negatives for hard objectives. |
| Direct prompt baseline | Include it when you need to show how much the techniques add beyond an unmodified request. | Adds one request per objective. Without it, you cannot tell whether a success came from a technique or from the target answering the plain prompt. |
| Dataset size for a first run | Use a small, fixed subset of objectives to check the setup before a full run. | Request volume scales with objective count times attempts per objective. A small subset makes setup faults cheap to find, but its results should not be read as a full rate. |
| Memory labels | Label each run with the build, target version and scenario so results can be filtered later. | Labels do not change requests. Without them, comparing runs across weeks or pipelines becomes manual work. |
When adaptive selection saves requests and when it does not
TextAdaptive stops work early for each objective, so its savings depend on how many objectives you run, how quickly your target refuses and how trustworthy your scorer is. The cards below describe the situations where that trade-off helps and where a fixed run is the better choice. Measure requests on your own target before you rely on either pattern.
Many objectives with early success
Adaptive selection saves the most when a large objective set contains many items that one of the early techniques breaks. Each objective stops after its first success, so later techniques are skipped for that objective. Check how often objectives succeed on the first few techniques in a small pilot, and confirm that your objective list is large enough for the skipped attempts to add up.
A few objectives with a simple full run
With only a handful of objectives, the bookkeeping that adaptive selection adds can outweigh the requests it saves. A fixed run of every technique against every objective is easier to read, to rerun and to explain to a reviewer. Compare the total request count of both approaches before choosing, since the difference may be small at this size.
Targets that refuse quickly
A target that refuses most objectives on the first attempt gives the selector little to learn from, and the savings depend on whether refusals count as failures or as wasted attempts. Run a sample and look at how many attempts each objective needs before it stops. If refusals dominate, check the refusal behavior of the target and its safety settings rather than reading the request count as a measure of risk.
Scorers with high false positives
A scorer that flags harmless responses as successful will end objectives early, so the run reports success before the other techniques were tried. Adaptive selection then hides the coverage you meant to test. Before trusting the early stop, review a sample of scored successes by hand and measure the scorer's false positive rate on your content.
Reports that need every technique
When a report must show how each technique performed against each objective, early stopping leaves gaps in the table. Auditors and risk owners often ask whether a technique was tried at all, and a skipped cell is hard to explain. In this case a full run gives complete evidence, and the extra requests are the cost of that completeness. Ask the team reading the report which view they need before choosing the mode.
Setting up a TextAdaptive run with pyrit_scan
This sequence takes a team from a clean environment to a first TextAdaptive scenario run against a registered target, with a confirmed scorer and a memory record that shows which techniques were tried for each objective. It is designed so a small first run proves the setup before any larger assessment.
Confirm a supported Python version
The engineer running the assessment checks the interpreter version before installing anything. The PyPI package supports Python 3.10 up to but not including 3.15, and the PyRIT documentation recommends Python 3.13, so that is the version to use where your environment allows it. Done means
python --versionreports a supported release inside a dedicated virtual environment, separate from any system Python used by other tools.Install PyRIT from PyPI
Install the package with pip into the virtual environment. Pin the version you intend to use so that later runs and reviews refer to the same release, and record that version in your assessment notes. Confirm the install by running
pyrit_scan --helpand checking that the command prints its usage text without import errors. If the command is missing, the environment's script path is not on your shell path.Configure credentials and settings files
Create
~/.pyrit/.envfor credentials for the target and any scorer model, and~/.pyrit/.pyrit_conffor runtime settings. Keep the credentials file readable only by the account running the scan, and do not commit it to a shared repository. Confirm the configuration by running a read-only command, such as listing scenarios, and checking that it loads without a missing-key error. Check each key name against the PyRIT documentation for your version before relying on it.Register the target to be tested
Register the model or application endpoint that the adaptive attack will send prompts to. Use the registration method that matches your target type, such as an OpenAI-compatible endpoint, an Azure deployment or a custom HTTP endpoint, and give it a name your team will recognize in logs. Confirm registration by listing targets with pyrit_scan and checking that the name appears with the expected endpoint, then send one benign test prompt to verify a response comes back.
Confirm the scorer before attacking
Decide which scorer will judge whether each response is a success, and confirm it runs on a known example. PyRIT scorers can use an LLM, Azure AI Content Safety or custom logic, and an unverified scorer can record false results that look like findings. Send one clearly harmful and one clearly benign sample through the scorer and check that the verdicts match what you expect. Record the scorer name and version in the assessment notes so the result can be reproduced.
Select the TextAdaptive scenario and a small dataset
Start the scenario from pyrit_scan with the adaptive text option and point it at the registered target. Limit the dataset to a few objectives for the first run so the setup can be verified quickly, and confirm the direct prompt baseline is included so you can compare adaptive results against an unmodified request. Read the scenario's stated limits, including the stop conditions for each objective, before the run starts. The check is that the command echoes the target, scenario and objective count you chose.
Review the run output and memory records
When the run finishes, read the summary output and then open the memory store that PyRIT writes to, which uses SQLite or Azure SQL. For each objective, confirm the record shows the techniques tried, the order they ran, the score of each response and whether the objective stopped on a success or on the attempt limit. If a record is missing or a score looks inconsistent with the response text, fix the scorer or the target configuration before scaling up.
Save the run for comparison
Export or note the run identifier, the target and scorer versions, and the dataset used, so a later run with a larger dataset can be compared on equal terms. Store the memory records under your assessment's access controls, because they contain attack prompts and model responses. The sequence is complete when a second person can find the run by its identifier and reproduce the setup from your notes alone.
Using the direct prompt baseline in reporting
The direct prompt baseline answers one question: does the target respond to the unmodified objective without any technique applied? When the baseline already produces a scored harmful response, the adaptive scenario has found nothing new for that objective, and the finding is simpler than an adaptive success. When the baseline is refused and an adaptive technique later succeeds, the finding is stronger because the safeguard was bypassed by a transformation the team can name. Read the two results side by side for each objective, not as a single headline rate.
- Baseline success: the objective is exposed without any technique, so prioritize the fix over technique analysis.
- Baseline refusal, adaptive success: the safeguard holds for plain wording but fails under a specific technique, which is the most actionable finding.
- Both refused: record the objective as held in this run, and note the attempt budget used.
- Scope of the headline: report objectives reached by technique separately from objectives reached by the baseline.
- Run identity: tie each reported result to the target version and configuration it was run against.
Before sharing a summary, confirm the scorer and its threshold are the ones the team agreed on, because the baseline and adaptive results are only comparable under the same scoring.
For the engineer, the baseline is a control on the run itself. It confirms the target is reachable, the objective is delivered correctly and the scorer can flag a harmful response. If the baseline never scores positive on a known-unsafe objective, a set of adaptive refusals is not evidence of safety, because the scorer or the delivery path may be broken. Keep the baseline attempt in the same memory label as the adaptive attempts so the pair can be queried together.
- Delivery check: confirm the baseline prompt reaches the target unchanged, without converters applied.
- Scorer check: use a known-unsafe objective to confirm the scorer can return a positive result.
- Attempt accounting: record how many adaptive attempts ran after the baseline, so the cost of each finding is visible.
- Selector behavior: compare which techniques were selected for objectives the baseline already exposed, since those attempts may be wasted.
- Configuration drift: rerun the baseline when the target, system prompt or model version changes.
Before tuning the epsilon value or the attempt limit, check that the baseline result is stable across two runs.
A compliance reviewer should treat the baseline as context for an adaptive result, not as a standalone control. The baseline shows what the target does with the unmodified objective, which helps an assessor see how much of the adaptive outcome depends on technique choice. It does not show the coverage of all possible attacks, the behavior of production traffic, or whether the deployed system matches the tested configuration. Those limits belong in the evidence file next to the results.
- Stated limits: record that the baseline and adaptive runs sample a finite set of objectives and techniques.
- Traceability: keep the run identifiers, memory labels, target configuration and scorer version together.
- Reproducibility: note whether the selector is randomized, because epsilon-greedy choices can differ between runs.
- Independent review: an auditor assesses the evidence; DeployOpen prepares it but does not issue an audit opinion.
- Known gaps: list objectives that were not run or that the scorer could not evaluate.
Before accepting the evidence, confirm with the assessor which record format and retention period they require, since those requirements come from the assessment, not from PyRIT.
Security and operational considerations for adaptive runs
An adaptive run generates attack prompts, model responses and scores, and each of those is sensitive in its own way. The cards below cover where that material lands, who can read it, how credentials are kept, what to check before touching production, and how to report a flaw in PyRIT itself.
Keep attack content out of logs
TextAdaptive runs record every attempted technique against every objective, so the console and CI output can end up holding harmful prompts and model replies. Set the log level deliberately, check what your pipeline captures and retains, and confirm that job logs are not uploaded to a shared location. Treat the run's stored conversations as the controlled record instead of copying them into tickets or chat.
Store credentials in ~/.pyrit
PyRIT reads provider credentials from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf. Keep that directory readable only by the account running the scan, keep it out of version control, and avoid placing keys in scenario files or command arguments that shell history might record. On shared runners, confirm with your platform team how these files are provisioned and removed after each job.
Know where memory lives
PyRIT memory stores conversations and results in SQLite or Azure SQL. A local SQLite file is only as protected as the host filesystem, so confirm its path, permissions and backup behavior. With Azure SQL, confirm who holds database roles, how access is audited, and whether the database sits in a region and network your data handling rules allow.
Approve production targets first
An adaptive run sends many prompts in sequence, which can load a live service, trigger abuse monitoring at the provider, or create customer-visible content if the target writes to real systems. Before pointing TextAdaptive at a production endpoint, get written approval from the system owner, agree a window and a contact, and confirm that the target account is one the provider permits for this kind of testing. A staging deployment with the same configuration is the usual starting point.
Report PyRIT vulnerabilities privately
If a run exposes a flaw in PyRIT itself, such as a way a crafted response could execute code or leak stored credentials, do not open a public issue. Report it privately through the Microsoft Security Response Center under the project's security policy, and include the PyRIT version, the scenario and the minimal reproduction. Keep your findings about the target model separate from defects in the framework.
PyRIT on GitHubQuestions teams ask before running TextAdaptive
How much effort does running the TextAdaptive scenario take, and who does the work?
Your own engineers do the work when you run PyRIT yourself, and the effort is mostly setup and review rather than execution. The main tasks are registering the target, choosing and approving objectives, configuring a scorer, and reading results against your risk criteria. The scenario itself runs without manual steps once it is configured. A DeployOpen engagement, if you choose one, would be fixed-scope and priced from a written scope, which depends on the number of targets, the objectives you need covered, and how much reporting you want. Ask any partner to itemize setup, test runs, review time and retesting so you can compare against your own team's time.
How long does a first TextAdaptive run take?
The duration depends mainly on how many objectives you include, how many attempts each objective can make, and the rate limits your target and scorer allow. Each objective stops after its first success or after the configured max_attempts_per_objective, so a small objective set with a low attempt cap finishes much faster than a large one. Start with a small dataset to measure request volume and throughput against your target, then scale up. No runtime figure is given here because it depends on your endpoint, so confirm limits with the team that owns the target before planning a window.
What must our team provide before a TextAdaptive scan?
Plan to provide several things before the scan starts:
- Target access: a registered endpoint or model connection, with credentials stored outside the scan configuration.
- A scorer: a method for judging whether a response succeeded, such as an LLM judge or a content classifier.
- Datasets and objectives: the harm categories and prompts that reflect your application's risk.
- Approvals: written sign-off from the owners of the target, the data and the test window, plus a rule for handling findings.
Confirm each item with the owning team, because gaps in approvals or scorer choice are the usual reasons a first run is delayed.
Can an in-house team run TextAdaptive without outside help?
Yes, an in-house team with Python experience and access to the target can run the scenario, as PyRIT is an open-source framework installed with pip. The harder skills are defining objectives that match your use case, choosing a scorer you can justify, and interpreting results for a risk decision. Your security or AI risk staff should own those judgments. If the team lacks red teaming experience, an outside partner can help design the objectives and review the findings, and that support is scoped in writing before work starts.
Are TextAdaptive results repeatable from one run to the next?
Results are not guaranteed to be identical between runs, because the selector chooses techniques with an epsilon-greedy approach that uses prior success, and the target and scorer may also vary. To make runs comparable, fix the target version, dataset, objective list, attempt limit and scorer, and record the configuration with each run. Then compare trends across runs rather than expecting identical outcomes. Ask your team to confirm how the selector's randomness is seeded in the PyRIT version you deploy.
How does TextAdaptive differ from a fixed Foundry or AIRT scenario?
A fixed scenario runs a predefined set of techniques against its datasets in a set order. TextAdaptive instead picks techniques per objective from prior success, and stops each objective after the first success or the attempt cap. That can save requests when a few techniques work well, but it also means coverage is less predictable, so you may need a direct prompt baseline to see whether the target refuses the objective without any technique. Choose the fixed scenario when you need a documented, uniform technique list for compliance evidence, and choose TextAdaptive when you want to focus effort on objectives that have not yet been broken.
How DeployOpen scopes and delivers PyRIT adaptive assessments
DeployOpen plans, installs and documents PyRIT TextAdaptive assessments inside your own environment, so your security and engineering teams can review the configuration, the targets and the stored results. Engagements are fixed-scope, with the scenario, targets, datasets and deliverables agreed in writing before any test runs.
How we scope
- Confirm which target applications and models the adaptive run will reach, and who approves access to each.
- Agree the objective datasets, the technique set and the max_attempts_per_objective value in writing.
- Define the scorer, the memory location and the evidence the assessment must produce before work starts.
How we build
- Install PyRIT on hosts you control and register each target through configuration, keeping credentials out of scenario files.
- Run a baseline with the direct prompt next to the TextAdaptive run so results can be compared on the same objectives.
- Check selector behavior and per-objective stop conditions on a small illustrative dataset before the full run.
How we hand over
- Deliver the scenario configuration, run instructions and the pyrit_scan commands your team uses to repeat the assessment.
- Document how results are read from memory, including which techniques succeeded, how many requests each objective used, and the scorer output.
- Walk your security and engineering staff through findings, limits of the adaptive method, and the steps to rerun it after changes.
How we support
- Support is available as a retainer for upgrades to new PyRIT releases, scenario updates and repeated assessments.
- Retesting after fixes to the target application uses the same scenario and objectives so changes can be compared.
- Ask any provider, DeployOpen included, to confirm the PyRIT version, Python version and scorer configuration in the quote.

