When a red team needs pyrit_shell instead of one-off scans
pyrit_shell is PyRIT's interactive command-line session for running red team scenarios against a registered target again and again without retyping the full command. A security or AI team iterating on a target, changing a converter, adding a technique or checking whether a fix held, spends most of its time on the same few steps. The shell keeps that loop short. Inside one session you list what is available with list-scenarios, list-targets and list-converters, start a scenario with run, and then review what happened with scenario-history and scenario-results. Each of these commands maps to a question a red team asks during an iteration: what can I run, against what, what did I run before, and what did it find.
The main difference from batch pyrit_scan runs is the unit of work. A pyrit_scan invocation is a complete, self-contained run that you start, wait for and read. pyrit_shell is for the stage before that, when the scope is still moving. Converters attach to a single technique with the technique:converter.name syntax, so you can test whether a base64 or other encoding step changes a result for one technique without rebuilding the whole scenario. Use batch scans once the configuration is settled and you need a repeatable record for a change review or pipeline. Use the shell while you are still deciding what the configuration should be.
Before a team relies on the shell for findings, confirm three things in your own environment: which scenarios and converters your installed PyRIT version lists, which targets are registered in the configuration you share with colleagues, and where the memory store records each run so that scenario-history returns the runs you expect. Keep notes on which converter and technique combination produced each result, because a session can accumulate many similar runs quickly. The PyRIT Shell documentation lists the exact command options for the version you install.
How pyrit_shell fits each red teaming workflow
When a team meets a target for the first time, the goal is to learn what the system does and where it is weak, not to produce a score. An operator opens pyrit_shell, runs list-targets to confirm the endpoint is registered, and runs list-converters and list-scenarios to see which techniques are available before choosing a starting point. The run command then executes a scenario, and scenario-results shows what came back. The output is a set of conversations to read, which feeds the team's understanding of the target's behavior.
- Confirm the target first:
list-targetsshows whether the registered endpoint is the one you meant to test before any prompts are sent. - Start with a narrow scenario: A single scenario with a small objective set gives readable output and keeps the first session short.
- Attach one converter at a time: Use the
technique:converter.namesyntax to see how a single transformation changes the target's response. - Read conversations, not only totals: Early findings usually come from odd refusals or partial compliance that a summary hides.
- Record what you changed: Note which techniques and converters you tried so the next session starts from a known point.
Before leaving an exploratory session, check that the target registration, the scenario names and the converter choices are written down so a colleague can reproduce the run.
After a model version, system prompt or safety setting changes, the same scenarios are run again to see whether behavior moved. Here the operator uses run against the same scenario and target, then compares scenario-history entries across sessions. The output that matters is the change between runs, so the scenario and its settings should stay fixed while the target changes. Without that discipline, differences reflect the test setup rather than the system.
- Hold the scenario constant: Rerun the same scenario name with the same dataset and techniques so differences trace back to the change.
- Use history to compare:
scenario-historylists prior runs, letting you pick the baseline and the new run side by side. - Pull results for each run:
scenario-resultson both runs shows which objectives changed outcome. - Track converter changes separately: Adding or removing a converter alters the test, so treat it as a new configuration rather than a regression check.
- Expect variation: LLM outputs and scorers are not fully deterministic, so confirm whether a change is larger than normal run-to-run noise before escalating.
Before comparing runs, confirm that the target name, scenario and converter list match, because a mismatch makes the comparison meaningless.
Automated scoring does not replace a person judging whether a response is harmful in context. In this situation the operator uses pyrit_shell to pull scenario results into a review session, and a reviewer reads the conversations and records their judgment. The shell's output is the raw material for that review, and the decisions made by reviewers are what the team carries forward into a finding or a fix. Keeping reviewer notes tied to the exact run prevents later disputes about what was reviewed.
- Pull results for the review set:
scenario-resultsgives the conversations a reviewer needs to read, along with their scored outcome. - Separate scoring from judgment: Record where a reviewer disagreed with the automated score, since that gap is useful for tuning scorers.
- Name the run and scenario: Every review note should reference the scenario history entry so the finding can be traced.
- Limit what reviewers see: Restrict access to attack content to people who need it, and confirm your organization's policy on storing that content.
- Hand off to a shared view: When the review involves several people, the findings usually move to CoPyRIT rather than staying in individual shells.
Before a review starts, confirm who may read the attack content and where the reviewer notes will be stored.
When several operators need the same targets, history and results, they connect their pyrit_shell sessions to a remote CoPyRIT backend instead of keeping separate local memory. Each operator still types the same commands, but runs and results land in one shared store, so colleagues can see the same history. The point of this setup is common visibility and consistent records, which matters when results feed compliance or audit work. Confirm the connection details and access rules with the team that operates the backend before anyone sends attack prompts through it.
- Confirm the connection: Check that
list-targetsin a remote session shows the registered targets the team expects. - Share history deliberately: Runs from every operator appear in
scenario-history, so agree on naming conventions for scenarios and labels. - Control access at the backend: Who can run scenarios and read results is governed by the CoPyRIT deployment, not by the shell.
- Avoid local drift: Operators working from local memory will not see shared results, so decide which store is the record.
- Keep attack content in approved places: A shared backend concentrates sensitive prompts, so confirm retention and access terms with its owner.
Before connecting, ask the backend owner which targets, labels and access groups apply and how long results are retained.
Shell commands and attachment options compared
This table compares the six pyrit_shell commands and the technique:converter.name attachment syntax, with the situation each one fits and what to confirm in the version you install. Read it as a checklist: pick the command for the step you are on, then verify the exact behavior against the documentation for your release before you rely on it in a session.
| Command or syntax | When it fits | What to confirm in your installed version |
|---|---|---|
| list-scenarios | Before a session, to find the exact scenario names available in your install | Scenario names and whether your scenario set matches the one your team documented |
| list-targets | Confirming which registered targets the shell can see before running a scenario against one | That the target you need is registered in your configuration and reachable from this host |
| list-converters | Finding converter names to attach to a technique before you add them to a run | The converter names exactly as printed, since attachment depends on exact spelling |
| run | Repeating a scenario against a target during an interactive session, after you have tuned the setup | Which scenario, target and option arguments the command accepts in your release |
| scenario-history | Reviewing what ran earlier in the session or in past sessions before you repeat or compare runs | Whether history persists across shell restarts and where it is read from in your memory setup |
| scenario-results | Opening the outcome of a specific past scenario run to decide what to investigate next | How results are identified (by run or scenario reference) and which fields are shown |
| technique:converter.name | Attaching one converter to a single technique so you can test the effect of that transformation alone | That the technique name and converter name match your release, and that the converter applies to that technique |
Setting up pyrit_shell for a team session
This sequence takes a team from a clean Python environment to a working pyrit_shell session with credentials, settings, a registered target and a first scenario run recorded in history. Each step ends with a check so the team knows the setup is sound before anyone starts testing.
Confirm a supported Python version
The engineer who owns the red teaming workstation checks that a supported Python interpreter is available 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 the team should pin that version in its shared setup notes. Done means
python --versionreports a version inside that range and the team records which interpreter it will use for every session.Install PyRIT from PyPI
The engineer creates a dedicated virtual environment and installs the
pyritpackage from PyPI with pip, so every team member runs the same release. Record the exact installed version in your team runbook, because the shell commands and scenario names depend on it. Done means the package imports cleanly and thepyrit_shellcommand starts, even if it has no targets configured yet. Confirm the version you install against the PyRIT releases page before you pin it.Place credentials in the environment file
The engineer creates
~/.pyrit/.envon the workstation and adds the keys needed for the first target, such as the API key or endpoint values for the model being tested. Keep this file out of shared folders, version control and job logs, and set file permissions so only the operator can read it. Done means the file exists at that path, contains only the credentials for the chosen target, and is not included in any repository or screenshot the team shares.Set shared settings in the configuration file
The engineer creates
~/.pyrit/.pyrit_confto hold settings that should be consistent across sessions, such as default memory location and other options the team agrees on. Settings here are separate from secrets, so the team can review this file without exposing credentials. Done means the file parses without errors when the shell starts and the team has a written note of each setting and why it was chosen.Register at least one target
The engineer registers the model or application endpoint that the session will test, using the target configuration the PyRIT documentation describes for that target type. Use a test deployment or a non-production endpoint for the first session, and confirm that the target's credentials in
~/.pyrit/.envare the ones intended. Done means the target is registered and appears when the operator runslist-targetsinside pyrit_shell.Confirm targets and scenarios are listed
Inside pyrit_shell, the operator runs
list-targetsandlist-scenariosand compares the output with the target and scenario names the team expects. A missing target usually points to a configuration or credential problem, and a missing scenario usually points to a version mismatch. Done means both lists match the team's expected names, and the operator saves the output to the session notes so later sessions can detect drift.Run a small scenario
The operator runs one scenario against the registered target with
run, using a deliberately small dataset or objective count so the first session is quick to review. Keep the first run narrow so any configuration issue is easy to isolate. Done means the run completes or stops with a readable error, and the operator notes the scenario name, target and dataset size used.Review scenario history
The operator runs
scenario-historyto confirm the completed run is recorded with its target and scenario name, then runsscenario-resultson that run to check that results were stored. This closes the setup, because the team can now trust that later runs are saved and can be reviewed. Done means the first run appears in history with a result set, and the team agrees which run identifiers will be used as the baseline for the next session.
How a shell session moves from operator to target and memory
A session starts with the operator typing commands into the pyrit_shell REPL on their own workstation. The shell resolves registered targets and converters, then runs each scenario against the target, with converters attached to a single technique using the technique:converter.name syntax. Every conversation and result is written to PyRIT memory, which uses SQLite or Azure SQL, and scenario-history and scenario-results read back from that same store. When a remote CoPyRIT backend is used, check which side holds the memory and which credentials cross the boundary.
Operator, shell, targets, converters and memory, with an optional remote CoPyRIT backend.
Connecting pyrit_shell to a remote CoPyRIT backend
Before you point pyrit_shell at a remote backend, decide three things: where the backend runs, who can reach it, and whose memory holds the results. CoPyRIT is PyRIT's web GUI for human-led red teaming and team collaboration, and the shell can be connected to a remote CoPyRIT backend so that scenario runs are executed and recorded there rather than only on the laptop or runner that started them. That changes the risk profile. A backend on a shared server holds conversations, objectives and scores from every tester who uses it, so the hosting location, network path and authentication model are part of the assessment design, not an afterthought.
Work through the decisions in order. First, choose the hosting model for the backend: a developer machine, a team server inside your network, or a cloud deployment. Second, decide who may reach it and through what identity, since a shared backend without per-user access control lets one tester read another's attack history. Third, decide which memory store holds the results. PyRIT memory uses SQLite or Azure SQL, and the choice determines retention, backup, access logging and who can export conversations later. Record these decisions in the test plan so that the scenario history a tester sees later can be traced to a known store and a known set of users.
The exact connection steps, including the command or setting that points the shell at the backend, the authentication flow and any required configuration keys, must be confirmed in the PyRIT documentation for the version you install. Commands and options have changed across PyRIT releases, so do not copy them from older posts or from this page. Confirm them against the PyRIT Shell documentation and the CoPyRIT deployment guidance for your version, then test the connection against a non-sensitive objective before running any scenario that carries real harm content.
Security and operational considerations for shell sessions
A shell session can hold credentials, reach live AI targets and write attack transcripts to memory. The cards below cover the decisions a team should settle before pyrit_shell goes beyond one operator's laptop, and the checks to run once it does.
Credential handling on shared machines
PyRIT reads target credentials from ~/.pyrit/.env, so anyone with access to that home directory can use the keys in it. On a shared operator machine, give each operator a separate account, restrict file permissions on the .env file, and confirm that shell history and terminal recordings do not capture keys typed inline. Ask whether your secrets store can supply these values at run time instead of storing them on disk.
Who can attack which target
A shell session can run any registered target that the local configuration exposes, including production endpoints. Decide which targets each operator may use and keep non-production and production registrations separate. Review the target list at the start of each session with list-targets, and treat a target that appears unexpectedly as a stop signal for the session.
Retention and access for scenario results
Scenario history and results are stored in PyRIT memory, which uses SQLite or Azure SQL. Repeated runs accumulate prompts and model responses that may contain harmful content, so decide how long that memory is kept, where the database file lives and who can open it. Confirm the retention period with your compliance team before the first shared run.
Audit trail of commands run
Shell commands such as run and scenario-history show who ran what, but only if your team keeps a record of them. Decide whether to log the operator identity, the scenario name, the target and the timestamp for each run, and where that log is stored. Check whether the memory records alone give you enough to reconstruct a session.
Keeping attack content out of shared logs
Attack prompts and model replies are sensitive. Terminal output, CI job logs and chat notifications can copy them far beyond the people who should read them. Set output destinations deliberately, avoid pasting scenario results into team channels, and redact transcripts before they leave the controlled store. Confirm this rule with anyone who receives shell output.
Reporting PyRIT vulnerabilities privately
If you find a flaw in PyRIT itself, such as a way the shell exposes credentials, report it privately through the Microsoft Security Response Center under the project's security policy instead of opening a public issue. Keep reproduction details out of tickets and chat until the report is triaged. Check the project's README for the current reporting route before you need it.
PyRIT on GitHubQuestions teams ask before running pyrit_shell
Can our team run pyrit_shell ourselves without a partner?
Yes, a team with Python experience and access to the AI systems it wants to test can install PyRIT with pip and start pyrit_shell. PyPI supports Python 3.10 up to but not including 3.15, and the documentation recommends Python 3.13. The shell gives you list-scenarios, list-targets, list-converters, run, scenario-history and scenario-results, so the day-to-day loop is learnable quickly. The harder part is deciding what to test, wiring the target correctly and interpreting results, which is where most teams need time or outside help.
What actually drives the effort of a PyRIT shell setup?
Four things dominate the work:
- Target integration: a hosted model with a supported client is simple, while a custom HTTP, WebSocket or browser-driven chat app needs request mapping and session handling.
- Scenario choice: each packaged scenario covers different harms and techniques, so the objectives and dataset you pick set the size of the run.
- Scoring setup: deciding whether an attack worked needs a scorer you trust, whether an LLM judge, Azure AI Content Safety or custom logic.
- Memory design: PyRIT stores conversations and results in SQLite or Azure SQL, so you need to decide where that database lives and who can read it.
What does our team need to provide before the work starts?
You need access to the target, meaning an endpoint or account the test is allowed to hit, and a named owner who accepts the test scope. Plan for model budgets too, because every converter, adversarial model and scorer call costs tokens or API requests, and repeated scenario runs multiply that spend. Credentials are read from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf, so someone must own how those files are stored. Your team should also own the results, including deciding who reviews findings and where memory records are kept.
How long does a first pyrit_shell session take to set up?
The time depends on the target and on how much of the environment is already in place. A team with a model endpoint, a Python environment and a clear test objective can get a first session running in a short working period, while a custom application target, a scoring design and a shared memory store take longer. No fixed duration applies to every environment, so ask for a written plan that lists each step, its owner and the checkpoint where the first run is reviewed.
When is outside help worth paying for with pyrit_shell?
Outside help makes sense when the target is hard to reach, when results will be used as compliance evidence, or when no one on the team has time to own the test design. DeployOpen plans, implements and hardens self-hosted platforms in infrastructure you control, and runs security testing of AI systems and agents, so a partner can handle target wiring, scenario selection and review of results. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and a quote follows from that written scope.
Does pyrit_shell replace CoPyRIT for our red teaming?
No. pyrit_shell is a command-line REPL for running packaged scenarios repeatedly, attaching converters to techniques and reading scenario history and results. CoPyRIT is the web GUI for human-led red teaming and team collaboration. The shell can also connect to a remote CoPyRIT backend, so the two work together. Choose the shell for scripted, repeatable runs by engineers and CoPyRIT when testers need a shared interface to work through attacks by hand.
Who is responsible for PyRIT security issues found during setup?
Vulnerabilities in PyRIT itself are reported privately through the Microsoft Security Response Center under the project's security policy, so do not post them in public issues. Findings about your own AI system are your responsibility to triage and fix. Confirm with your security team how results are stored, since memory may contain harmful prompts and model outputs, and set access controls on the SQLite or Azure SQL store before the first run.
How DeployOpen scopes and supports PyRIT shell sessions
DeployOpen plans and runs pyrit_shell red teaming sessions inside your own environment, so the targets, converters and scenario history stay under your control. The work is agreed as a fixed scope with written deliverables, and ongoing support is available as a retainer for teams that keep testing after handover.
How we scope
- Confirm which registered targets the shell sessions will reach and where each one runs.
- List the scenarios and techniques your team will run repeatedly, and which converters may attach to each technique.
- Agree who operates the shell, who reviews results, and where scenario history and results are stored.
How we build
- Configure the PyRIT environment and target registrations in your infrastructure, with credentials kept out of shared files.
- Verify each scenario runs from the shell with a small objective set before the team relies on it.
- Test the converter-to-technique pairings and confirm scenario history and results can be inspected after each run.
How we hand over
- Document the shell session workflow, including commands, typical run sequences and how to read scenario results.
- Record the target connection setup, including how to connect to a remote CoPyRIT backend if your team uses one.
- Walk your operators through the session workflow and leave a checklist for starting, reviewing and closing sessions.
How we support
- Keep PyRIT and scenario configuration current as new releases arrive, with changes agreed in writing first.
- Retest shell workflows after target, converter or environment changes to confirm results stay comparable.
- Provide ongoing support and continuous testing as a retainer, scoped separately from the initial engagement.

