Framework
microsoft/PyRIT avatar
microsoft/PyRIT

PyRIT: Microsoft's Python Framework for Red-Teaming Generative AI Systems

The Python Risk Identification Tool for generative AI (PyRIT) is an open source framework built to empower security professionals and engineers to proactively identify risks in generative AI systems.

4,563 stars921 forksPythonMIT

At a glance

What is it?
PyRIT is a Python library and orchestration layer for probing generative AI systems with adversarial prompts. It is aimed at security teams who already know what they want to test, and its own metadata still classifies it as alpha.
Who is it for?
Adopt PyRIT if you have a named generative AI target, a Python 3.11 to 3.14 environment, and someone who can read the website docs rather than only the README. Do not adopt it if you need a point-and-click scanner or a stable API surface, because pyproject.toml still declares Development Status 3 - Alpha and the README points to the website for install and usage instructions.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What PyRIT Is For, and Who Should Pick It Up

PyRIT stands for Python Risk Identification Tool for generative AI. The README describes it as a framework built to let security professionals and engineers proactively identify risks in generative AI systems. That is the whole scope statement the repository gives: it is a tool for finding problems, not for fixing or guarding against them.

The audience is narrow by design. The pyproject.toml authors field is Microsoft AI Red Team, and the keywords list includes ai-red-team, ai-red-teaming and ai-robustness-testing. This is infrastructure for people who already run adversarial testing against models, agents or applications and want to automate the parts they currently do by hand. If you are a product engineer looking for a safety filter, or a compliance officer looking for a report generator, the project is not pitched at you.

The README is unusually thin for a project of this scope. It contains no usage example, no architecture description and no install command. It links to the website for how to use, install or contribute, to a security policy for private vulnerability reports, and to a Discord server. Everything below that line is trademark and citation boilerplate. Treat the website as the manual and the README as a signpost.

Orchestrator, Targets and Scoring: The Shape of the Framework

The repository layout is the clearest evidence of the architecture. There is a pyrit/ package, a tests/ directory split into unit, integration, partner_integration and end_to_end suites according to the Makefile variables, a docker/ directory, a frontend/ directory with a gui-deploy.yml beside it, and an infra/ directory. A framework that ships a frontend and deployment infrastructure is not a script collection; it is a service with a Python core.

The dependency list in pyproject.toml tells you what the core actually does. SQLAlchemy and alembic point to a relational store with schema migrations, so results are persisted rather than printed and forgotten. fastapi and starlette back an HTTP surface. pydantic handles typed configuration and message objects. httpx with HTTP/2 support and openai cover model calls. The long tail is more interesting: base2048, ecoji, confusables and confusable-homoglyphs are text-encoding and homoglyph libraries, which is the toolkit of prompt obfuscation and filter-evasion work. segno generates QR codes. av, pillow, pypdf, python-docx, openpyxl and reportlab cover audio, image, PDF, Word and Excel handling, which implies multi-modal inputs and exported findings.

Several dependencies are Azure-specific: azure-identity, azure-keyvault-secrets, azure-ai-contentsafety, azure-storage-blob and azure-core. Those are optional in practice only if you avoid the code paths that import them, since they are declared as unconditional dependencies. A team running entirely outside Azure still installs them.

What the repository does not show is the orchestration API itself. The README gives no example of constructing a target, sending a prompt or reading a score, so the data flow between an attacker prompt, a model response and a stored result has to be learned from the website or the source.

Installing PyRIT and Running a First Probe

The README does not contain install instructions. It states that the website covers how to use, install or contribute to PyRIT, so the authoritative steps live at microsoft.github.io/PyRIT. What the repository does confirm is the package name and the interpreter range: the distribution is pyrit, and requires-python is >=3.11, <3.15, with classifiers for Python 3.11 through 3.14. The presence of uv.lock and a Makefile whose commands are all prefixed with uv run -m suggests the maintainers develop with uv, but nothing in the repository says uv is required for users.

A plain pip install is therefore the only install form the metadata supports without inference:

bash
pip install pyrit

After that, the repository gives you configuration templates rather than a quickstart. Two dotenv examples sit at the top level: .env_example and .env_local_example. The project depends on python-dotenv, so the intended pattern is to copy one of those files, fill in credentials, and let the library load them at runtime. The .pyrit_conf_example file at the repository root is the other configuration artifact. Read both before writing code, because the variable names are the interface.

bash
cp .env_example .env

If you would rather not install into your host interpreter, the docker/ directory and .devcontainer/ directory exist for containerised use, and .dockerignore is present. The repository does not document an image name or a published tag, so treat those directories as build inputs to inspect rather than as a ready-made deployment.

The first real use is a script that imports the package and drives a target. The README does not show that script, and inventing one would be guesswork. The honest path is the website's usage pages, which the README points to first.

Where PyRIT Will Waste Your Time

The project labels itself alpha. pyproject.toml carries the classifier Development Status :: 3 - Alpha, and the development version in the same file is 1.2.0.dev0 against a most recent release of v1.1.0. Alpha plus a dev version in the tree means the public API is still moving. If you build internal tooling on top of PyRIT classes, expect to rewrite parts of it across releases. Pin your version.

The dependency set is heavy and opinionated. transformers is declared with a release-candidate lower bound, numpy has two separate version constraints split by interpreter version, and the Azure libraries come along whether or not you use Azure. In an air-gapped environment or a slim container, that is a large install surface to audit. Nothing in the repository suggests a minimal-extras install path.

Multi-modality cuts both ways. The audio, image, PDF and Office dependencies mean the framework can carry those formats, but they also mean the library pulls media decoding and document parsing into your environment. A team that only wants text prompt testing still pays for that.

The wrong-tool case is straightforward. PyRIT is not a scanner you point at an endpoint and get a severity report from. There is no documented command-line entry point, no documented output schema and no documented scoring rubric in the repository. It is a library and service for people who will write the attacks themselves. If your requirement is a repeatable compliance artifact with fixed categories, you will spend more time building that on top of PyRIT than you would adopting a purpose-built assessment product.

PyRIT Against Garak: Library Versus Scanner

The natural comparison for anyone evaluating PyRIT is garak, the LLM vulnerability scanner. The difference is in where the work happens.

Garak is a scanner. You install it, point it at a model endpoint, pick probe families, and it runs them and emits a report. The unit of work is a scan run, and the user's job is configuration and interpretation. PyRIT is the opposite shape. Based on the dependency list and repository layout, it is an orchestration library plus a service: you write Python that composes targets, prompts and scoring, and the framework persists what happens through SQLAlchemy with alembic migrations. The unit of work is a program you write.

That makes PyRIT more flexible and more expensive. Custom multi-turn attack strategies, bespoke scorers and multi-modal payloads are all reachable, because you are programming rather than selecting from a menu. The cost is that you own the strategy design and the result interpretation. Garak gives you a baseline in an afternoon; PyRIT gives you a platform you have to build on.

There is a second axis: Azure. PyRIT ships first-party Azure identity, Key Vault, Content Safety and Blob Storage integrations. If your models and data already live in Azure, that is a shorter path than wiring credentials by hand in a scanner. If you are entirely outside Azure, those dependencies are dead weight.

Neither tool replaces the other. Teams that want coverage fast start with a scanner and reach for a library when the scanner's probes stop matching their threat model.

Maintenance, Licence and the Cost of Upgrading

The repository is not archived, and the last push was on 2026-09-10, which is recent. Releases are also close together: v1.0.0 on 2026-07-24, v1.0.1 on 2026-07-30, and v1.1.0 on 2026-09-04. That cadence is the practical upgrade cost. Three releases in roughly six weeks, with the development version already at 1.2.0.dev0, means a pinned dependency will fall behind quickly, and an unpinned one will surprise you.

The internal test split documented in the Makefile is a point in the project's favour for anyone planning to upgrade: unit, integration, partner_integration and end_to_end suites exist as separate targets, and there is a ty target running the ty type checker over pyrit and tests/unit. That suggests type annotations are maintained rather than decorative. It does not tell you whether your specific integration is covered, and the repository gives no compatibility policy for the public API between minor versions.

Licensing is MIT, declared in both the LICENSE file and the pyproject.toml license field. That is permissive and commercially usable. Two caveats sit in the repository. A LICENSES/ directory and a THIRD_PARTY_NOTICES.txt file exist, which means bundled or vendored components carry their own terms that you should read separately. The README also states that use of Microsoft trademarks or logos in modified versions must not imply Microsoft sponsorship. If you fork PyRIT and ship it internally under its name, that clause is worth a look. None of this is legal advice; the files are there to read.

Editorial conclusion

Adopt PyRIT if you have a named generative AI target, a Python 3.11 to 3.14 environment, and someone who can read the website docs rather than only the README. Do not adopt it if you need a point-and-click scanner or a stable API surface, because pyproject.toml still declares Development Status 3 - Alpha and the README points to the website for install and usage instructions. Before committing, verify which Python version your environment runs, read the .env_example file to see which credentials the configuration expects, and check the CITATION.cff file if the output will be published.

Frequently asked questions

How do I install PyRIT?

The README does not give install steps and instead points to the project website for how to install PyRIT. The package name is pyrit and requires-python is >=3.11, <3.15, so a pip install of that distribution is the form the metadata supports.

How do I use PyRIT?

The README directs readers to the website for usage information, and the repository itself provides configuration templates (.env_example, .env_local_example and .pyrit_conf_example) rather than a quickstart example. Based on the dependency list, usage means writing Python that drives targets and scoring while results are persisted through SQLAlchemy.

Is PyRIT legal to use?

PyRIT is released under the MIT licence, which is permissive. The README notes that Microsoft trademarks or logos used in modified versions must not imply Microsoft sponsorship, and the repository includes a LICENSES/ directory and THIRD_PARTY_NOTICES.txt for bundled components. Whether a particular red-teaming activity is lawful depends on your jurisdiction and your authorisation, which the project does not address.

Can I install PyRIT on Kali Linux?

The repository does not mention Kali Linux or any distribution-specific instructions. The only stated platform constraint is the Python version: requires-python is >=3.11, <3.15, with classifiers for 3.11 through 3.14. If your Kali environment provides a Python in that range, the metadata places no further restriction.

Official sources

  1. License: MIT
  2. microsoft/PyRIT on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/microsoft-pyrit.svg)](https://hysenlabs.com/projects/microsoft-pyrit)