Running CoPyRIT locally for a single red teamer

Local CoPyRIT gives one red teamer a web GUI on their own workstation, with a backend bound to localhost. This page covers the startup path, what local mode disables, when to enable admin operations, and why the server must not be exposed to the network.

On this page

When running CoPyRIT locally for one red teamer is the right choice

A single red teamer who wants the CoPyRIT web GUI without standing up shared infrastructure should run it locally on their own workstation. Local mode suits one operator working alone, a workshop run from a single machine, or an evaluation of CoPyRIT before committing to a team instance. Nothing in this mode needs a cloud account, a shared database or a Microsoft Entra ID group, so the setup cost stays with the person doing the testing.

CoPyRIT is the web GUI built on PyRIT, the open source Python Risk Identification Tool from Microsoft released under the MIT license. PyRIT itself can be used in three other ways: as a scanner through the pyrit_scan command, as a Python framework for custom attacks, or through the CoPyRIT interface for human-led red teaming. Choose local CoPyRIT when you want to drive attacks by hand, review conversations as they happen and keep the work inside your own machine. Choose pyrit_scan when the job is a repeatable, scripted run, and choose the Python framework when you need logic that the GUI does not expose.

Before you start, confirm that your workstation meets the Python version PyRIT supports. The PyPI package supports Python 3.10 up to but not including 3.15, and the PyRIT documentation recommends Python 3.13. Also confirm which PyRIT release you are installing against the PyRIT documentation, since the setup steps and the local defaults can change between releases.

Local mode is also a poor fit once other people need the same results. If a second tester, a reviewer or an auditor must see the same conversations, move to a shared instance before the work grows, because memory and configuration on one laptop are hard to hand over cleanly. Treat the local run as a stepping stone: confirm the workflow, the targets and the scoring you need, then decide whether a team deployment is worth planning.

How local mode compares with shared deployments

In local mode, CoPyRIT runs on one machine and serves the red teamer who started it. The people who can reach it are the people who can connect to that machine and its bound port, so the workstation login is the main control. PyRIT reads credentials from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf, so the secrets live in the profile of the account that runs the server.

  • Who can reach it: the signed-in user, plus anyone who can connect to the port on that machine. Confirm the default bind address and whether the server listens on all interfaces.
  • Where data lives: conversations and results go to PyRIT memory, which the PyRIT documentation describes as SQLite or Azure SQL. Confirm which store local mode uses and where its files are written.
  • Who manages authentication: no shared sign-in layer is assumed. Confirm which Entra ID and admin features local mode disables.
  • Secrets handling: API keys in ~/.pyrit/.env are readable by the account that owns them, so disk encryption and account hygiene carry the weight.
  • Upkeep: the individual red teamer updates, backs up and removes the data.

Before relying on local mode for a shared test, check which admin operations are available and who would be exposed if the machine were shared.

How to start pyrit_backend on a workstation

This sequence takes a single red teamer from a clean workstation to a running local CoPyRIT GUI backed by a SQLite memory file. Each step ends with a check so you know the local setup is working before any target is connected.

  1. Confirm a supported Python version

    Check the Python version on the workstation 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 install 3.13 if your system offers it. Run the interpreter's version command in a fresh terminal and confirm it reports a version inside the supported range. If your default interpreter is outside that range, use a version manager or a separate virtual environment built from a supported interpreter.

  2. Create an isolated environment and install PyRIT

    Create a Python virtual environment in a project folder you control, activate it, and install the PyRIT package with pip. Keeping PyRIT in its own environment avoids version clashes with other red team tooling. The install is done when pip reports the package installed without errors and the PyRIT command-line entry points resolve from inside the activated environment. Confirm the installed version against the release notes before you rely on any feature described in the documentation.

  3. Prepare the credentials file

    Create the file ~/.pyrit/.env and add only the credentials for the targets and scorers you plan to use in this session. PyRIT reads credentials from this file, so keep its permissions restricted to your user account and never place it in a repository. Verify the file exists and is readable only by you. Leave out secrets for systems you do not yet need, because every key stored locally is one more item to protect on a shared or managed workstation.

  4. Set the configuration file

    Create ~/.pyrit/.pyrit_conf to hold non-secret settings such as default memory and runtime options. Keep secrets in .env and settings in this file so each can be reviewed separately. Confirm the file parses as expected by running a PyRIT command that reads it, and check that the memory setting points to a local SQLite database rather than a shared server. Note any value you change so you can reproduce the setup later.

  5. Start pyrit_backend

    From the activated environment, start the backend with the pyrit_backend command and keep the terminal open while you work. Read the startup output for the bind address and the port the server reports. The backend is ready when the log shows the server running and no errors about the configuration or memory database. If the command fails, fix the reported error before continuing rather than editing the bind address to work around it.

  6. Confirm the bind address and memory file

    Verify that the server listens on localhost only, which means the address reported at startup is a loopback address such as 127.0.0.1 and not 0.0.0.0 or a LAN IP. Then check that the SQLite memory file exists in the location your configuration names. Its presence confirms that conversations and results will be stored locally. If the server reports a non-loopback address, stop it and correct the configuration before any target is connected.

  7. Open the local GUI in a browser

    Open a browser on the same workstation and go to the localhost address and port that the startup output reported. The CoPyRIT interface should load and show an empty workspace with no stored runs. Create a test entry or open the memory view to confirm the backend reads and writes to the SQLite file. The sequence is complete when the GUI loads locally and the test entry appears in the memory file, which means the single-user setup is ready for red teaming.

Which local settings fit which workflow

This table compares the main local settings for a single red teamer running CoPyRIT on a workstation: memory backend, credential source, settings file, target types and admin operations. Read each row for the workflow it fits and the change that follows if the setting is wrong for that workflow. Confirm exact option names against the 1.1.0 documentation before you change anything.

SettingFits whenIf it is wrong
Memory backend: SQLiteOne red teamer runs tests on a single workstation and results stay on that machineResults stay local and are hard to share with a team, and a lost workstation loses the record
Memory backend: Azure SQLResults must persist in a shared or managed database that others or auditors can queryAdds Azure dependencies and access setup to a workflow that did not need them, and credentials must be protected
Credentials in ~/.pyrit/.envKeys for the targets you test are needed only on your own account and the file is restricted to youKeys in a file shared or synced to other places can leak, so confirm file permissions and exclude it from backups and repositories
Settings in ~/.pyrit/.pyrit_confMemory, initializers and defaults should be stable across your local runsA misconfigured default can send attacks to the wrong target or store results in an unexpected place
Target types: hosted model APIsYou test a model endpoint you are authorized to use and the traffic goes to that providerTest traffic and prompts leave your environment, so confirm the provider terms and your authorization first
Target types: local or self-hosted modelsTesting must keep prompts and outputs inside your network or workstationPointing at a remote endpoint by mistake sends test content outside the intended boundary
Admin operations: disabledYou only run attacks and review your own resultsConfiguration routes stay closed, which is the safer default for most single-user work
Admin operations: enabledYou are maintaining the local instance and need configuration changes, confirmed in the 1.1.0 documentationAnyone who reaches the local server can change configuration, so enable only when no one else can reach it

What local mode turns off and why it matters

Local mode runs CoPyRIT without the Entra ID sign-in and group gating that shared deployments use, so identity, access groups and audit attribution are not in force. Anyone who can reach the process is effectively the operator, and nothing in the run records which person on a team made a given request. The admin group that governs configuration routes in a shared deployment has no meaning on a single workstation, so the separation between people who run tests and people who change settings is a convention you must keep yourself. Before you start, confirm in the PyRIT release you run which routes, settings and features local mode restricts, and which it leaves open. Those details change between releases, so check the release notes and the PyRIT documentation rather than relying on memory or on this page.

The evidence consequence follows directly. Results in local mode tie to one local operator and one database file, typically the SQLite memory store that PyRIT uses by default. That is useful for a single red teamer working alone, but a reviewer cannot confirm from the record alone who ran a given attack, under which settings, or whether the database was altered afterward. If the results will support a finding, a retest or a compliance question, decide that before the first run. Record the PyRIT version, the configuration files used, the target and the operator name in your own run log, and keep the database file under version control or write-once storage so its history can be explained to a third party.

Treat admin operations as a deliberate exception, not a default. Enable them only when you need to change configuration for a run you are doing alone, and switch them off again afterward. Do not use local admin access to change targets, credentials or memory handling for work that other people will rely on. If the work needs more than one operator, several people reviewing results, or a record that must show who did what, move to a shared deployment with group-based access rather than adding users to a local instance. Ask whoever owns your red teaming program to confirm where that boundary sits for your organization.

How the workstation, backend and targets connect

The flow starts in the red teamer's browser on the workstation, which talks only to the pyrit_backend process bound to localhost. The backend reads settings and credentials from the ~/.pyrit files, records conversations and results in the SQLite memory file, and makes outbound calls to the model targets under test. The boundary marked in the diagram is the workstation itself: anything that reaches the backend from another machine crosses it, so check the bind address before you rely on local mode.

Local CoPyRIT data flow, with the workstation as the trust boundary.

Why a local server must not be exposed to the network

Local mode is designed for one person on one workstation. The cards below cover what that assumption removes, from identity and credentials to stored red team data, and the checks to run before you start the server.

No team identity boundary

Local mode does not run the Entra ID group gate that a shared CoPyRIT uses, so anyone who can open a session to the backend is treated as the operator. Nothing in the local setup separates one caller from another. Before you start the server, confirm that you are the only intended user of the workstation and that no one else holds a session on it. If several people need access, move to a shared deployment instead of widening this one.

Listening address and firewall

A server bound to 0.0.0.0 or to a LAN or public interface accepts connections from other hosts, even when you only meant to use it yourself. Check the address the process is listening on with your OS network tools, and make sure it is bound to 127.0.0.1 or localhost. Then confirm that host firewall rules block inbound traffic on the port from other machines, including on VPN and Wi-Fi profiles.

Readable credentials in .env

PyRIT reads model and service credentials from ~/.pyrit/.env. Anyone who can reach the running process, or who can read files in your home directory, can use the same keys to call the target models at your cost. Restrict file permissions on the .env file, keep it out of synced folders and repositories, and rotate any key that was ever stored in a shared location.

Stored conversations and results

The local memory holds prompts, model responses, scores and labels from every run. An exposed port turns that store into a readable record of your red team work, including harmful test content and unfixed weaknesses in the target systems. Decide what should be kept, where the SQLite file sits, and who may open it, and remove test data when the engagement closes.

Leaking red team prompts

Red team objectives and attack prompts describe exactly how a target can be made to fail. If another host can reach the GUI, it can observe in-progress attacks, reuse your objectives against other systems, or read findings before they are reviewed. Treat the prompt set as confidential engagement material and keep the workstation's network exposure to what you have verified.

Reporting a suspected PyRIT flaw

If you believe PyRIT itself has a vulnerability, such as an exposure path in the backend, do not describe it in a public issue. The project asks for private reports through the Microsoft Security Response Center under its security policy. Collect the version, the listening configuration and the steps to reproduce first, so the report can be triaged without further exchanges.

PyRIT on GitHub

Questions teams ask before running CoPyRIT locally

How much effort does a local CoPyRIT setup take, and what drives it?

Effort depends mostly on three things: the Python environment, the target credentials and the model access your tests need. PyRIT installs with pip on Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13, so the first task is building a clean environment on a supported version. Target credentials are usually the longer task. Each target needs its own key or endpoint, stored in ~/.pyrit/.env, and settings such as memory and defaults go in ~/.pyrit/.pyrit_conf. Model access adds delay when approvals, quotas or regional availability must be arranged first. Ask your team to list every target before starting, because each one adds configuration and testing time.

Can one operator set up and run CoPyRIT locally without outside help?

Yes, in most cases a single engineer comfortable with Python, environment variables and command-line tools can run CoPyRIT locally using the project documentation. The harder parts are usually not the install itself but deciding which targets, attack strategies and scorers are in scope, and keeping results organized enough to report. Outside help is most useful when you need a defined scope, a repeatable configuration, or review of the attack plan before it touches a production system. DeployOpen can plan and run that work as a fixed-scope engagement, with scope and deliverables agreed in writing before work starts.

What does the work need from us before we start?

You need a workstation that meets the Python requirement and has enough disk space for the PyRIT install and its SQLite memory file. You also need credentials for each target, approved for testing by the system owner, and a written list of those targets with the endpoints, owners and permitted test windows. Confirm with each owner whether testing is allowed against production or only against a staging copy. Agree on who receives the results and where they will be stored. Missing target lists are the most common cause of rework, because operators end up testing systems nobody formally approved.

When should we move from a local CoPyRIT to a shared instance?

Move to a shared instance when more than one person needs the same results, when results must be reviewed by people who do not run tests, or when access must be controlled by group membership. A local server is designed for one operator, and the local mode turns off some features, so collaboration quickly becomes awkward. A shared deployment also needs identity, secrets handling and network controls that a workstation does not provide. Plan the move before evidence accumulates locally, so records can be exported and the memory data kept under a clear owner.

Can results from a local CoPyRIT run count as compliance evidence?

Local results can support compliance work, but they only count when the process around them is documented and repeatable. An assessor will ask who ran the tests, against which system version, with which configuration, what was scored and how findings were tracked to closure. A single workstation with an undocumented database is weak evidence on those points. Keep the configuration files, target list, test dates and exported conversations under change control. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports or certifications. Independent auditors and certification bodies make those determinations.

Why must a local CoPyRIT server never be exposed to the network?

Local mode is designed for one operator on one machine, so a server bound to a network interface can be reached by anyone who can connect to that address. Keep the server bound to the loopback address, confirm with your firewall that the port is not reachable from other hosts, and do not forward it through a router or tunnel. Exposed instances can leak target credentials, conversation history and test results, and can be used to send attack traffic through your organization's approved model accounts. If others need access, move to a shared deployment with identity controls instead of opening the local port.

What does DeployOpen provide beyond the CoPyRIT documentation?

DeployOpen plans, implements, hardens and documents self-hosted platforms in infrastructure you control, and runs security testing, including AI and agent security review. For a local CoPyRIT setup, that can mean defining the target list, configuring the environment and attack scope, writing a repeatable runbook, and testing the setup itself before you rely on it. It can also cover the step to a shared instance, with identity, access control and audit logging planned together. Engagements are fixed-scope, and a quote follows from the written scope. The documentation remains the primary reference for PyRIT behavior, and you should confirm version-specific details against the release you install.

How DeployOpen scopes local and team CoPyRIT deployments

DeployOpen plans and implements open-source platforms, including PyRIT and CoPyRIT, inside infrastructure the client controls: their own cloud accounts, data centers or air-gapped networks. For a single red teamer running pyrit_backend on a workstation, that usually means the scope is small, but it still needs written decisions about where the server listens, which settings local mode turns off, who may use admin operations and where the .pyrit/ configuration and memory database live. Those decisions are recorded in the scope document before any work starts, so the same questions are answered whether the deployment ends up local, containerized or shared across a team.

Most DeployOpen engagements are fixed-scope. The written scope names the components in play (the workstation or server, the PyRIT version, the memory backend, the targets to be tested, the identity model if a team instance is needed) and lists the deliverables and timelines the client accepts. A quote follows from that scope, so the buyer can compare a single-user setup with a team deployment on the same basis. Ask for the scope to state which items are one-time (installation, configuration, hardening, documentation) and which recur (upgrades, dependency updates, retesting after a PyRIT release such as PyRIT v1.1.0). Confirm current supported Python versions against the PyPI package page before the scope is signed.

Security testing and red teaming are part of the same offering. DeployOpen can test the deployed CoPyRIT or PyRIT setup itself, including whether a locally started server is reachable from the network, and can deliver a findings report with fixes and a retest. Ongoing support, upgrades and continuous testing are available as retainers, which suits teams that will keep red teaming through PyRIT upgrades. DeployOpen does not publish a price list, and it does not issue audit reports or certifications for the systems it helps prepare. Any evidence needed for a compliance assessment comes from the independent auditor that performs it.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.