The first time I claimed an Anthropic workflow was “working,” I had tested it on three examples I had written myself. All three looked good. A week later a real customer document arrived that used slightly different terminology and an unusual date format. The structured summary missed a required field, the triage priority was wrong, and the research assistant cited a source that did not support its claim. I had no systematic way to know how often those failures happened or whether a prompt change made them better or worse.
That is the moment most teams discover they need an evaluation set. This post builds the smallest useful version of one. We will define a handful of test cases, run them through a fixed Anthropic workflow, score the results, and store enough detail that we can compare two versions of the same prompt side by side. No large benchmark suite, no automated red-teaming platform—just a concrete dataset you can grow over time.
As always:
Build the smallest useful version, then test what breaks.
What You Will Have Working by the End
A simple schema for an evaluation example
A small starter dataset (ten cases is enough to begin)
A runner that executes each case against your workflow and records the output
A basic scoring function that marks pass / fail with a short reason
A comparison view so you can see whether a change improved or hurt the results
Three realistic failure modes and how to notice them early
The goal is a feedback loop you actually run before you change a prompt in production.
What Belongs in an Evaluation Example
Every example needs at least four pieces of information:
A unique ID
The input the system will receive
The expected behavior or expected output (the “gold” standard)
A short note about why this case exists (the failure mode it is trying to catch)
Optional but useful fields include tags (for example billing, long-document, edge-case) and a difficulty label.
Here is a minimal Python shape:
Python
from dataclasses import dataclass, field
from typing import Any
@dataclass
class EvalExample:
id: str
input_text: str
expected: dict[str, Any] # what “correct” looks like
notes: str = ""
tags: list[str] = field(default_factory=list)For a structured summarizer the expected field might contain the required keys and a few content constraints. For a triage workflow it might contain the expected category and priority. For a research assistant it might contain the document IDs that must be cited.
A Starter Dataset (Ten Cases)
We will evaluate the structured document summarizer from an earlier post. The schema we expect is:
JSON
{
"title": "string",
"one_sentence_summary": "string",
"key_points": ["string"],
"sentiment": "positive" | "neutral" | "negative"
}Here are ten examples that cover ordinary cases and a few known failure modes:
Python
EVAL_SET = [
EvalExample(
id="sum-001",
input_text="Acme Corp reported Q3 revenue of $42M, up 18% year-over-year. Management remains optimistic.",
expected={
"must_include_keys": ["title", "one_sentence_summary", "key_points", "sentiment"],
"sentiment_in": ["positive", "neutral"],
"min_key_points": 1
},
notes="Happy-path positive earnings release",
tags=["happy-path", "finance"]
),
EvalExample(
id="sum-002",
input_text="The product launch was delayed for the third time due to supply-chain issues. Customers are frustrated.",
expected={
"must_include_keys": ["title", "one_sentence_summary", "key_points", "sentiment"],
"sentiment_in": ["negative", "neutral"],
"min_key_points": 1
},
notes="Clearly negative tone",
tags=["sentiment", "negative"]
),
EvalExample(
id="sum-003",
input_text="Meeting notes: discussed roadmap, no major decisions, next sync scheduled for Friday.",
expected={
"must_include_keys": ["title", "one_sentence_summary", "key_points", "sentiment"],
"sentiment_in": ["neutral"],
"min_key_points": 1
},
notes="Neutral, low-information document",
tags=["neutral", "low-signal"]
),
EvalExample(
id="sum-004",
input_text="",
expected={
"must_include_keys": ["title", "one_sentence_summary", "key_points", "sentiment"],
"allow_empty_summary": True
},
notes="Empty input – should not crash",
tags=["edge-case", "empty"]
),
EvalExample(
id="sum-005",
input_text="x" * 50,
expected={
"must_include_keys": ["title", "one_sentence_summary", "key_points", "sentiment"]
},
notes="Nonsense input – model should still return valid schema",
tags=["edge-case", "noise"]
),
# ... add five more cases that reflect failures you have already seen
]Ten cases are enough to start. The most valuable examples are the ones that previously broke your system in production or in manual testing. Every time you find a new failure, add a case that captures it.
The Runner

The runner executes each example against the real workflow function and stores the raw output plus a pass/fail judgment.
Python
import json
from datetime import datetime, timezone
def score_summary(output: dict | None, expected: dict, error: str | None) -> tuple[bool, str]:
"""Return (passed, reason)."""
if error:
return False, f"Execution error: {error}"
if not isinstance(output, dict):
return False, "Output is not a dictionary"
for key in expected.get("must_include_keys", []):
if key not in output:
return False, f"Missing key: {key}"
if "sentiment_in" in expected:
if output.get("sentiment") not in expected["sentiment_in"]:
return False, f"Sentiment {output.get('sentiment')} not in {expected['sentiment_in']}"
if "min_key_points" in expected:
points = output.get("key_points", [])
if not isinstance(points, list) or len(points) < expected["min_key_points"]:
return False, f"key_points too short or not a list"
return True, "passed"
def run_evaluation(eval_set: list[EvalExample], workflow_fn) -> list[dict]:
"""Run every example and return a list of result records."""
results = []
for example in eval_set:
print(f"Running {example.id}...")
error = None
output = None
try:
output = workflow_fn(example.input_text)
except Exception as e:
error = f"{type(e).__name__}: {e}"
passed, reason = score_summary(output, example.expected, error)
results.append({
"id": example.id,
"passed": passed,
"reason": reason,
"output": output,
"error": error,
"notes": example.notes,
"tags": example.tags,
"ran_at": datetime.now(timezone.utc).isoformat()
})
return resultsThe workflow_fn is whatever function you already use in production (for example summarize_with_retry from the structured-summarizer post). The evaluation set should call the same code path the real system uses.
Looking at the Results
Python
def print_report(results: list[dict]):
total = len(results)
passed = sum(1 for r in results if r["passed"])
print(f"\n=== Evaluation Report ===")
print(f"Passed: {passed}/{total}")
print()
for r in results:
status = "PASS" if r["passed"] else "FAIL"
print(f"[{status}] {r['id']}: {r['reason']}")
if not r["passed"] and r["output"]:
print(f" Output: {json.dumps(r['output'])[:120]}...")
if r["error"]:
print(f" Error: {r['error']}")A single number (pass rate) is useful. The per-example reasons are more useful. When a change drops the pass rate, the individual failure messages tell you what to fix.
Comparing Two Versions
The whole point of an evaluation set is to compare. After you change a prompt or a schema, run the same set again and diff the results.
Python
def compare_runs(before: list[dict], after: list[dict]):
before_map = {r["id"]: r for r in before}
after_map = {r["id"]: r for r in after}
print("\n=== Comparison ===")
for id_ in sorted(before_map.keys()):
b = before_map[id_]
a = after_map.get(id_)
if a is None:
continue
if b["passed"] and not a["passed"]:
print(f"REGRESSION {id_}: was pass, now fail – {a['reason']}")
elif not b["passed"] and a["passed"]:
print(f"IMPROVEMENT {id_}: was fail, now pass")
elif not b["passed"] and not a["passed"]:
print(f"STILL FAIL {id_}: {a['reason']}")Regressions are the signal you care about most. An evaluation set that cannot show regressions is not yet useful.

Three Failure Modes Worth Testing Early
1. The Dataset Only Contains Happy Paths
If every example is a clean, well-formed document, the evaluation will stay green while production breaks on noisy input. Deliberately add empty inputs, very short inputs, and documents written in a different style from your original examples.
2. The Scoring Function Is Too Loose
A scorer that only checks for the presence of keys will pass outputs that are semantically wrong. Add at least one content constraint (allowed sentiment values, minimum number of key points, required source IDs, etc.) so that “valid JSON” is not treated as “correct.”
3. The Evaluation Calls a Different Code Path
If the evaluation uses a simplified prompt or skips the retry logic that production uses, the results will not predict production behavior. Always call the same function the real system calls.
I have been burned by all three. The fix in each case was the same: make the dataset reflect real failures, make the scorer reflect real requirements, and make the runner call the real code.
Practical Rules for Growing the Dataset
Add a case every time you observe a production failure or a surprising manual test result.
Prefer a small, high-signal set you actually run over a large set you never look at.
Version the dataset (even if only with a date in the filename) so you can reproduce older evaluation runs.
Store the full model output, not only the pass/fail bit. When something regresses you will want to see exactly what changed.
Re-run the full set before any prompt or schema change that will reach users.
What This Evaluation Setup Does Not Do Yet
It does not:
Measure latency or cost alongside quality
Support graded (0–1) scores instead of binary pass/fail
Automatically expand the dataset with model-generated adversarial examples
Integrate with a continuous-integration pipeline
Compare multiple models in one run
Those capabilities belong to later testing posts. The goal today is a concrete dataset and a runner you will actually use.
Verification Checklist
Run the starter set against your summarizer and confirm you receive a pass/fail result for every example.
Intentionally break the system prompt and confirm the report shows new failures.
Restore the prompt and confirm the comparison view shows the recoveries.
Add one new edge-case example that previously caused a production issue and confirm it is scored correctly.
Inspect a failing result and confirm the stored output and error message are sufficient to diagnose the problem.
If all five steps pass, you have a working first evaluation dataset.
Update Note
Model behavior and structured-output helpers continue to change. Always verify the current recommended model ID in the official Anthropic documentation. The evaluation pattern itself—fixed examples, real code path, explicit scoring, and regression comparison—remains useful regardless of those surface changes.
Looking Ahead
The next post examines how to test structured outputs when the model sometimes deviates from the schema. We will add more precise validation, controlled retries, and a clearer picture of which failures are prompt problems versus model limitations. Once you have a small evaluation set, those measurements become straightforward.
Keep the evaluation runner. When you later change a prompt, a schema, or a model version, you will already have a fast way to know whether the change helped, hurt, or did nothing at all.
Build the smallest useful version, then test what breaks.
— Caleb Fletcher
Boise, Idaho

No feedback yet — submit the first.