Setting up PyRIT memory and CoPyRIT for a red team
A team running PyRIT beyond one laptop needs two things a single install does not give it: a memory store that keeps conversations and results in one place, and a shared way for testers to work the same attacks. PyRIT memory stores conversations and results in SQLite or Azure SQL, and CoPyRIT is the web GUI for human-led red teaming and team collaboration. The setup is therefore a decision about where results live, who can reach them, and how testers connect to them, rather than a matter of installing a package. Installation itself is the easy part. The PyPI package supports Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13, so the team should standardize one interpreter version on every tester's machine and on any shared host before anyone runs an attack.
The memory choice is harder to reverse than it looks. SQLite suits a single operator or a small, trusted group working from one host with a file they can back up. Azure SQL suits shared results that several testers and reviewers must query from different places. Confirm with your platform team how each option handles access control, backup, retention and the separation between test runs of different systems, because stored prompts and harmful outputs become sensitive records once a team shares them. Ask the question before the first campaign, since moving history between stores later is extra work you will need to scope.
Credentials are the second hard part. PyRIT reads credentials from ~/.pyrit/.env and settings from ~/.pyrit_conf-style configuration in the same folder, so every tester's machine holds keys to the model endpoints under test. Decide which accounts testers use, who rotates keys, and whether a shared CoPyRIT instance holds any keys at all. Check the current configuration file name and layout in the PyRIT documentation 1.1.0 before writing your team standard, and record the decisions in the same runbook as your memory choice.
Which PyRIT parts carry memory, sharing and the GUI
PyRIT splits red teaming work across a few components, and each one touches memory, sharing or the GUI differently. Knowing which part stores what, and which part reads its settings from disk, tells you where to put shared storage and where to look when a team's results do not match.
Memory holds conversations and results
Memory is the store for every conversation, prompt and scored result that a run produces. PyRIT supports SQLite or Azure SQL as the backend, so the choice decides whether results live on one analyst's machine or in a database the whole team can query. Before you start, confirm which backend your team will use, where it lives, and who can read the stored prompts and outputs.
PyRIT docsTargets define what gets tested
A target is the system under test: a hosted model from OpenAI, Azure, Anthropic, Google or Hugging Face, a custom HTTP or WebSocket endpoint, or a web app driven through Playwright. Targets sit at the start of the workflow and determine which credentials, endpoints and network paths the rest of the setup depends on. Each target configuration should be recorded so that a later run can be reproduced against the same system.
Attacks and converters shape the prompts
Attacks run the multi-turn strategies, such as Crescendo, TAP and Skeleton Key, and converters transform prompts before they reach the target. Together they decide what the target sees and how many turns a conversation takes. Check that each attack and converter writes its turns to memory, because a conversation that is not stored cannot be reviewed or shared later.
Scorers decide what counts as a finding
Scorers evaluate each response using an LLM, Azure AI Content Safety or custom logic. Their output is what turns raw transcripts into a list of candidate findings, so a scorer that is misconfigured can hide real failures or flag harmless output. Keep scorer settings with the run record and confirm them before you compare results between team members.
pyrit_scan runs repeatable scans
The pyrit_scan command runs PyRIT as a scanner, which suits repeated runs against the same targets and datasets. Scripted scans are easier to schedule and compare over time than interactive sessions. Confirm which configuration file the command reads and which memory backend it writes to, so that scheduled runs and manual runs do not split results across two stores.
CoPyRIT supports human-led sessions
CoPyRIT is the web GUI for human-led red teaming and team collaboration. It gives testers a shared view of sessions and results, which makes it the component most likely to expose stored prompts and harmful outputs to more people. Decide who gets access before the first session and confirm how the GUI authenticates users in your deployment.
PyRIT docsConfig files hold credentials and settings
PyRIT reads credentials from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf. Because these files sit in the home directory of whichever account runs PyRIT, every analyst who runs it locally has their own copy. Keep secrets only in the .env file, restrict its file permissions, and confirm that shared settings in the .pyrit_conf file match across the team.
SQLite or Azure SQL for PyRIT memory
This table compares SQLite and Azure SQL as PyRIT memory backends by fit, operating cost and what changes when several testers write results. Read it top to bottom to decide whether results should be shared at all, then choose the backend that matches your access model. The main takeaway is that the database choice matters less than who runs it, where it lives and who can read harmful outputs stored in it.
| Decision point | SQLite | Azure SQL |
|---|---|---|
| Best fit | One tester or a small group working from one host with local results | A shared team store, or an existing Azure estate with database administration in place |
| Where data lives | A local file on the tester's machine or test host, so location and backup depend on that host | A managed database in your Azure subscription, so location, backup and network path follow your Azure configuration |
| Backup and recovery | Copying the file is the backup, and nothing is backed up unless someone schedules it | Backup and point-in-time recovery follow the service configuration in your tenant, which you should confirm |
| Access control | Controlled by file permissions on the host, which weakens when the file is copied or shared | Controlled by Azure identity and database roles, with access logging available through Azure settings to confirm |
| Who runs the database | The tester, with no separate administrator | A platform or data team that owns provisioning, patching, firewall rules and access reviews |
| Concurrent writers | Multiple testers writing to one file over a network share is fragile and should be avoided | Designed for several clients writing at once, so each tester connects with its own identity |
| Harmful output handling | Stored outputs sit on whichever disk holds the file, so disk encryption and deletion routines matter | Stored outputs sit in a managed service, so retention, encryption and access reviews must be set deliberately |
| Share memory or keep per-tester stores | Per-tester files are simpler, but results must be merged by hand before team review | Shared memory gives one record of findings, but requires agreed naming, access groups and retention rules first |
How to build a shared PyRIT memory and CoPyRIT environment
This sequence takes a red team from an unconfigured host to a PyRIT installation with a chosen memory backend, a verified stored conversation, and a CoPyRIT session where testers can see the same results.
Choose a supported Python version
The platform engineer or lead red teamer picks a Python interpreter that the PyPI package supports, which is Python 3.10 up to but not including 3.15. The PyRIT documentation recommends Python 3.13, so start there unless your standard build image pins another supported version. Create a dedicated virtual environment on the shared host so that PyRIT and its dependencies stay separate from system packages. Check the result by running the interpreter's version command inside the new environment and confirming it reports a version within the supported range.
Install PyRIT from PyPI
Install the
pyritpackage from PyPI into the virtual environment with pip, and pin the version your team has agreed to test against rather than floating to the latest release. Use the microsoft/PyRIT releases page as the reference for version history, and confirm that you are installing from the maintained repository, not the archived Azure/PyRIT source. Confirm the install by importing the package in a Python session and printing its version. The step is done when the import succeeds and the printed version matches the pin in your team's requirements file.Create the shared configuration files
Create the
~/.pyrit/.envfile for model endpoint credentials and the~/.pyrit/.pyrit_conffile for PyRIT settings, including the memory backend selection. Keep the credentials file limited to the service account that runs the tests, and store secrets in your organization's approved secret mechanism where possible. Avoid placing real keys in shared configuration templates that get committed to version control. The step is done when PyRIT starts without reporting missing credentials for the targets you plan to use, and the settings file loads without parse errors.Configure the memory backend
Choose SQLite for a single host or a small team working from one machine, or Azure SQL when several testers need to read and write results from different locations. SQLite keeps everything in a local file that is simple to back up but must sit on storage the whole team can reach if it is shared. Azure SQL requires a provisioned database, network access from every tester host, and an identity with the right permissions, so confirm those with your cloud team before you start. Document the choice and the connection settings in the configuration file. The step is done when PyRIT reports a successful connection to the selected backend at startup.
Store and verify a test conversation
Run a harmless test prompt against an approved target, such as a model endpoint your team owns, using a basic script or the pyrit_scan command. Use a benign prompt that will not produce harmful output, so the test confirms storage without creating sensitive records. Then query the memory backend directly or through PyRIT's memory interface and confirm the conversation, its prompt, its response and its metadata are present. The step is done when the test conversation can be retrieved from the backend by its identifier, and the record matches what was sent and received.
Launch CoPyRIT on the shared host
Start CoPyRIT, the web GUI for human-led red teaming and team collaboration, on the host that uses the shared memory backend. Restrict the listening address and place access behind your identity or network controls, because the GUI exposes stored prompts and outputs. Confirm the tool starts and that the test conversation from the previous step appears in its interface. Ask your security team to confirm the access path against your internal hosting rules before any tester uses it. The step is done when the GUI loads and shows the existing record.
Confirm testers see shared results
Have two or more testers sign in from their own machines, each running CoPyRIT against the same memory backend. One tester creates a new benign conversation, and the other confirms it appears in their session without a manual export. Check that each tester's changes are visible to the others and that access controls work as expected for users who should not see results. Record the outcome and the access list in your team runbook. The step is done when both testers confirm they see the same conversation and the access test behaves as your security team specified.
How testers, CoPyRIT and memory connect
The diagram starts with testers working in CoPyRIT, the web GUI for human-led red teaming. CoPyRIT calls the PyRIT engine, which sends attack prompts through targets and sends responses to scorers. Every conversation and result is written to the memory backend, either SQLite or Azure SQL, which sits inside a separate trust boundary. Check that the tested system is reached only from the test host, and that the memory store is reachable only by the people and services that should read stored prompts and outputs.
Testers, CoPyRIT, the PyRIT engine, memory and the tested system, with trust boundaries marked.
Scanner, CoPyRIT or Python framework: which to use
The pyrit_scan command suits teams that want to run a repeatable set of checks against a target without writing attack code for each run. It is the most direct route when the goal is coverage across known harm categories rather than investigating one system in depth. Results from each run are written to PyRIT memory, so the output can be reviewed later with the rest of the team's work.
- Who uses it: security or platform engineers who run recurring checks and hand the findings to application owners.
- How results reach memory: each scan stores its conversations and scores in the configured memory backend, SQLite or Azure SQL.
- What it needs: a configured target, credentials in
~/.pyrit/.env, and settings in~/.pyrit/.pyrit_conf. - Who reviews output: someone must triage scored results, since automated scoring can flag responses that need a human decision.
- Limit: scans follow predefined patterns, so unusual multi-turn behavior may need a manual or custom attack.
Confirm with your team which scan settings and datasets you will use before the first run, and record who owns each scheduled scan.
CoPyRIT is the web GUI for human-led red teaming and team collaboration. It suits testers who want to probe a system interactively, adjust prompts as they go, and share a session with colleagues. Because the people running the tests make the decisions, this mode depends more on tester skill and clear rules for handling harmful outputs than on scripting.
- Who uses it: red team members and reviewers who work through a target by hand and discuss findings together.
- How results reach memory: conversations run in CoPyRIT are stored in the same memory backend, so teammates can see what others tested.
- What it needs: a shared memory location that all testers can reach, a defined owner for the instance, and agreed access rules for stored prompts and outputs.
- Team practice: agree on naming, labeling and escalation before testing starts so that results stay comparable.
- Limit: output depends on each tester's method, so record the approach alongside the findings.
Check which memory backend your CoPyRIT instance uses and who can read it before inviting the full team.
Using PyRIT as a Python framework suits teams that need attacks the built-in modes do not cover. You build the attack from targets, converters, scorers and memory, and you control the logic of each run. This gives the most flexibility, and it also places the most responsibility on the engineers who write and maintain the code.
- Who uses it: engineers with Python skills who build attacks for custom HTTP or WebSocket endpoints, or for web apps driven through Playwright.
- How results reach memory: attack code writes conversations and scores to memory through the framework, so results match those from scans and CoPyRIT.
- What it needs: a supported Python version (the documentation recommends 3.13), the PyPI package installed, and tests for each custom target, converter and scorer.
- Multi-turn strategies: Crescendo, TAP and Skeleton Key are available as building blocks, and each needs validation against your own target.
- Limit: custom code needs review after each PyRIT release, so budget engineering time for maintenance.
Before relying on a custom attack, confirm that its results are stored in memory in the same form your reviewers expect.
What drives setup effort for PyRIT memory and CoPyRIT
This table lists the factors that change how much work a PyRIT memory and CoPyRIT setup takes, and how to keep each one manageable. Read each row as a question to answer before choosing between SQLite and Azure SQL and before opening CoPyRIT to more than one tester. The main takeaway is that shared storage, identity and stored-output handling usually matter more than the first install.
| Driver | Why it changes effort | How to keep it down |
|---|---|---|
| Number of testers | More people sharing one memory store means more access rules, more shared sessions and more time spent agreeing on naming and tagging of results. | Start with a small named group in CoPyRIT, agree on a labeling convention for attacks and operators, and add testers in stages after the first review cycle. |
| Result volume | Multi-turn strategies such as Crescendo, TAP and Skeleton Key produce long conversations, and every scorer run adds records. Large stores slow review and raise storage and backup questions. | Limit each campaign to the targets and strategies it needs, set a retention plan for old runs, and confirm with your own environment how large the memory store can grow before review slows. |
| Existing Azure SQL or identity setup | If your organization already runs Azure SQL and a single sign-on standard, reuse is faster, but connection, firewall and role configuration still need review. Without it, SQLite is simpler but gives no central store. | Decide early whether results must be shared. Reuse an approved Azure SQL database and existing identity groups where possible, and confirm with your platform team who owns database access and backups. |
| Number of target environments | Each target (model endpoint, custom HTTP or WebSocket service, or a web app driven through Playwright) needs its own settings, credentials and test data, and results must stay traceable to the environment tested. | Keep one settings profile per environment, tag every run with its environment, and add new targets only after the existing ones are documented and repeatable. |
| Custom targets | Custom HTTP, WebSocket or Playwright targets need code or configuration that the team must write, test and maintain, and they often expose authentication and session handling that memory must record correctly. | Reuse the supported target types where they fit, keep custom target code small and reviewed, and test one full conversation end to end before using it for a campaign. |
| Compliance review of stored prompts and outputs | Memory holds harmful prompts and model outputs. Reviewers, data protection staff and auditors may ask who can read them, where they are kept and how long they remain, which adds access controls and documentation work. | Ask the compliance lead to define access groups, retention and deletion rules before the first campaign. Confirm with your assessor which evidence they expect, and keep the store in a location already covered by your controls. |
Protecting shared red team data and credentials
A shared PyRIT setup holds model API keys, full attack transcripts and harmful outputs in one place. The cards below cover the four places that need controls: the credential file, the memory store, the stored outputs and the host running CoPyRIT. Depth on each is in the separate PyRIT security hardening topic.
Keep credentials out of shared files
PyRIT reads model and endpoint credentials from ~/.pyrit/.env, so every team member who runs an attack loads those keys from their own profile. Check who can read that file on each workstation and on any shared host, and confirm that keys are not copied into notebooks, screenshots or ticket attachments. Use separate keys per operator where the provider allows it, so revoking one person's access does not stop the whole team.
Choose who can reach the memory store
PyRIT memory stores conversations and results in SQLite or Azure SQL. A SQLite file is readable by anyone with file access to the host, while Azure SQL access is controlled through database and network permissions in your Azure tenant. Decide which option fits your team before results accumulate, and document who holds read, write and admin rights to the store.
Protect stored harmful outputs
Memory holds the prompts that produced harmful content and the responses that scored as failures, including psychosocial and data leakage examples. Treat the store as sensitive data with a defined retention period, encryption at rest where your platform supports it, and a rule for who may export transcripts. Ask your security and legal teams to confirm the handling requirements before the first red team run.
Isolate the CoPyRIT host
CoPyRIT serves a web interface that several testers may use at once, so the host becomes a shared attack launcher. Run it on a dedicated machine or container, restrict inbound access to named users through your network controls, and keep outbound access limited to the model endpoints and target systems under test. Confirm that the host cannot reach production data it does not need.
Limit access to CoPyRIT sessions
Shared sessions let one tester view another tester's conversations, so access rules should match your team structure. Decide whether reviewers see all results or only their assigned targets, and record who approved each test scope. Confirm with your deployment team how user accounts and sessions are authenticated before you open the interface to more than one group.
How to confirm shared memory and CoPyRIT work
Before any red team relies on shared results, run four checks against the memory backend you chose, whether SQLite or Azure SQL. First, have one tester start an attack against a non-production target and save the conversation, then confirm a second tester sees that same conversation and its scores from their own CoPyRIT session. If the second tester cannot see it, the problem is usually that the two sessions point at different database files or connection strings, not a PyRIT fault. Second, stop the CoPyRIT service and the PyRIT process completely, start them again, and confirm the earlier conversation and results are still listed. Third, check that the credentials in ~/.pyrit/.env never appear in the CoPyRIT interface, in exported results or in application logs. Search the log directory and any captured console output for the key names and values, and confirm that settings in ~/.pyrit/.pyrit_conf are not echoed to the browser. Record each check in your test plan so the outcome is reproducible after upgrades.
Next, test failure behavior on purpose. Point a run at a target that returns errors or times out, then confirm the failed attempt is recorded as a failure and does not leave a half-written conversation that a later run appends to or scores as if it succeeded. Then make the memory backend unreachable, for example by pointing a test session at a database path that does not exist or by blocking the Azure SQL network path in a sandbox. The safe behavior is to stop the run with a visible error and start no new attacks, rather than continuing and losing results. Confirm the operator sees that error in CoPyRIT or the console. Ask your PyRIT maintainers or the vendor documentation to confirm how the version you deploy handles interrupted writes, since behavior on partial writes is the detail teams most often assume without checking.
What to back up, monitor and document after handover
This table compares the four areas a team must own once PyRIT memory and CoPyRIT are live: the memory store, database access and disk use, version pinning, and configuration and tester records. Read each row as a question to answer before handover, with the owner and the evidence to keep. Upgrade validation is covered in the upgrades topic, so it is not repeated here.
| Area | What to keep or watch | Evidence to keep | Where handovers usually fail |
|---|---|---|---|
| Memory store backup | Copy the SQLite file or Azure SQL database that holds PyRIT conversations and results, on a schedule the team sets and tests by restoring it | Backup schedule, last successful restore test, and retention period agreed with the owner | Backups exist but no one has restored one, or the SQLite file sits on the same disk as the test host |
| Database access monitoring | Review who connects to the memory store, from which host, and with which identity, especially for Azure SQL | Access list, authentication method, and periodic review records | Shared database logins persist after testers leave the project |
| Disk use | Track growth of the SQLite file or database size, since stored prompts and model outputs accumulate across campaigns | Disk usage thresholds, alert recipients, and cleanup or archive procedure | The test host fills up mid-campaign and interrupts a run without warning |
| Version pinning | Pin the PyRIT version in the team environment, starting from the 1.1.0 release, and record any later release the team adopts | Lock file or requirements pin, release tag, and Python version (documentation recommends 3.13) | Environments drift because each tester installs the latest package from PyPI |
| Configuration record | Document the contents of ~/.pyrit/.pyrit_conf and which targets, scorers and converters each campaign uses, without copying secrets | Configuration template in version control, list of target endpoints, and scorer settings | Settings live only on one engineer's laptop and cannot be rebuilt |
| Credential handling | Confirm that ~/.pyrit/.env holds keys only on approved hosts and that rotation is recorded | Secret store location, rotation log, and owner for each model API key | Keys copied into shared notes or chat during setup |
| Tester access to CoPyRIT | Maintain a current roster of people who can open the CoPyRIT GUI and the results they can see | Access roster, review date, and removal record for leavers | Former contractors retain access to stored harmful outputs |
| Operating runbook | Write down how to start CoPyRIT, back up memory, rotate keys and report a PyRIT vulnerability through the Microsoft Security Response Center policy | Runbook location, named owner, and last review date | The runbook describes the setup as it was built, not as it runs today |
Questions teams ask before setting up PyRIT memory and CoPyRIT
Can we run PyRIT memory and CoPyRIT ourselves?
Yes, PyRIT is an MIT licensed open source framework from Microsoft, so your team can install and run it in its own environment without a license purchase. The work your team takes on is the environment setup, the choice of memory backend, access control for shared results, and the ongoing maintenance of targets and scorers. Whether to do this in-house or with a partner depends on how many people will use CoPyRIT, how often you retest, and whether you have engineers who can own the setup after handover. Confirm your team's Python and security tooling skills before you decide.
How much effort does PyRIT setup take, and what drives it?
The effort depends mostly on how many targets you test, how many people share results, and how strict your access and retention rules are. Installation is a pip install on a supported Python version, and the documentation recommends Python 3.13. The larger drivers are configuring credentials in ~/.pyrit/.env, setting shared options in ~/.pyrit/.pyrit_conf, and building custom HTTP, WebSocket or Playwright targets for your own systems. Ask any provider to break the estimate into environment setup, target integration, memory configuration and user onboarding, since each one scales differently.
Should we choose SQLite or Azure SQL for PyRIT memory?
PyRIT memory stores conversations and results in either SQLite or Azure SQL, so the choice comes down to who needs to read the results and where they live. SQLite is a file-based store that suits a single operator or a small test host, but a file is harder to share and control across a team. Azure SQL suits teams that already run Azure data services and need shared, centrally managed storage with their own access controls. Confirm with your security team where harmful prompts and outputs may be stored, how long they are kept, and who can query them before you pick a backend.
What does the setup need from our team?
Your team needs to supply access to the models and applications under test, API credentials, a host or environment to run PyRIT, and a named owner for the memory store. Red team leads should define which attack strategies and scorers are in scope, and the people who review findings need access to CoPyRIT. Security or compliance staff should approve where results are stored and who can view them. Ask your provider which of these items they expect you to provide, and which they will handle, so nothing blocks the first test run.
How long does setup take?
No duration is established for this work, so treat any timeline as something to confirm in writing. Setup time usually follows the number of targets, the memory backend you choose, how many users need CoPyRIT access, and how quickly your team can approve credentials and storage. A single-operator SQLite setup against one model endpoint is typically shorter than a shared Azure SQL deployment with several custom targets. Ask for the milestones, the assumptions behind each one, and what you must provide and by when.
Who can see the prompts and outputs stored in PyRIT memory?
Anyone with access to the memory store can read the conversations, scores and results it holds, so access must be set deliberately. Stored content can include harmful prompts and model outputs from content harms, psychosocial risk and data leakage tests. Limit read and write access to named red team members, keep credentials in ~/.pyrit/.env out of shared repositories, and decide retention before the first run. Confirm these controls with your security team and check the PyRIT documentation for the current configuration options.
Where should we check PyRIT setup details before we start?
Start with the PyRIT documentation for version 1.1.0, which covers memory, targets, scorers and the CoPyRIT, pyrit_scan and Python framework options. Check the PyPI package page for supported Python versions, and the GitHub releases page before you pin a version. Because the original Azure/PyRIT repository is archived and read-only, confirm you are using the microsoft/PyRIT repository. Use these sources to validate every configuration step against the release you plan to deploy.
How DeployOpen scopes, builds and hands over PyRIT memory and CoPyRIT
DeployOpen approaches PyRIT memory and CoPyRIT setup as a scoped build with written deliverables. We agree the storage choice, the sharing model and the access controls before installation, then hand over a configured environment that the red team can operate and review.
How we scope
- Confirm which team members will run attacks and who needs to read stored results
- Choose SQLite or Azure SQL for PyRIT memory based on where results must live
- Agree in writing which CoPyRIT workflows the human red team will use
- Record the targets, scorers and retention rules that the written scope covers
How we build
- Install PyRIT on the Python version the documentation recommends for the chosen release line
- Configure credentials in ~/.pyrit/.env and settings in ~/.pyrit/.pyrit_conf without storing secrets in shared files
- Set up the memory backend and test that conversations and scores persist and can be queried
- Deploy CoPyRIT for the team and test that multiple users see the agreed shared results
How we hand over
- Deliver runbooks covering memory backup, access roles, and how to start and stop CoPyRIT
- Document the configuration, versions pinned and the steps to reproduce the environment
- Walk the owning team through a test session so they can run and review attacks
- Record open items, including any settings the client must confirm with its own security team
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing
- Ongoing support, upgrades and continuous testing are available as a retainer
- Retainer work can cover checking memory and CoPyRIT after each PyRIT release
- Support requests follow the written scope, and changes are priced from an updated scope

