Skip to content

Turn real tickets into tasks the agent either passes or fails

An evaluation starts with tasks drawn from real work, each with a grader that decides pass or fail without a person looking. For a bug-fixing agent that means a ticket, the code as it was, and hidden checks the fix must pass. Ten tasks with graders beat a hundred demos nobody can rerun.

20 MIN

By AIAgentInterviews · Updated

TL;DR: Build the task set from real tickets, freeze the code each ticket was filed against, and attach a grader that runs hidden checks on the agent's fix. Pass or fail, no partial credit, no person in the loop. Then the evaluation can be rerun on every change.

Where you are. Module one, lesson one. Everything later in the course measures something about this task set.

"It seems fine" is not a measurement

Bramble's engineers tried their bug-fixing agent on a handful of tickets, liked what they saw, and turned it on. A month later someone asks whether last week's prompt change made it better or worse. Nobody can answer, because nothing was written down in a form that can be run again: which tickets, what counted as fixed, who decided.

An evaluation is the thing that can answer that question. It has three parts, and the first two are this lesson: a set of tasks, and a grader for each task. The third, repeated runs with a reported denominator, is module two.

In plain language. A task is a frozen problem and starting environment. A trial is one attempt at it. A grader is the rule that decides what the attempt demonstrated. Running one task repeatedly increases trials, not the variety of problems tested.

Where tasks come from

Take tasks from work the agent will actually do. For Bramble that is closed bug tickets in the billing service: each one has a description written by a person, the code as it was when the ticket was filed, and the fix a person eventually made. Invented tasks are tempting because they are quick to write, but they test what you imagined the agent would face, and agents fail on what you did not imagine.

Freeze each task completely. The repository at the ticket's commit, the dependency versions, the test data. If the code under a task changes between runs, a different score might mean the agent changed or the task changed, and you will not know which.

Keep the set small at first and grow it from failures. Ten good tasks you can rerun on every change are worth more than two hundred you run once a quarter. Every time the agent fails in production, the ticket becomes a task.

A grader for each task

A grader decides pass or fail with no person involved. For a bug fix the natural grader is a set of checks the fix must pass that the agent never sees: the inputs from the ticket that were wrong, plus nearby inputs that were right and must stay right.

def load(source, name):
    """Run a patched function's source in a fresh namespace and return it."""
    namespace = {}
    exec(source, namespace)
    return namespace[name]

TASKS = [
    {"id": "BR-101", "ticket": "Late fee is charged on the due date itself.",
     "fn": "late_fee",
     "checks": [((0, 5000), 0), ((1, 5000), 250), ((10, 5000), 500)]},
    {"id": "BR-102", "ticket": "Invoice total ignores the discount on zero-tax lines.",
     "fn": "total",
     "checks": [(([(1000, 0.0)], 100), 900), (([(1000, 0.2)], 0), 1200)]},
]

def grade(task, patch):
    """Outcome grader: the hidden checks pass, or the task fails. No partial credit."""
    try:
        fn = load(patch, task["fn"])
        return all(fn(*args) == want for args, want in task["checks"])
    except Exception:
        return False

PATCHES = {
    "BR-101": "def late_fee(days, amount):\n"
              "    return 0 if days <= 0 else min(500, 250 * days)\n",
    "BR-102": "def total(lines, discount):\n"
              "    return sum(round(c * (1 + t)) for c, t in lines) - discount\n",
}

results = {t["id"]: grade(t, PATCHES[t["id"]]) for t in TASKS}
print(results)  # => {'BR-101': True, 'BR-102': True}

BROKEN = "def late_fee(days, amount):\n    return 250 * days\n"
print(grade(TASKS[0], BROKEN))  # => False

The late-fee task checks the day of the bug (zero days late, no fee), a normal case and the cap. A fix that removes the fee on the due date but breaks the cap fails, which is the point: the grader encodes what "fixed" means, including what must not break. The broken patch at the end charges a fee on the due date and has no cap, and the grader says so without anyone reading it.

Rules that keep a grader honest

Hide the checks. If the agent can read the grader, it can write code that satisfies the checks rather than fixing the bug. Lesson two catches the worse version of this, where the agent edits the visible tests.

No partial credit. "Three of four checks pass" invites arguments about whether the fourth mattered. If it did not matter, remove it; if it did, the task failed.

Grade the result, not the explanation. Agents describe fixes confidently whether or not they work. The grader runs code.

Write down what the grader cannot see. Hidden checks on one function cannot tell whether the agent also broke something else in the file, or edited ten unrelated files. That gap is lesson two.

FROM TICKET TO SCORE
One task, frozen and graded the same way every time

The agent sees the ticket and the code. It never sees the checks.

What each stage fixes in place

What was actually wrong

from real work, not imagination

The same starting point

repository, dependencies, data

The agent's patch

and its trajectory, for lesson two

Pass or fail

no person, no partial credit

When a grader cannot be code

Some tasks have no executable check: a summary of a ticket thread, a reply to a customer. Those need a judge, which may be a person or a model with a rubric, and a judge has to be measured against people before you trust it. The concept page on calibrating a judge covers that. For a coding agent, prefer executable checks wherever they exist, because they are cheap, fast and do not drift.

Turn an ambiguous ticket into observable checks

Bramble receives a synthetic ticket: “The invoice total is wrong when a line is discounted.” That sentence does not specify rounding, whether the discount applies before tax, or what should happen with an empty invoice. A grader cannot resolve those product decisions by observing the agent's patch.

Choose an explicit fixture contract. For this example, amounts are integer minor units, the discount is a fixed amount subtracted from one line, and tax is outside the task. A line worth 1,200 with a discount of 200 contributes 1,000. An undiscounted line still contributes its original amount. State these assumptions in the task definition before asking an agent to fix it.

Use one check that fails on the broken implementation and one that protects unaffected behavior. Then add a different discounted line so the agent cannot pass by hardcoding the first total. Keep expected values separate from the implementation being graded; computing the expected result by calling the same faulty function would reproduce its mistake.

The task package needs the repository revision, fixture data, allowed scope and grading command. If a dependency fails to install, record an environment error. Counting it as an incorrect patch confuses the agent's capability with whether the evaluation could run at all.

What if · interview follow-ups

Change one condition

A ticket says that discounted invoice totals are wrong, but its business rule is incomplete.

  1. Start here

    Can you let the agent choose a rounding rule and grade against whatever it implements?

Do this before moving on

Pick five closed tickets from work your agent would do. For each, write down the commit it was filed against, two checks that fail before the fix and pass after, and one check that must pass both before and after. If you cannot write a check for a ticket, note why; that ticket needs a judge, not code.

Review your result. Keep the broken revision, accepted rule, expected values and test inventory. Show a failure on the original bug, a pass on the intended fix, and a failure on a plausible wrong fix.

Go deeper

Key takeaways

  • Draw tasks from real work and freeze everything each task depends on.
  • Every task gets a grader that decides pass or fail with no person involved.
  • Hide the checks, give no partial credit, and grade the result, not the explanation.
  • Write down what each grader cannot see; that gap is where the next check goes.

Check yourself

Answer aloud or on paper before revealing. Producing the explanation unaided is exactly what a panel listens for.

  1. 1The agent can read the hidden checks during its run. What is the risk?

  2. 2Why freeze the repository at the ticket's commit rather than running every task against the current main branch?

  3. 3A fix passes three of four hidden checks. How should it be scored?

Sign in to track which lessons you have finished.