Can a coding agent repair its work in 10 seconds?
When an agent produces a patch, running a test can catch a bad answer. Repairing it takes another round trip. This experiment asks how often the agent can finish correctly within a 10-second interaction budget, and whether a shorter test report changes the outcome. The budget is an evaluation threshold. Every run records its actual completion time.
Run it yourself
Save benchmark.py and tasks.py in the same directory. Use Python 3.9 or newer.
python3 -B benchmark.py --replay > replay.json
Replay exercises the workflow without network access. For live results, configure CEREBRAS_API_KEY in your shell and use a model available to your account. This example uses the model and reasoning setting shown in the Cerebras Chat Completions reference.
python3 -B benchmark.py --model qwen-3.8-27b --reasoning-effort none --limit 2 > smoke.json
python3 -B benchmark.py --model qwen-3.8-27b --reasoning-effort none --repeats 3 > live.json
The full three-repeat run makes at most 300 requests. Keep the settings and seed with each report. The API receives the synthetic task contract, candidate patches, and any visible retry feedback.
How the harness works
Each task presents a one-line Python bug and three candidate replacement expressions. The model chooses one letter. The runner maps it to an expression supplied with the fixture, checks it locally, and may offer one more attempt. The held-out cases stay outside the prompts, including the repair prompt.
Task and candidates → model selects a patch → final scoring
│
verification modes
↓
Run visible test → on failure, give feedback
│ ↓
│ model selects again
└──────────→ final scoring
The three modes share the same tasks, candidate order, initial prompt, model settings, and final evaluator. A seeded shuffle interleaves modes and tasks to reduce ordering effects. The second and third modes differ only in their retry feedback.
| Mode | What happens after the first choice |
|---|---|
| One-shot | Score the submitted patch. |
| Full feedback | Check the visible case. On failure, retry with the complete structured test report and a failure summary. |
| Compact feedback | Check the same case. On failure, retry with the failed input, expected and actual values, and previous choice. |
Each report includes success counts, correct completions within budget, median and p95 wall time, model request wall time, local test time, remaining harness time, token usage when reported, and retry outcomes. Model request wall time includes network transit. Provider timing is stored separately when available. Final scoring runs outside the interaction timer for every mode.
What the replay verified
| Mode | Correct patches | Model calls exercised | Unsuccessful retries | Median retry feedback |
|---|---|---|---|---|
| One-shot | 4 of 20 | 20 | 0 | — |
| Full feedback | 16 of 20 | 36 | 4 | 233.5 characters |
| Compact feedback | 16 of 20 | 36 | 4 | 68 characters |
Replay choices are scripted. They confirm that the harness retries, scores the final choice, and emits shorter feedback in compact mode. Live effectiveness, token savings, and latency under the 10-second budget still need API measurements.
One replay failure comes from the ceiling-division task. For solve(7, 3), selecting the original floor-division expression produced 2 and the visible test expected 3. The runner returned that case to the model. The held-out cases include exact division and a negative numerator, so a candidate that happens to pass the visible check can still fail final scoring.
The candidate-choice format keeps each run reproducible and avoids executing model-generated code. It also narrows the conclusion to a known set of small repairs. On a live run, compare correct within budget first, then inspect where time went and which repairs still failed. A compact report is useful only if the model can recover at least as reliably with the context it receives.
