Why PyRIT memory labels and operations matter for multi-run red teaming
Labels and operations keep PyRIT runs separable when several engagements, operators and model versions write into one memory store. Without them, every conversation and score lands in the same pool, and a reviewer later cannot tell which client, which person or which target build produced a given finding. PyRIT memory stores conversations and results in SQLite or Azure SQL, so the store itself is the shared record that every run feeds. Whether that store is a single local SQLite file or an Azure SQL database, the question for the team is the same: can each result be traced back to the engagement, operator and target version that produced it?
A single-run setup, such as one analyst testing one model on a laptop for an afternoon, rarely needs more than a clean memory file and a note of the target. A team needs labels once two or more of these hold: several engagements run in parallel, more than one person runs attacks, the same target is tested across model or prompt versions, or results feed a compliance file. Labels are the metadata tags attached to runs so that results can be filtered and grouped later. Operations, in the sense used here, are named groupings of runs that can be selected again. Before you rely on either, confirm the exact label and operation parameters, field names and selection commands against the PyRIT documentation for 1.1.0, since these APIs change between releases and should not be copied from older examples.
Label and operation choices and when each fits
This table compares the four label dimensions (engagement, operator, target version and build) and operation grouping, showing what each separates, the question it answers later and the cost of getting it wrong. Read each row as a decision: decide which dimensions your engagement needs before the first run, because labels added later do not reach earlier records. Confirm the exact label keys and filtering behavior against the PyRIT version you run.
| Choice | What it separates | Question it answers later | Cost of getting it wrong |
|---|---|---|---|
| Engagement label | Runs belonging to one client, system or test cycle | Which findings came from this assessment alone? | Findings from different assessments mix, and evidence for one engagement can include another's results. |
| Operator label | Runs started by each tester or team member | Who ran this attack, and can we reproduce their setup? | Accountability for a run is lost, and reviewers cannot trace questions back to the person who ran the test. |
| Target version label | Runs against different model or application versions | Did the fix in the newer version change the attack success rate? | Regressions and fixes look like the same result, so comparisons across versions become unreliable. |
| Build label | Runs against different builds of the system under test or the test harness | Which build introduced or removed a weakness? | Results cannot be tied to a specific deployed artifact, which weakens retest and evidence claims. |
| Operation grouping | A saved set of related runs under one name you can select again | Which group of runs belongs to this review or retest? | Retests get run against the wrong set, or a selection pulls in runs that were never part of the review. |
| Label naming convention | Consistent values across operators and engagements | Can a query on one label return all matching runs? | Inconsistent spelling or casing splits one engagement into several groups in later queries. |
| Labels fixed before the first run | Whether earlier runs can be sorted by a dimension added later | Can the team filter the full history by a dimension decided mid-engagement? | Runs made before a label existed cannot be separated retroactively without a documented mapping. Confirm this behavior for your version. |
Setting up labels and operations for a PyRIT engagement
This sequence sets up PyRIT so every run in an engagement carries the same labels for engagement, operator, target version and build, and so the team can find any run later by its operation. The output is an agreed label taxonomy, a configured environment and a tested memory query that confirms the labels were recorded.
Agree the label taxonomy with the lead
The engagement lead and the operators decide which labels every run must carry before anyone runs a test. Typical fields include the engagement name, the operator, the target model or application version and the build identifier, but confirm the final list against your reporting needs. Write each label as a short lowercase key with an agreed value format, and record who owns each value. Check: the lead signs off a one-page taxonomy, and every operator can repeat the field names without looking them up.
Configure shared settings in pyrit_conf
Set engagement-wide defaults in
~/.pyrit/.pyrit_confon each operator machine or on the shared runner, using the same file everywhere so runs behave alike. Keep settings that apply to the whole engagement in this file, and keep one-off values out of scripts. Confirm which keys your PyRIT version supports in the PyRIT documentation before you edit the file. Check: a new shell loads the configuration, and a short PyRIT command reports the values you set.Store credentials in the env file
Place target and scorer credentials in
~/.pyrit/.envso they stay out of notebooks, scripts and shared logs. Where your provider allows it, give each operator separate credentials, so memory records and provider logs can show who ran which test. Confirm the variable names for each target you connect in the PyRIT documentation. Check: a test call to the target succeeds with no key typed into code, and the key does not appear in the repository or in any exported file.Apply the labels to every run
Pass the agreed labels into each attack or scanner run so that memory stores them with the conversations and scores. Use identical label names for all operators, and build the shared script or notebook template so that a run cannot start without every required field. Confirm how your PyRIT version accepts labels on attacks and scenarios before you write the template. Check: a run started from the template produces stored records that carry every label field in the taxonomy.
Name and select a saved operation
Group related runs under one operation name so the review can select a set of results by name and then sort by date within it. Create the operation name at the start of the engagement, and follow the naming rule set in the taxonomy. When reviewers open the results, select the operation that matches the build under review. Check: the operation appears when the reviewer selects it, and it lists only the runs started under that name.
Verify labels with a memory query
Run a short test attack with a known label set, then query PyRIT memory for the conversations and scores it wrote. Filter on the engagement and operator labels and compare the count with the number of prompts you sent. Use the async memory API described in the PyRIT documentation to write the query, and save it as a repeatable check for the engagement. Check: the query returns exactly the test run and no runs from other operators or engagements.
How a labeled run moves from operator to memory and review
The diagram starts on the operator workstation, where a run is launched with labels for the engagement, operator, target version and build. PyRIT sends attack prompts to the target and collects responses and scores, then writes each conversation and result to memory with those labels attached. The trust boundary sits between the workstation and the memory store, so check which credentials and settings cross it. Reviewers later select an operation by its labels to pull findings, which is only reliable if every run was labeled consistently from the start.
Labels travel with each run from the operator's workstation into memory, where reviewers select them.
Protecting engagement data and operator identity in shared memory
PyRIT memory holds prompts, target responses and scores, which can include sensitive test content and client-specific details. The controls below cover how labels, storage and credentials keep one engagement's data separate from another's and limit who can read it.
Keep engagements in separate memory stores
Labels help you filter results, but they do not stop a query from returning another client's data if both sit in one database. Where a client contract or internal policy requires isolation, give each engagement its own memory location and record which location belongs to which engagement. Check that operators cannot point a run at the wrong store by default, and treat a shared store as a decision to document rather than a default.
Restrict permissions on SQLite files
A SQLite memory file on a laptop is readable by anyone who can read the file, including other local accounts and backup tools that sync the folder. Set file permissions so only the operator running the engagement can read and write the file, keep it out of synced folders, and confirm that copies made for review are protected in the same way.
Move credentials out of plain .env files
PyRIT reads credentials from ~/.pyrit/.env, so a model API key stored there is exposed to anyone who can open the file or copy the home directory. Confirm which keys each engagement needs, restrict the file to its owner, and rotate keys when an operator leaves the project. Ask your platform team whether an existing secrets store can supply them instead.
PyRIT docsDecide retention for prompts and outputs
Attack prompts and model outputs may contain harmful content, personal data or excerpts of proprietary material, and they remain in memory until someone deletes them. Agree a retention period with the client before testing starts, state who deletes memory at close, and confirm that deletion covers exported files and review copies, not only the live database.
Attribute runs to named operators
Shared labels are only useful if each run records who started it. Use a consistent operator identifier that maps to a named person in your team, not a shared account, so that reviewers can trace a finding back to the individual who ran it. Confirm that operators with access to a store are on the engagement roster and that the roster is reviewed when people change roles.
Review access on a fixed schedule
Access to memory stores, credential files and exports tends to accumulate as engagements run. Schedule a review at the end of each engagement and at set intervals for long-running programs, comparing who holds access against the current roster. Record the review outcome alongside the engagement's labels so auditors can see that access was checked.
Single operator, shared team, or client-separated memory
A solo tester using SQLite keeps the whole memory store in one local file, so labels are the only thing separating one engagement's results from another's. No one else writes to the file, which makes the discipline a matter of personal habit: settle the label set before the first run and keep it stable for the life of the engagement. Store the database file alongside the engagement records it belongs to, so a later reader can tell which file holds which results.
- Fix the label set early: choose engagement, operator, target version and build names once, and write them in a short notes file next to the database.
- Name operations by intent: use names that state what the run tried, such as the harm category and the target, so you can select the right saved operation later.
- Use one database per engagement where practical: a separate SQLite file for each engagement is simple to archive, hand over or delete.
- Capture the target version at run time: model and application versions change without notice and are hard to reconstruct later, so write them into the labels as each run starts.
- Back up the file and its settings together: copy the database with the settings in
~/.pyrit/.pyrit_confso the run can be reopened and explained later.
Confirm with your environment owner where the laptop or workstation database is stored, whether the disk is encrypted, and how long your organization expects engagement records to be kept.
A shared Azure SQL instance lets several operators write into one memory store, so labels must carry the identity of each person and each run. Without a shared standard, two testers can run the same attack under different names, or reuse one name for different targets. Agree the label vocabulary as a team standard before anyone runs against the shared store, and confirm who administers the database.
- Pick operator names from the team roster: choose names from a fixed list so one person never appears under three spellings in the results.
- Standardize engagement codes: use one code per engagement, agreed with the engagement lead, and place it in every label.
- Set a naming convention for operations: prefix operation names with the engagement code and a date or sequence number so shared queries and reports sort cleanly.
- Keep credentials personal: each operator should keep their own credentials in
~/.pyrit/.envon their own machine, and the file should never be copied into a shared folder or repository. - Limit who can edit or delete memory: deletion removes evidence, so name one owner who may change or remove records in the shared store.
Confirm with the database owner the connection method, the access model for each operator, the backup and retention settings, and whether the instance sits under your organization's data residency and access review rules.
When testing for several clients, or for a client whose data must stay apart from other work, use separate memory stores so no engagement can read another's conversations and scores. Labels still matter inside each store, but isolation is the primary control. Confirm the contractual requirements before choosing a store layout, because some clients specify where data is kept, who may access it and how long it is retained.
- Use one store per client engagement: a separate SQLite file or Azure SQL database for each client keeps conversations and scores apart by design.
- Carry the client engagement code on every run: the code keeps records traceable if the same team later merges stores for internal reporting.
- Keep settings and credentials scoped: each engagement's configuration and credentials should stay out of shared locations and out of sessions opened for other engagements.
- Decide disposal at the start: agree how the store is exported, retained and deleted at close-out, and record that decision in the engagement plan.
- Keep operation names unique across clients: a name that appears in two clients' stores can confuse anyone who reads a combined export or a shared report.
Ask the client and your own legal or compliance team which location, retention and deletion terms apply, and confirm the storage approach with them before the first run.
Limits to confirm before relying on labels for evidence
Labels and operations make PyRIT runs separable, but they only help an evidence file if they behave the same way in your setup. The cards below cover the points to test in your own environment before a label becomes part of a red teaming record.
Filtering labels in your memory backend
Labels are only useful for evidence if you can pull every run for one engagement or build out of memory without manual sorting. PyRIT memory stores conversations and results in SQLite or Azure SQL, and the two backends may differ in how they store and query metadata. Run a test engagement with two labels, then query each backend and confirm that the counts match what you expect. Record which backend your evidence depends on.
PyRIT documentationOperations across PyRIT upgrades
A saved operation is only as durable as the release that wrote it. Before you upgrade, confirm that operations saved under an older version still load, list the same labels, and return the same results. Check the release notes for any change to memory schema or label handling, and keep a copy of the memory database from before each upgrade so you can reproduce an earlier report.
PyRIT releasesLabel consistency across CLI and Python
A label set in a Python script may not look the same as one set through the command line or CoPyRIT. Run the same objective through each path and compare the stored labels field by field, including spelling, case and empty values. An operator who sets the target version in one tool and omits it in another will split one engagement into two groups in your records.
Operator identity on shared machines
Labels record the name an operator types, not a verified identity. If several people share a workstation, a service account or a CI runner, the operator label may show the wrong person. Confirm with your security team how operator names are assigned, whether they come from a directory, and whether the label is enough to meet your accountability requirement.
Target version and build capture
Labels only describe the target if someone fills in the target version and build correctly for every run. Confirm whether your process reads these values automatically from the deployed endpoint or relies on people to type them. A label that says the wrong model version can make a regression look like a fix, so test the capture step against a known target before trusting it.
Whether labels meet your evidence requirements
A label that is clear to engineers may still fall short of what an auditor, customer or regulator asks to see. Compare your label scheme with the evidence you have promised, such as who ran a test, against which version and when. Ask your assessor which fields they require and whether memory records alone are acceptable, or whether they also expect exported copies.
Questions teams ask about tracking PyRIT engagements
Which labels should we set up first for PyRIT engagements?
Start with the labels that separate results by engagement, operator, target version and build. These four prevent most confusion when runs from several teams land in the same memory store. Add a label for the target system if one application is tested under several configurations. Keep values short, lowercase and fixed in a shared naming guide so the same engagement is never spelled two ways. Write the rules down before the first run. Confirm in the PyRIT documentation how labels are attached to runs in the release you use, because the exact mechanism depends on the version and your configuration.
Do we need a consultant to set up PyRIT run labels?
No, a consultant is not strictly required, but the first setup benefits from someone who has already run PyRIT against your target types. Labeling is mainly a naming and configuration task, so an internal engineer who knows PyRIT can handle it. Outside help adds value when the label scheme must match audit evidence, when several business units share one memory store, or when no one on the team has read the memory model closely. If you engage a partner, ask for the label scheme, the configuration changes and a short walkthrough showing a labeled run being found again later. DeployOpen plans and implements self-hosted deployments, so this work would be quoted from written requirements.
How much effort does labeling PyRIT runs take, and who does it?
Effort depends on how many targets, operators and engagements you run, and on whether PyRIT is already configured consistently across the team. The one-time work is designing the label scheme, writing it into shared configuration and agreeing who owns naming decisions. The recurring work is checking that new runs carry the right labels and that operators do not invent new spellings. Factors that raise effort include several shared memory stores, automated pipelines that start runs without a person present, and reporting that depends on exact label values. Ask any partner to split the quote into design, configuration, a labeled test run and a handover that names the person who maintains the scheme afterward.
Do PyRIT labels work with both SQLite and Azure SQL memory?
PyRIT's memory stores conversations and results in SQLite or Azure SQL, so label planning must cover whichever backend you use. The naming convention itself stays the same on either backend. What changes is where the records live, who can read them and how shared access is controlled. SQLite suits a single operator working on one machine, while a shared team store usually points to Azure SQL, which moves access control and backup into your Azure environment. Before you choose, test that a labeled run can be queried back from the backend you plan to use in production. Confirm the exact behavior for your release in the PyRIT documentation.
How do labels on PyRIT runs affect later reporting?
Labels decide which runs belong together when you calculate results, so they shape every later report. If engagement, operator and target version are consistent, you can filter attack success rates, scenario results and run history to one engagement or compare two target versions. If labels are inconsistent, one engagement can split into several groups, and totals become wrong without anyone noticing. The build label matters for regression claims, because a finding that a fix worked needs to show which build was tested. Decide the reporting questions first, then design the labels to answer them. Before accepting a scheme, ask for a sample report filtered by each label.
Can our own team tag PyRIT runs without outside help?
Yes, many teams can do this themselves if one engineer owns the PyRIT configuration and the team agrees on a short naming guide. The work is mostly disciplined naming and checking records after runs. Teams that struggle usually lack a single owner, run PyRIT from several laptops with different settings, or need labels that will satisfy a formal review. Decisions about where memory is hosted also add effort. Before deciding, count the people who run PyRIT, the target versions in use and whether any runs start automatically. If you hand the work to a partner, the written scope should name deliverables and the acceptance checks.
What should a written scope for PyRIT label tracking include?
A written scope should list the label scheme, the systems it covers and the tests that show it works. Ask for the naming guide with allowed values for each label, including how engagement codes and build identifiers are formatted. Name the PyRIT version and the memory backend, SQLite or Azure SQL, that the scope targets. List every configuration file that will change, such as the settings file at ~/.pyrit/.pyrit_conf, and state how credentials in ~/.pyrit/.env stay out of shared material. Require a labeled test run for each operator, a sample filtered report and written handover steps. DeployOpen engagements are normally fixed-scope, so request timelines and fees in writing as well.
How DeployOpen scopes and supports PyRIT engagement tracking
DeployOpen is a Chainscore Labs company that plans, implements, hardens and supports self-hosted open-source platforms inside the client's own infrastructure. For PyRIT, we set up the labeling conventions for engagement, operator, target version and build so that results from many runs and people stay separable and reviewable.
How we scope
- We agree the label schema in writing: engagement, operator, target version and build, with the allowed values for each.
- We confirm which PyRIT memory backend, SQLite or Azure SQL, will hold the labeled records in your environment.
- Engagements are fixed-scope, so deliverables and the list of saved operations to be produced are agreed before work starts.
How we build
- We configure run scripts so every PyRIT execution carries the required labels, with no unlabeled runs left in shared memory.
- We define named operations for recurring test sets so operators select saved configurations instead of retyping settings.
- We test label filtering and operation selection against sample runs to confirm results from separate engagements do not mix.
How we hand over
- You receive the label schema, naming rules and operation definitions as documentation your operators can follow.
- You receive run scripts, configuration files and a short walkthrough for querying results by label in your environment.
- You receive a written record of the test cases used to verify label separation, so reviewers can check the setup.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, including updates when PyRIT releases change memory behavior.
- We can review new engagements against the existing label schema before a run starts, to catch missing or inconsistent labels.
- Before any change to PyRIT configuration or versions, we confirm the release notes and test the labeling setup again.

