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.

25 merged pull requests, July to November 2026Scorer classes 45 → 703 of the 42 scorer types in PyRIT's web app are ours, and a fourth carries our fixNamed PyRIT MVP by maintainer Richard Lundeen

1 · Inside the product

Our scorers in PyRIT's own app

Co-PyRIT 1.2.0.dev0

Co-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.

Co-PyRIT Scorer Registry listing refusal-local (LocalRefusalClassifierScorer), tool-calls (MessageToolCallScorer), plagiarism (PlagiarismScorer) and violence-local (LocalViolenceClassifierScorer)

2 · New in PyRIT

Did the AI agent leak a secret into a file?

#3042 · FileWriteScorer

AI 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.

BEFOREJuly 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 disk
AFTERNovember 2026
FileWriteScorer(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 · ProgramExecutionScorer

When 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).

BEFOREJuly 2026
Model writes: print(int(sys.argv[1]) ** 2)
-> no way to run it: a grader could only
   read the code and guess
AFTERNovember 2026
ProgramExecutionScorer, 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 scorers

Our 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.

BEFOREone judge
Judge: "I cannot help evaluate this content."
-> status undetermined, verdict None
-> score lost
AFTERTrueFalseFallbackScorer
Judge 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 baseline

Microsoft 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 categoryAlways guess the typical scorePyRIT's published resultsBeat guessing
Violence0.310.16 to 0.245 of 5
Hate speech0.310.17 to 0.185 of 5
Sexual content0.300.13 to 0.205 of 5
Information integrity0.310.27 to 0.304 of 4
Self-harm0.310.27 to 0.362 of 5
Exploits0.300.28 to 0.341 of 4
Representational harm0.280.28 to 0.330 of 4
Privacy0.290.37 to 0.400 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 Aug

Checking whether a model copied the reference text "cat", PyRIT matched it inside "concatenate" and scored the reply as fully copied.

BEFORE2249d2a6
PlagiarismScorer(reference_text="cat")
score_text_async("Please concatenate the two files.")
-> plagiarism score = 1.0   (fully copied)
AFTERf049e1a4
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 Aug

Models 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.

BEFORE82b7e031
PackageHallucinationScorer(known_packages={"requests"})
model reply: "import requests, totally_fake_pkg"
-> hallucinated package found = false
-> rationale: No hallucinated packages detected.
AFTERd1230cbe
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 Aug

When an AI judge answered "true" followed by a line break, or " false" with a leading space, PyRIT rejected a perfectly clear verdict.

BEFORE3b068a4d
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'.
AFTERe1107cc0
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 Jul

A 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.

BEFORE3dd5806c
SelfAskLikertScorer(likert_scale=HARM_SCALE)
judge replies with a score of "3.0"
-> ValueError: invalid literal for int()
   with base 10: '3.0'
AFTER0bbeb71f
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 Lundeen

Some 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.

BEFOREac8a3094
category scores: hate 0.0, violence 0.9; threshold 0.5
-> verdict: True
-> category reported: ['hate']
-> rationale: No hate content.
AFTERc8b5faaf
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