Skip to main content

EvalPen

Build an LLM judge you can trust, then use it. Open source, local, and inside your agent.

EvalPen is a Python library for LLM evaluation, with four ways in: an MCP server for your coding agent (Claude Code, Cursor, or any MCP client), a CLI, a Python API and a CI check. There's no dashboard and no account. In your agent, you ask in plain language and get a report back in the conversation.

"Compare prompt v1 and v2 on my 50 test cases." "Is this answer supported by these documents?" "Here are 30 hand-labeled examples. Can I trust my judge?"

Early version (0.1). Tested with fake models so far: feedback from real use is very welcome.

Why

  • Prompt changes get tested by vibes. Three examples, eyeballed. Regressions ship.
  • LLM judges get trusted blindly. Judges have known biases (position, length) and can disagree with humans on hard cases. Most setups never check.
  • Eval frameworks take setup. Many teams never get past it.

EvalPen makes evaluation a one-sentence ask, and every report states how reliable its judge is.

Tools

Tool What it does Status
align_judge Improves a judge's rubric until it agrees with your own labels, checked on held-out examples available
compare_prompts Is prompt (or model) B really better than A? Order-swapped pairwise judging, confidence interval, regressions available
check_faithfulness Splits an answer into atomic claims and checks each against the source documents available
calibrate_judge Measures judge vs. human agreement (raw agreement, Cohen's kappa, disagreements) available
create_eval_set Builds a varied test set from your logs (no LLM) or from a description of the app available

How it works

  • Pairwise judging. The judge picks the better of two answers against your criteria. This is more stable than absolute 1–10 scores.
  • Position-bias control. Each pair is judged twice with A/B swapped. A flipped verdict counts as a tie and gets flagged.
  • Confidence intervals. Win rates come with an interval, so you don't conclude from 10 examples.
  • Local first. Test cases, runs and reports stay on your machine as JSONL and Markdown. LLM calls use your own API key.

Try it now

Five tools work today: test set creation, judge alignment, prompt comparison, hallucination check and judge calibration.

Build a test set

From your own logs (preferred): EvalPen removes duplicates and picks the most varied inputs, so 30 cases cover 30 situations instead of 30 versions of the most common question. No LLM, free, deterministic.

uvx evalpen eval-set --from-logs logs.jsonl --n 30 --out cases.jsonl

From a description, when you have no logs yet: an LLM lists realistic scenarios (typical, edge cases, ambiguous, should refuse, tries to trick) and writes cases for each, with what a good answer must do. Review synthetic cases before trusting them.

uvx evalpen eval-set --describe "Support chatbot for a home internet provider" --n 30 --model anthropic:<model-id>

Align your judge with your own labels

Label 20 to 50 examples by hand, write a first rubric, and let EvalPen improve it until the LLM judge agrees with you. Part of your examples is held out and never shown to the rewriting step, so a rubric that just memorizes your cases is rejected.

uvx evalpen align labels.jsonl \
  --rubric "Pass if the answer helps the customer." \
  --labels pass,fail \
  --judge anthropic:<model-id>
Judge alignment: holdout kappa 0.31 -> **0.78** (target 0.70 reached)
Examples: 21 to improve the rubric, 9 held out to check it

| Round | Train kappa | Holdout kappa | Kept | What changed |
| 0 | 0.35 | 0.31 | yes | starting rubric |
| 1 | 0.72 | 0.78 | yes | Hedged answers now fail; partial refunds count as helpful. |

Saved the calibrated judge to judge.json

(Example output.) Each line of labels.jsonl has output and human, plus optional id, input and context. Then grade new outputs with the calibrated judge:

uvx evalpen grade new_outputs.jsonl --judge-file judge.json --out graded.jsonl

judge.json is plain JSON with the rubric in it: read it, edit it, commit it.

Compare two prompts (or two models)

Both versions answer every test case. The judge compares each pair twice, swapping which answer comes first; if the verdict flips with the order, the pair counts as a tie. You get B's win rate with a 95% confidence interval and a sign test, plus the cases where A still wins.

uvx evalpen compare cases.jsonl \
  --a prompts/v1.txt --b prompts/v2.txt \
  --model anthropic:<model-id> \
  --judge-file judge.json \
  --label-a v1 --label-b v2
v2 wins 31 of 44 decisive comparisons (70%, 95% CI 56–82%): **v2 is better** (sign test p = 0.010)

- v2 better: 31
- v1 better: 13
- Ties: 6 (of which 2 changed verdict when the order was swapped)

Cases where v1 beats v2 (look here before shipping v2):
- case_12: v2 drops the currency from the amount
...

(Example output.) Prompts can use {input} and {context} placeholders, or be a system prompt. Compare two models with --model-b, or compare existing answers (say, exported from production) by giving each case output_a and output_b. In CI, --fail-if-worse exits with code 1 when B is a significant regression.

Check an answer against its sources

EvalPen splits the answer into atomic claims, then checks each one against the sources only: supported, contradicted, or unverifiable.

export ANTHROPIC_API_KEY=...        # or OPENAI_API_KEY, or run Ollama locally for free
uvx evalpen faithfulness \
  --answer answer.txt \
  --sources doc1.md doc2.md \
  --judge anthropic:<model-id>
Faithfulness: **67%** of 3 claims supported by the sources (judge: anthropic:<model-id>)

- Supported: 2
- Contradicted: 0
- Unverifiable: 1

Not found in the sources (possible hallucinations):
- Gustave Eiffel designed it alone.
  - No source names the designer.

(Example output.) --answer and --sources take file paths or plain text. Add --fail-below 0.9 to fail a CI job when too many claims are unsupported.

Judge models are written provider:model:

Provider Example Key
Anthropic anthropic:<model-id> ANTHROPIC_API_KEY
OpenAI or any compatible API openai:<model-id> OPENAI_API_KEY (+ OPENAI_BASE_URL)
Ollama (local, free) ollama:<model-name> none

Set EVALPEN_JUDGE to skip --judge every time. Replies are cached in ~/.cache/evalpen, so re-running the same check costs nothing (--no-cache or EVALPEN_NO_CACHE=1 to disable).

Calibrate your judge

Give it a JSONL file where each line has a human label and your LLM judge's label:

{"id": "case_01", "human": "pass", "judge": "pass"}
{"id": "case_05", "human": "fail", "judge": "pass"}
uvx evalpen calibrate examples/judge_vs_human.jsonl
Judge calibration on 20 examples: **reliable**

- Raw agreement: 85% (95% CI 64%–95%)
- Cohen's kappa: 0.69 (substantial)
- Threshold used: kappa >= 0.6

Disagreements (3):
- case_05: human='fail', judge='pass'
...

Add --fail-if-unreliable to exit with code 1 in CI when kappa is below 0.6.

In your agent (MCP)

All tools are available to your agent through the MCP server:

claude mcp add evalpen -e EVALPEN_JUDGE=anthropic:<model-id> -e ANTHROPIC_API_KEY=... -- uvx evalpen mcp

Then ask: "Check whether this answer is supported by these documents."

No install: the EvalPen skill

For people who use Claude in the browser rather than Claude Code, skills/evalpen/ packages the same methods as a skill: claim-by-claim faithfulness, order-swapped comparison, calibration and alignment with a holdout, test set building. Claude acts as the judge and a small bundled script computes every statistic. Add the folder as a skill in Claude, then ask, for example, "Compare these two prompts on these cases with the EvalPen method."

Trade-off: with the skill the judge is always Claude and nothing is cached, so results are less reproducible than with the MCP server or CLI.

Self-host for your team

Companies can run EvalPen inside their own cloud and add it to Claude as a remote MCP connector. Data never leaves the company: EvalPen only talks to the judge model you configure (typically your internal LLM gateway).

docker build -t evalpen .
docker run -p 8000:8000 \
  -e EVALPEN_AUTH_TOKEN=change-me \
  -e EVALPEN_JUDGE=openai:<model> \
  -e OPENAI_BASE_URL=https://llm-gateway.internal/v1 \
  -e OPENAI_API_KEY=... \
  -e EVALPEN_LOCK_JUDGE=1 \
  evalpen
  • MCP endpoint: https://<your-host>/mcp (put it behind your usual HTTPS load balancer)
  • Health check: GET /healthz, open without auth, for load balancers and Kubernetes probes
  • Stateless: run as many replicas as you need, no shared session store
Variable Purpose
EVALPEN_AUTH_TOKEN Shared secret. Clients send Authorization: Bearer <token>. Required when binding to a network address.
EVALPEN_ALLOW_NO_AUTH=1 Skip the token only if a gateway in front already authenticates users (SSO proxy).
EVALPEN_ALLOWED_HOSTS Comma-separated hostnames to accept (DNS-rebinding protection).
EVALPEN_JUDGE Default judge model.
EVALPEN_LOCK_JUDGE=1 Callers cannot pick another judge: every evaluation goes through the approved model.
EVALPEN_CACHE_DIR Reply cache location (/data/cache in the image; mount a volume to keep it).

Without Docker: evalpen mcp --http --host 0.0.0.0 --port 8000 with the same variables.

Usage (planned for v0.1)

The commands below are the target interface. They may change.

In your agent (MCP + skill)

claude mcp add evalpen -- uvx evalpen mcp

Then just ask: "I changed the classification prompt. Compare it with the old one on my test cases." The agent calls compare_prompts, summarizes the regressions, and can fix the prompt and re-run.

From the terminal (CLI)

evalpen compare prompts/v1.txt prompts/v2.txt --cases tests.jsonl

From Python

from evalpen import compare, check_faithfulness, get_llm

judge = get_llm("anthropic:<model-id>")
result = compare(prompt_a, prompt_b, cases="tests.jsonl", judge=judge)
report = check_faithfulness(answer, sources=docs, judge=judge)  # works today

In CI (block regressions before merge)

- run: evalpen compare main.txt pr.txt --cases tests.jsonl --fail-if-win-rate-below 0.5

Architecture

  MCP + skill     CLI      Python API      CI
        \          |           |          /
         ──────  evalpen core library  ──────
         create_eval_set · compare_prompts
         check_faithfulness · calibrate_judge
         runner · judge · stats
            /                        \
     local files (JSONL)        LLM APIs (your key)

All logic lives in the core library. The CLI, MCP server, skill and CI check are thin layers on top.

Roadmap

  • Core library + CLI + MCP server skeleton
  • calibrate_judge + Cohen's kappa (v0.0.1)
  • check_faithfulness + LLM layer (Anthropic, OpenAI-compatible, Ollama) with caching (v0.0.2)
  • create_eval_set from logs or a description, and the EvalPen skill (v0.1.0)
  • Hosted mode: HTTP transport, bearer auth, health check, Dockerfile (v0.0.3)
  • align_judge: automatic rubric improvement checked on a holdout, evalpen grade (v0.0.4)
  • compare_prompts: order-swapped pairwise judging, Wilson CI, sign test, --fail-if-worse (v0.0.5)
  • Batch evaluation tool (many answers in one call)
  • Native AWS Bedrock and Google Vertex judges
  • GitHub Action
  • Demo dataset, GIF, tests
  • v0.1 release: PyPI + MCP registry

Background

Built by an AI engineer who shipped LLM classification and recommendation systems at scale, where every release was validated with human review plus LLM-as-a-judge. EvalPen packages that workflow so anyone can use it from their agent.

License

MIT

Metadata

Release files for evalpen 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evalpen 0.1.0
File Size Uploaded Provenance Actions
evalpen-0.1.0.tar.gz 115.0 kB With provenance Details for evalpen-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evalpen 0.1.0
File Interpreter ABI Platform Actions
evalpen-0.1.0-py3-none-any.whl Python 3 none any Details for evalpen-0.1.0-py3-none-any.whl

Total release size: 152.9 kB

Release files / evalpen-0.1.0.tar.gz

Download URL evalpen-0.1.0.tar.gz
Size 115.0 kB
Tags Source
SHA-256 checksum
How to use checksums
229b2f63735e3f26ac28677953c5c55bdf02541e990618dc178eb6525142bf62
BLAKE2b-256 checksum
How to use checksums
d206fd217a493386ff5dfe4ff7c6504f32a0274a2bd7528febcdd33d2da433fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / evalpen-0.1.0-py3-none-any.whl

Download URL evalpen-0.1.0-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d45c7e0d35f4898c2ac3139f8a1fd9372deceb172c003451c49712597c45756f
BLAKE2b-256 checksum
How to use checksums
145f7ae6a6e613232be21125479432122e5dacd6129274f641e5db7780c15b78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for evalpen 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for evalpen-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page