Why PyRIT red teaming for public sector AI starts with the data and the audience
An agency that runs a citizen-facing or internal assistant needs to test it before a governance or procurement review can close. PyRIT, the Python Risk Identification Tool for generative AI, fits this work as the harness that sends adversarial prompts to the assistant, records every exchange and scores the responses against the harms the agency has chosen to test. The starting decision is not which attack to run but which people and which data the assistant touches, because those define the harms that matter. Public sector harms differ from those in most other industries. A benefits or eligibility answer that is wrong can delay payments or deny a service, a leak can expose personal or case records, and an assistant may perform well in English while giving weaker or inconsistent answers in the other languages residents actually use. Each of these needs its own objectives, seed prompts and scoring criteria.
The assessment itself must run on infrastructure the agency controls. Test prompts, model responses and the memory that records them often contain personal data, so the target endpoint, the PyRIT installation and its database should sit inside the agency's own boundary or an approved environment. In plain terms, a target is the connection to the assistant or its model, a converter rewrites prompts before they are sent (for example, into another language or an encoded form), a scorer judges whether a response caused the harm being tested, memory keeps the conversations and results in a database, and datasets supply the objectives and seed prompts the attacks start from. Confirm early which model servers, web front ends and logging services the assistant depends on, because each one becomes part of the test surface and part of the evidence. Licensing questions and the archived repository history are covered in the buyer's guide, so this section focuses on the data and the audience.
Which public sector requirements shape the PyRIT test plan
This table maps each supplied public sector requirement to what it means for a PyRIT red teaming plan for government assistants. Read each row for the scope it adds, the evidence an assessor or reviewer is likely to ask for, and whether the requirement applies to your agency, contract or jurisdiction. Confirm applicability with counsel before scoping.
| Requirement | What it means for the PyRIT test plan | Confirm before scoping |
|---|---|---|
| NIST SP 800-53 baselines and FISMA | Low, moderate and high baselines select 149, 287 and 370 controls and enhancements. Assistant hosting, logging and access controls should map to the baseline your system is categorized at, and PyRIT run records can serve as test evidence for relevant controls. | Your system categorization and which baseline your authorizing official has selected |
| Inspector General review context | Under FISMA, Inspectors General independently assess agency system security and report to OMB. Expect reviewers to ask for dated PyRIT scenario definitions, run histories and findings with remediation status, not only a summary. | Your IG reporting calendar and what the audit team requests |
| FedRAMP scope for cloud-hosted assistants | If a cloud-hosted assistant creates, processes, stores or maintains federal information for an agency as a shared service, FedRAMP applies to the cloud product. Single-agency systems on cloud infrastructure that are not offered as a shared service fall outside that scope, so the PyRIT target boundary must match the authorized boundary. | Whether the assistant is a shared service and which authorization package covers it |
| FBI CJIS Security Policy v6.1 | For criminal justice information, the policy requires FIPS 140-3 certified modules or FIPS 197 AES with at least 256-bit keys for CJI in transit and at rest outside physically secure locations, and vulnerability scanning at least monthly. Red team tests should include leakage prompts that try to surface CJI from retrieval stores, logs and memory, and the PyRIT memory database holding test outputs must itself be protected. | Whether CJI enters the assistant and the CJIS Security Policy version your agency has adopted |
| 32 CFR 2002.14(h)(2) and NIST SP 800-171 for CUI | Agencies set CUI protection requirements on non-federal systems using NIST SP 800-171, unless the CUI category prescribes other safeguards. Test prompts should include CUI-marked sample content, with checks that the assistant does not reproduce it to unauthorized users or external tools. | The CUI categories in scope and any category-specific safeguards in their authority |
| ADA Title II WCAG 2.1 Level A and AA | State and local government web content and mobile apps, including vendor-provided ones, must meet WCAG 2.1 Level A and AA from 26 April 2027 for entities serving 50,000 or more people, and from 26 April 2028 for smaller entities and special districts (28 CFR 35.200). Accessibility is not a PyRIT target, but red team scenarios that run through a web chat UI should record any accessibility defects found during manual testing. | Your population served, the deadline that applies and whether counsel treats the assistant interface as covered content |
| NIS2 for EU public administration | NIS2 covers central government entities regardless of size and lists public administration as a high-criticality sector. Member States may extend it to local public administration, and it does not apply to entities working in national security, public security, defense or law enforcement. Where it applies, test plans should map to incident handling and risk management evidence. | Whether your entity is in scope under national transposition and whether a law enforcement or security exemption applies |
| Multilingual and jurisdiction-specific scope | Citizen-facing assistants often serve several languages. Scenario sets should include each supported language and dialect, since safeguards that hold in English may fail in others. Requirements above differ by country and agency, so the plan should record which requirement each scenario supports. | Languages the assistant serves and which jurisdictional requirements your counsel confirms apply |
Where the target model and PyRIT run, and why it matters for review
When the assistant runs on agency-owned servers, the model, the interface and the PyRIT host can all sit inside one authorization boundary that the agency already documents. Ollama or vLLM can serve the model locally, and Open WebUI can give staff or citizen-facing pilots a browser interface connected to those services. Open WebUI can run entirely offline with Ollama or OpenAI-compatible APIs, and vLLM provides an --enable-offline-docs option for air-gapped environments, so the serving stack does not need to reach the internet at runtime.
- Target endpoint: Point PyRIT at the Open WebUI or vLLM API endpoint that users actually reach, not only the raw model server, so safeguards in the interface are tested.
- Network path: Confirm which hosts can reach the target and whether PyRIT runs on a separate test host with its own credentials.
- Model provenance: Record the model name, version and weights source, because a red team result applies only to that artifact.
- Logging: Check whether the serving layer logs prompts and responses, and whether those logs contain citizen personal data.
- Access control: Limit who can run attacks and who can read the memory database.
Confirm with your security team which boundary the system is documented under before the first test run.
When the assistant calls a model hosted by a cloud provider, the review question shifts from where the model runs to whether the cloud service is in scope for federal cloud requirements. FedRAMP's scope covers cloud products and services that create, collect, process, store or maintain federal information on behalf of an agency. A system used only for a single agency's operations on cloud infrastructure, and not offered as a shared service, is out of scope. Whether your assistant falls inside that line depends on the service model and your agency's contract, so this is a question for your authorizing official and procurement team, not a conclusion a test can settle.
- Scope determination: Document whether the cloud model and any intermediary service are shared services or single-agency systems under the FedRAMP scope guidance.
- Prompt and output retention: Ask the provider how long prompts, completions and logs are kept and where they are stored.
- PyRIT memory location: Keep attack transcripts in a store you control, such as local SQLite or an Azure SQL database in your own tenant, even when the target is hosted elsewhere.
- Credentials: Store API keys for the cloud target in the agency's secrets system, referenced from the
~/.pyrit/.envfile rather than pasted into scripts. - Contract clauses: Confirm that the red team activity itself is permitted under the provider's acceptable use terms.
Check these answers with the provider's documentation and your agency's FedRAMP authorization status before scheduling tests.
On an air-gapped network, PyRIT, its Python dependencies, the target model, the datasets and any scorer models must all be brought across the boundary before testing starts. Nothing can be fetched during a run. The control logic is familiar from NERC CIP-013-2, which requires supply chain procurement processes to address verification of software integrity and authenticity of vendor software and patches. That standard governs electric utilities, so it applies to an agency only by analogy, or where the agency chooses to adopt it. The principle still helps: every package carried across the boundary should have a recorded origin and checksum.
- Package inventory: List every PyRIT release, Python wheel and transitive dependency, and record the Python version used. PyRIT supports Python 3.10 up to but not including 3.15 and recommends 3.13.
- Offline installation: Build a local wheel or package mirror on the approved side, then install from it inside the enclave.
- Scorer and dataset assets: Any LLM judge, classifier or seed dataset used for scoring must be transferred and versioned the same way.
- Memory choice: SQLite keeps all results in a local file that moves easily with the enclave, while Azure SQL assumes a connection most air-gapped networks do not have.
- Update path: Plan how a later PyRIT release is verified and carried in, including the archived Azure/PyRIT repository status.
Ask the network security team how transfers are logged and approved, and confirm this before the first package crosses.
PyRIT keeps conversations and results in its memory layer, which stores them in SQLite or Azure SQL. Where that database sits decides who can read the evidence, how long it survives, and whether it can be handed to an auditor or procurement reviewer without exposing citizen data. SQLite suits a single controlled host where the file can be encrypted and backed up under the agency's own procedures. Azure SQL suits a team that already runs governed database services in an Azure tenant the agency controls. Either way, the memory file contains the prompts and responses from the test, which may include sensitive or synthetic personal data.
- Storage location: Place the database on an encrypted volume with access limited to named testers and reviewers.
- Backup and retention: Define how long attack records are kept and how they are deleted at the end of the review cycle.
- Configuration files: Keep
~/.pyrit/.pyrit_confunder version control without secrets, and keep credentials in~/.pyrit/.envon protected hosts. - Export for review: Plan exports of selected conversations rather than sharing the whole database with reviewers.
- Tamper evidence: Record who ran each scenario, against which model version and on which date.
Confirm with your records office and auditors which retention and access rules apply to AI test records before you choose a database.
Which PyRIT targets, converters, scorers and datasets matter for government assistants
A government assistant usually sits behind a custom endpoint, a portal chat or a multilingual user base, so PyRIT's components have to match how citizens and staff actually reach it. The cards below cover the six parts of a PyRIT test plan that most affect what the results will show.
Custom HTTP or WebSocket targets
Most agencies run their own assistant on self-hosted models behind an internal API, so a custom HTTP or WebSocket target is usually the first build item. Point it at the same endpoint, system prompt and retrieval layer that production uses, not a staging shortcut, or the findings will describe a system nobody operates. Confirm with the vendor or your platform team how authentication tokens are supplied and refreshed during a long run.
PyRIT documentationPlaywright targets for portal chat
Many citizen-facing assistants live inside a portal rather than an API, and their chat widget may hide authentication, session handling and content filters that a raw endpoint would skip. PyRIT can drive a web app target through Playwright, which lets the test cover the path a resident actually uses. Check that test accounts are synthetic, that session cookies are scoped to the test run, and that the browser automation does not reach live benefit or case records.
Converters for translated and transliterated prompts
Public services often serve residents in several languages and scripts, and safeguards tuned for English can weaken in others. PyRIT converters can translate or transliterate attack prompts before they reach the target, so the same objective is tested across the languages the agency supports. Decide which languages and scripts are in scope before the run, and record which converter produced each prompt so results can be traced back.
Scorers and their language coverage
PyRIT scorers judge responses with an LLM, with Azure AI Content Safety or with custom logic, and each has different strengths outside English. Before trusting a pass or fail, measure scorer accuracy on a labeled sample in each language the assistant serves, and have a fluent reviewer check disagreements. Ask the scorer vendor or project to confirm the languages each classifier supports, because a scorer that cannot read a language will report false safety.
Multi-turn strategies: Crescendo, TAP and Skeleton Key
Residents and staff rarely attack an assistant in one message, so multi-turn strategies matter for government use. PyRIT supports Crescendo, TAP and Skeleton Key, which escalate or reframe across a conversation and can surface failures that single prompts miss. Set turn limits and stop conditions in advance, since longer runs multiply model calls and scorer calls, and agree with the agency which system prompts and benefit or eligibility topics are in bounds.
Datasets for content, psychosocial and leakage
PyRIT datasets cover content harms, psychosocial risks and data leakage, and each maps to a different public sector concern: unlawful advice, vulnerable users in crisis and disclosure of personal records. Build the objective set around the agency's actual services, such as benefits, licensing or tax, and use synthetic personal data for leakage tests. Record which dataset version was used, because the evidence you later give reviewers depends on it.
How a public sector PyRIT assessment moves from scope to retest
The sequence turns a government assistant into a tested, documented system with findings that have owners, fixes that have been retested, and an evidence pack that governance and procurement reviewers can follow. Each phase closes with a written output so the next phase starts from agreed inputs.
Scope the assistant, its data and its review
The agency and the assessment lead agree which assistant is under test, whether it is citizen-facing or internal, which user groups reach it, what data it can see and which governance or procurement review the results will feed. Harms are listed against the agency's own use cases, and any data that falls under CJIS, CUI or accessibility obligations is named so it shapes later datasets. The step closes with a signed scope statement that lists in-scope systems, out-of-scope items, test accounts and the reviewer who will accept findings.
Intake and verify the PyRIT environment
The engineering team builds a test environment on Python 3.10 or later and below 3.15, with the documentation's recommended Python 3.13 as the reference version, and records the exact PyRIT release used. Every package, container image and model file is downloaded outside the isolated network, checked for integrity and authenticity, and then carried across the boundary under a documented process. The step closes with a bill of materials and hash record that the agency's security team has accepted.
Build target connectors and multilingual datasets
Engineers connect PyRIT to the self-hosted model endpoint or the custom HTTP or WebSocket application that the public will actually use, and confirm that test traffic follows the same authentication and logging path as production. Language coverage is set with the agency's service teams, so that the objectives and seed prompts include the languages residents use, plus any accessibility-related input methods. Synthetic records replace real personal data in every dataset. The step closes with a connector test log and a versioned dataset list that the agency can review.
Run attacks and score with human review
The assessment team runs single-turn and multi-turn attacks against the connectors, using scorers that combine automated judgments with named human reviewers for borderline or high-impact responses. Scorer behavior is checked against a small set of responses reviewers have already labeled before results are trusted. Run settings, conversation memory and reviewer decisions are stored so each result can be traced later. The step closes with a scored run record that separates confirmed issues from scorer disagreements.
Triage findings and agree fixes
Confirmed findings are grouped by harm, by affected user group and by severity, using the agency's own risk categories. Each finding gets a named owner, a proposed fix in the model, prompt, retrieval, access or logging layer, and a record of any residual risk the agency accepts in writing. Fixes that touch the public-facing service go through the agency's change process before they are deployed. The step closes with a triaged findings register that the owners and the accepting reviewer have both signed.
Retest fixes and assemble the evidence pack
The team reruns the same attacks and datasets against the changed system, with the same PyRIT version and settings where possible, and records whether each finding is closed, partly closed or still open. Any change in model version, prompt or connector since the first run is noted so reviewers can see what was tested. The evidence pack contains the scope statement, environment record, dataset list, scorer checks, run history, findings register and retest results, organized for governance and procurement reviewers. The step closes when the agency confirms the pack covers the questions its review will ask.
Compliance evidence that governance and procurement reviewers ask for
Governance and procurement reviewers rarely ask whether a red team ran. They ask what was tested, how results were recorded, and which controls the evidence supports. The four items below connect PyRIT run records to the assessment questions a public sector review will raise, and each names the decision that the agency or its assessor still owns.
PyRIT memory as an audit trail
PyRIT stores conversations and results in SQLite or Azure SQL, so every prompt, converted variant, target response and score can be traced back to a run. Before the first test, decide where the memory database lives, who can read it, and how long it is retained under the agency's records schedule. Export the conversations needed for review and confirm that the export keeps the run identifiers, timestamps and target configuration that an assessor will ask to see. Store the exact PyRIT version and the target model version with each run, because results from a different version cannot be compared as if they were the same test.
PyRIT documentationNIST SP 800-53 control mapping
Agencies assessed under FISMA usually map evidence to control families in NIST SP 800-53 Rev. 5 and to the baseline selected under SP 800-53B. Map AI red teaming records to the controls that the assistant's system security plan already cites, such as risk assessment, security assessment and information flow controls, rather than creating a parallel control set. DeployOpen prepares this evidence, including test plans, run records and remediation tracking, but does not issue audit reports or authorizations. The authorizing official and the independent assessor decide whether the evidence satisfies each control.
SP 800-53 Rev. 5 textWCAG 2.1 AA checks for the interface
Where the ADA Title II rule applies, state and local government web content and mobile apps must meet WCAG 2.1 Level A and AA. The deadline is 26 April 2027 for entities serving 50,000 or more people and 26 April 2028 for smaller entities and special districts. A citizen-facing assistant's chat interface, including screen reader labels, keyboard operation and error messages, falls within that scope when it is web content or a mobile app. Accessibility testing is a separate workstream from PyRIT red teaming, and it should be scoped and recorded separately so that safety results are not mistaken for accessibility conformance.
28 CFR Part 35 Subpart HNIS2 and CJIS scope questions
Whether NIS2 applies depends on the entity type. It covers central government entities regardless of size, may be extended to local public administration by Member States, and excludes entities working in national security, public security, defense or law enforcement. If the assistant handles criminal justice information, the FBI CJIS Security Policy may also apply, including its encryption and vulnerability scanning requirements. The agency's legal or compliance team must confirm which regime applies before the test plan is written, because the scope determines which datasets, evidence and retention rules are needed. DeployOpen can prepare evidence once that scope is confirmed.
NIS2 Directive textWhat agencies ask before hiring a partner for PyRIT red teaming
What drives the cost of a PyRIT red teaming engagement for a government assistant?
The cost follows the written scope, and five factors move it most: the number of assistants and entry points, the number of languages and dialects that must be tested, the complexity of each target (a plain API versus a web chat UI behind single sign-on with retrieval over case files), the scoring method (human review of harmful outputs costs more than automated scoring alone), and the retest scope after fixes. Ask the partner to price each factor separately so you can see which choices reduce effort. The one-time work is scoping, target setup, dataset preparation and the first test cycle. Retesting and continuous testing recur. DeployOpen does not publish a price list, so request a quote built from a written scope.
How long does a scoped PyRIT red teaming assessment take?
Duration depends on the same scope drivers as cost, plus how quickly access and reviewers become available. Expect the schedule to be set by the agreed scope and timeline in writing before work starts, not by a generic estimate. In practice, the largest variable is often not testing but preparation: getting test accounts, a stable model endpoint, approved synthetic data and reviewers who read each target language. Ask the partner to show which phases depend on your inputs and which run on the partner's side, then agree dates for each.
What must the agency supply for a PyRIT engagement to run smoothly?
Plan to provide four groups of input before testing starts:
- Test accounts with the same roles that citizens, caseworkers and administrators use, including accounts that should be denied access.
- Model access, either a self-hosted endpoint or an approved API key, with a documented change process if the model is updated during testing.
- Language reviewers who can judge harmful or incorrect output in each language in scope, since automated scoring is weaker outside English.
- Policy owners who confirm which outputs are acceptable, which information must never be disclosed, and who signs off on findings.
Missing any group usually delays the schedule more than the testing itself.
Can our own staff run PyRIT red teaming without an outside partner?
Yes, PyRIT is open source under the MIT license and can run as a scanner through pyrit_scan, through CoPyRIT for human-led testing, or as a Python framework for custom attacks. Staff need Python skills to install and configure it (the documentation recommends Python 3.13), comfort with HTTP or WebSocket targets, familiarity with the target's authentication, and enough AI security knowledge to design objectives and judge results. Interpreting results for a governance review is the hardest part to staff. Decide early which tests your team will own and which need an outside tester to provide independence.
How do we read a quote against a written PyRIT scope?
Check that the quote maps line by line to the written scope. Confirm which assistants, languages, data sources and attack categories are included, and which are excluded. Look for separate line items for scoping, target setup, dataset preparation, test execution, human review, reporting, and retest. Ask how scoring is done and whether human reviewers are included. Confirm what is one-time and what recurs, who holds access credentials during the engagement, and how changes to scope are priced. Any item without a matching scope statement is a question to resolve before signing.
How should results be handled when they contain personal data or fall under public records rules?
Treat PyRIT memory and exports as sensitive records from the start. PyRIT stores conversations and results in SQLite or Azure SQL, so the database location, access rights and retention period need to be set before testing. Use synthetic personal data in prompts and test records wherever possible, and redact any real citizen data that appears in output before findings are shared. Ask counsel or your records officer whether test records fall under public records law in your jurisdiction and how long they must be kept. Put the handling rules, storage location and deletion steps in the written scope so the partner works within them.
What evidence will a governance or procurement review expect from a PyRIT engagement?
Reviewers usually want to see the scope and objectives, the target configuration and model version tested, the datasets used, the scoring method and its known limits, the findings with severity and the fixes applied, and the retest results. Ask the partner to keep the memory records in a form your auditors can follow. 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.
How PyRIT, the assistant and the evidence store connect inside the agency boundary
The flow starts with the PyRIT runner inside the agency network, where multilingual objectives pass through converters before reaching the assistant target, which is a self-hosted model behind Open WebUI or a custom endpoint. Responses return to scorers, and every prompt and response is written to PyRIT memory. Check that the local scorer is the only scorer on the agency side of the boundary, and that any external scorer or cloud service receives only what your data handling approval allows. The evidence pack is exported from memory only after that review.
Data flow from PyRIT through the assistant to the evidence pack, with the boundary marked.
How to test multilingual safeguards without weakening the results
Safeguards in generative AI models often perform unevenly across languages, and public services serve residents in several of them. A refusal behavior tuned in English can weaken in a lower-resource language, and a scorer built for English may misread a harmful answer written in another language. For a citizen-facing assistant, an agency that tests only in English can report a clean result while the languages used by a large share of its residents remain untested. Before the first run, list every language the agency serves through the assistant, then confirm for each one whether the PyRIT datasets and scorers in use have coverage. Where coverage is thin, record the gap as a finding in the evidence file rather than assuming the English result carries over.
PyRIT converters can translate or rewrite seed prompts before they reach the target, which lets one objective be tested across several languages. Translation by a model is fast but can change the meaning of a harmful request, so a test may quietly become a weaker or different attack. Each translated prompt should keep its objective label, and a bilingual reviewer should confirm that the translation still asks for the same harmful content. The same applies to LLM-based scorers. Scorer decisions in each language must be checked by a human language reviewer who reads the target's response, because an automated judge can mark a clear refusal as a failure or miss a harmful answer that uses idiom or dialect. Record the reviewer's name, language and date against each validated sample.
Translated test sets belong under version control, with the source prompt, the translation, the converter settings, the model used for translation and the reviewer's sign-off stored together. Keep the same versioned files for every retest, so a change in attack success rate can be traced to a change in the model or safeguard, not to a different set of prompts. When a translation is corrected, issue a new version and note which results it affects. Ask the team who owns the translated sets, how reviewers are chosen for each language and how the agency will show a procurement or governance reviewer that the same set produced the earlier results.
How DeployOpen scopes and delivers PyRIT red teaming for public sector AI
DeployOpen plans, implements and documents PyRIT red teaming for public sector AI inside infrastructure you control, including self-hosted models and assistants. Engagements start with a written scope so that agencies, auditors and procurement reviewers can see what was tested, how, and what evidence was handed over.
How we scope
- Written scope agreed before work starts, naming the assistants, languages, data sources and user groups in the test
- Agreement on which harms, datasets and attack strategies apply to citizen-facing and internal use cases
- Confirmation of hosting boundaries, model endpoints and the review audience that will rely on the results
How we build
- Set up PyRIT in your environment with targets pointed at your self-hosted models and assistant endpoints
- Configure scorers, memory storage and access controls so each run is traceable and reproducible
- Run the agreed test set, retest after fixes and record each finding against the scenario that produced it
How we hand over
- Findings report with reproduction steps, conversation exports and the configuration used for each run
- Runbook for operating PyRIT scenarios in your environment, including how to rerun tests after model changes
- Documentation of the evidence trail that governance and procurement teams can review with their own auditors
How we support
- Engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as a retainer
- Retainer can cover re-running scenarios after model, prompt or policy changes in your assistants
- Ask in your quote which support, retest and upgrade items are included and how changes to scope are handled

