Ziqing Kerry Gao
← Writing

Designing Agent007: A Code Review Agent Built to Be Measured

Agent007 is my final project for Agentic Engineering at Columbia. It reviews Python pull requests on GitHub: /review posts structured findings, and /improve asks a coding agent to repair them. I’m building a single-agent baseline and a multi-agent version, then comparing both on CRAB, a benchmark that scores reviews by whether a coding agent can use them to make hidden tests pass.

My first spec and design doc followed the course template closely. They were correct and generic: many TBDs, vague targets, no numbers. This post covers the questions that turned them into a design I can defend.

Severity that means something

My first severity scale was low, medium, high, critical, defined by impact. Nobody could act on “medium.”

I looked at how industry does it. Google’s code review guide asks reviewers to label comment severity (Nit, Optional, FYI) so authors know what’s required. Claude Code Review uses three levels tied to the merge decision:

  • Important: an issue that should be fixed before merging.
  • Nit: a minor issue, worth fixing but not blocking.
  • Pre-existing: an issue present before the PR.

I adopted these, with confidence as a separate 0.0 to 1.0 score. Pre-existing findings stay out of /improve and the benchmark export, since CRAB’s tests only target what the PR changed.

How do you know multi-agent wins before building it?

The course wanted a target. My honest reaction: I can’t know until I build both.

That question reframed the target as a hypothesis, written down before the final run: multi-agent review improves CRAB pass rate by at least 3 percentage points over single-agent, with precision no lower. I report the result either way.

There’s no budget cap, but I record tokens and cost per review. Anthropic found that token usage alone explains 80% of performance variance in their research agent. If multi-agent wins only by spending ten times the tokens, the report should say so.

Limits from data

The prototype rejected PRs over 60,000 characters. I first wanted 10,000. Before deciding, I measured the 184 CRAB cases:

Input limitCases rejected
10,00084 (46%)
60,00017 (9%)
100,0009 (5%)
200,0003 (1.6%)

Rejected cases count as failures, so 10,000 would have sunk my own pass rate. I chose 200,000. Other limits followed the same way: 3 retries (the prototype had 0, which contradicted my own reliability requirement), 16,000 output tokens, a 15-minute job timeout, and at most 5 workers, following Anthropic’s 3 to 5 parallel subagents.

Reading the benchmark source

I assumed CRAB’s tests were human-written tests from each repo. Reading the pipeline code showed otherwise: an LLM generates each test from one human review comment, and the test must fail before the review and pass on the merged code. That changed how I describe a “pass” in the spec. Lesson: read the benchmark’s code before designing around it.

A small test set, stated honestly

CRAB has 184 final cases (234 tests). I split them with a recorded seed: 50 for development, 134 held out until the final run. On 134 cases, 3 percentage points is about 5 tests, so I treat differences as suggestive.

I considered generating more cases from SWE-CARE’s dev split (7,086 PRs). About 27% of PRs survive CRAB’s pipeline, and each needs an LLM filter, a Docker build, test generation, and a coding-agent run. With three weeks left, I deferred it to future work and reused PR-Agent’s released CRAB results as the external baseline, which cuts about a third of the scoring runs.

Design trade-off: fixed workers vs. grouped questions

The obvious multi-agent design is one worker per CRAB category. It’s simple and maps to the benchmark’s categories. It also runs 10 workers on a one-line fix, duplicates findings across overlapping categories like robustness and error handling, and splits questions that need shared context. My orchestrator instead turns relevant categories into PR-specific questions and groups questions that need the same evidence.

Safety by default

/improve commits only when required checks pass. Otherwise it saves a patch, including on repos with no checks. PR content is untrusted input, credentials are scoped to the step that needs them, and the human keeps the merge decision.

Notes

  • A time I changed a decision based on data: the input limit table above.
  • How I evaluate an agent: held-out test set, repeated trials (pass^3 on a 30-case subset), manual precision review, cost recorded per run.
  • When multi-agent isn’t worth it: when the gain disappears at matched token cost, or the task has few parallel parts.
  • A mistake I caught: misreading how CRAB’s tests are built, fixed by reading the source.
  • Scope under deadline: deferring new benchmark cases and reusing released baselines.

Next: implementing the tool-using single agent, then the orchestrator, then running the comparison. I’ll write up the results, including if multi-agent loses.