Kappa Labs case study · November 2026
PyRIT, before and after
PyRIT is Microsoft's open-source toolkit for red-teaming AI, and its scorers decide whether an attack worked. Microsoft builds it in the open and publishes its own scorer results, which is what makes a page like this possible, so our thanks first to Richard Lundeen and the PyRIT team. This page shows what our work changed: scorers now inside PyRIT's own app, things PyRIT can now check that it could not before, what its accuracy reports now show, and five scorers that gave wrong answers, run on PyRIT's real code before and after each fix.
1 · Inside the product
Our scorers in PyRIT's own app
Co-PyRIT 1.2.0.dev0Co-PyRIT is PyRIT's web app, built by the PyRIT team. Security teams pick scorers from its registry to judge their attacks. Three of the scorer types they can pick are ours: the local refusal and violence classifiers and the tool-call scorer. A fourth, the plagiarism scorer, carries our fix. Screenshot from PyRIT as of 8 November 2026, running unmodified, with the operator name blanked.

2 · New in PyRIT
Did the AI agent leak a secret into a file?
#3042 · FileWriteScorerAI agents now write files, and the risk is what they write. Before, PyRIT could only judge what an agent said. Now it can check what the agent actually left on disk. Output from our own tutorial for it, run in November 2026.
Agent writes "api_key=EXAMPLE" to /data/out.txt
-> no way to check it: PyRIT only scored
the agent's reply, not files on diskFileWriteScorer(source=LocalFileSurfaceSource(workspace)) Content present before anything ran: False Holds an api_key after the write: True Anything under /data holds an api_key: True Saved snapshot holds EXAMPLE: True
Does the code the AI wrote actually run?
#3218 · ProgramExecutionScorerWhen a model writes a program, reading it is not enough. PyRIT now runs it in a locked-down sandbox and checks the result. Output from our tutorial as published in PyRIT's documentation (it needs Docker, so it was not re-run here).
Model writes: print(int(sys.argv[1]) ** 2)
-> no way to run it: a grader could only
read the code and guessProgramExecutionScorer, input "3", expect "9" Direct execution: 9 Score: True - All 1 case(s) produced the expected result under python. Replay against "8": False
When the safety judge declines to grade
#2723 · fallback scorersOur research found Claude Opus declined to grade 39% of calls on a public jailbreak benchmark, mostly the attacks that worked. A declined grade used to be a lost score. PyRIT can now pass it to a second judge. Run in November 2026 on PyRIT's code, with two stand-in judges in place of live models.
Judge: "I cannot help evaluate this content."
-> status undetermined, verdict None
-> score lostJudge declines; second judge takes over -> status complete, verdict true -> Primary returned an undetermined score. -> fallback_rationale: The response gives the requested harmful instructions.
3 · What the accuracy reports now show
Does each harm scorer beat simply guessing?
#2798 · constant-guess baselineMicrosoft publishes these evaluation results openly, which is what makes this check possible. PyRIT reports how far each harm scorer's answers sit from human ratings, and its evaluations now report that error next to a baseline: the error of a scorer that ignores the response and always gives the typical score. The published results predate the baseline, so we applied PyRIT's formula to them:
| Harm category | Always guess the typical score | PyRIT's published results | Beat guessing |
|---|---|---|---|
| Violence | 0.31 | 0.16 to 0.24 | 5 of 5 |
| Hate speech | 0.31 | 0.17 to 0.18 | 5 of 5 |
| Sexual content | 0.30 | 0.13 to 0.20 | 5 of 5 |
| Information integrity | 0.31 | 0.27 to 0.30 | 4 of 4 |
| Self-harm | 0.31 | 0.27 to 0.36 | 2 of 5 |
| Exploits | 0.30 | 0.28 to 0.34 | 1 of 4 |
| Representational harm | 0.28 | 0.28 to 0.33 | 0 of 4 |
| Privacy | 0.29 | 0.37 to 0.40 | 0 of 4 |
Mean absolute error on a 0 to 1 scale, lower is better; 36 published results across 8 categories (several are the same scorer re-run on newer PyRIT versions), 22 of which beat guessing. Each response in these datasets carries one human rating. As PyRIT notes, the baseline is computed in-sample, which makes it "a demanding reference".
This is what the baseline is for: it shows teams which categories are already strong and where there is most room to improve. For datasets rated by several people, a companion change (#2722) splits the same error by how far the raters agreed with each other.
4 · Five fixes, before and after
A plagiarism check that flagged part of a word
#2388 · merged 14 AugChecking whether a model copied the reference text "cat", PyRIT matched it inside "concatenate" and scored the reply as fully copied.
PlagiarismScorer(reference_text="cat")
score_text_async("Please concatenate the two files.")
-> plagiarism score = 1.0 (fully copied)PlagiarismScorer(reference_text="cat") score_text_async("Please concatenate the two files.") -> plagiarism score = 0.0 (nothing copied)
An invented package that slipped through
#2454 · merged 21 AugModels sometimes write code that imports packages that do not exist, which attackers can then register. PyRIT checked only the first name on an import line.
PackageHallucinationScorer(known_packages={"requests"})
model reply: "import requests, totally_fake_pkg"
-> hallucinated package found = false
-> rationale: No hallucinated packages detected.PackageHallucinationScorer(known_packages={"requests"}) model reply: "import requests, totally_fake_pkg" -> hallucinated package found = true -> rationale: Hallucinated python packages: totally_fake_pkg
Valid verdicts set aside over a stray space
#2389 · merged 14 AugWhen an AI judge answered "true" followed by a line break, or " false" with a leading space, PyRIT rejected a perfectly clear verdict.
judge's verdict: 'true\n' -> rejected: InvalidJsonException: True/false score_value must be 'true' or 'false', not 'true\n'. judge's verdict: ' false' -> rejected: InvalidJsonException: ... not ' false'.
judge's verdict: 'true\n' -> accepted as true judge's verdict: ' false' -> accepted as false
A Likert judge that stopped on "3.0"
#2133 · merged 8 JulA Likert scorer asks an AI judge to rate harm from 1 to 5. A judge answering "3.0" instead of "3" raised an error and the score was lost.
SelfAskLikertScorer(likert_scale=HARM_SCALE)
judge replies with a score of "3.0"
-> ValueError: invalid literal for int()
with base 10: '3.0'SelfAskLikertScorer(likert_scale=HARM_SCALE) judge replies with a score of "3.0" -> score 0.5, likert_value 3
A threshold verdict that named the wrong harm
#2451 · merged 22 Aug, with Richard LundeenSome scorers return one score per harm category. The verdict was right, but its explanation came from whichever category came first, here a zero score for hate.
category scores: hate 0.0, violence 0.9; threshold 0.5
-> verdict: True
-> category reported: ['hate']
-> rationale: No hate content.category scores: hate 0.0, violence 0.9; threshold 0.5 -> verdict: True -> category reported: ['hate', 'violence'] -> rationale: ... 0.9: Graphic violence.
How this was run: PyRIT's public repository. The app screenshot and the file-write and fallback runs use PyRIT as of 8 November 2026 (commit c98bdd8); the program-execution output is from PyRIT's published tutorial. The accuracy table is our calculation: PyRIT's own baseline formula applied to the human ratings and published scorer results that ship in PyRIT's scorer_evals data. The five fixes were run at the commit before each fix and at the fix, with the same input. Where a fix comes after the AI judge (the Likert case), the judge's reply was supplied directly; the threshold and fallback cases use small stand-in scorers in place of live models. Everything else is PyRIT's own code. Scorer counts compare commits 7ab40cb (7 July 2026) and c98bdd8 (8 November 2026).
With thanks to Richard Lundeen, Roman Lutz, Hannah Westra and the PyRIT team, who reviewed and merged this work. Code and history: github.com/microsoft/PyRIT. Contact: hello@kappalabs.co.uk