Evaluating and Deploying Long-Horizon Coding Agents
Writing a function is not the same as shipping a change. This article explains why coding agents should be judged on long, constrained terminal workflows—not single-turn answers—and how to design evaluations, capability breakdowns, and production controls that measure real delivery.
Why “can write code” is not the same as “can ship”
Many coding tools look stable in a single turn: complete a function, explain an error, patch a local snippet. Real engineering rarely stops there. A delivery usually means reading a repo, finding the entry point, changing multiple call sites, adding tests, installing dependencies in a terminal, running a build, and iterating from failure logs. Steps carry state: later work depends on earlier files, processes, and exit codes. If any link drops context or misreads the environment, the whole chain fails.
So evaluation should shift from “does this one generation look like the right answer” to “can the agent finish a long chain on its own in a constrained environment.” Long-horizon means the task spans many decisions and intermediate results change later strategy. Constrained means compute, network, permissions, time, and observable information are not unlimited. When both are true, planning, tool use, and self-correction are actually tested.
Evaluate against a real terminal, not only static questions
A useful industry pattern is to place the agent in a near-production terminal: only a task brief and initial code, no prescribed solution path, and independent tests for each task. Pass criteria should be executable assertions—tests green, a service starts, an output file matches a format—not a human sense that the code “looks good.”
Cover at least four kinds of constraint.
- Information. Repos are large; the model cannot assume it read every file. It must search, narrow scope, and open only relevant modules.
- Resources. Dependency installs can fail; disk and duration are capped; network policy may allow only specified sources. The agent should change strategy after failure instead of repeating the same command.
- State. Edits persist in the workspace. Bad patches, leftover processes, and half-installed dependencies pollute later steps. Evaluation should check whether the agent cleans up or continues from the current state, not pretend the environment is still initial.
- Acceptance. Each task has dedicated tests. Partial pass is not complete. That reduces high scores from lots of explanation and little delivery.
When comparing systems, a single total score is not enough. Look at task mix: isolated algorithm patches, cross-module refactors, environment debugging, and long-chain feature work are not equally hard. Leading only on short tasks does not imply fitness for multi-hour changes.
Breaking down long-horizon coding skill
Splitting the skill is more useful than saying the model is “smarter.”
Goal understanding. Briefs are often vague—“make the build pass” or “fill in missing interfaces.” The agent should first turn acceptance into checkable items: which commands must succeed, which files may change, which behavior must not regress. A plan without acceptance criteria cannot detect drift.
Search and localization. In a large codebase, find entry points, call chains, and test fixtures before editing. A typical effective pattern: shrink candidate files with symbol or text search, read interfaces and tests, confirm invariants, then generate a patch. Large rewrites first have the highest regression cost.
Incremental change. Split long work into small, reversible steps. Each step should change one verifiable behavior and immediately run the most relevant tests. Failures then map to the latest edit instead of a mixed diff across dozens of files.
Environment actions. Terminal commands are actions, not decoration. The agent needs exit codes, stderr, working directory, and virtualenvs. On install failure, read the actual error and distinguish network, version conflict, and permissions—not rerun the same install.
Memory and handoff. Context windows are finite. On long tasks, externalize confirmed facts: current hypotheses, files changed, commands run, still-failing assertions. Later turns should read this short state rather than replay every log. That is technical task state, not secrets in logs.
Failure recovery. In long-horizon evals, the first plan often fails. Recovery quality separates systems more than first-answer quality: drop a bad hypothesis, shrink reproduction, revert only the broken change while keeping verified parts.
A practical evaluation design
When a team builds its own long-horizon coding eval, ranking a public leaderboard is optional; tasks should represent your repos. Each item can include five parts.
- An initial repo or minimal project with pinned dependency versions.
- A task description of goals and constraints only—no step-by-step commands.
- Hidden or delayed acceptance tests so the agent cannot memorize answers.
- Resource limits: duration, command count, network policy.
- Scoring: acceptance pass is complete; also log steps, fraction of useless commands, and whether unrelated tests broke.
Layer difficulty. Short tasks check basic tool use; medium tasks require two or three modules plus tests; long tasks require shipping a feature under incomplete docs and handling dependency or config errors. Report those buckets separately so one score does not hide gaps.
Prevent leakage. If tasks and tests stay public without variants, systems may memorize surface patterns. Periodically change data, interface names, and injected failure points so you measure skill, not memory.
An illustrative acceptance script (approach only, not tied to a platform):
set -euo pipefail# Checks after applying the candidate change in a clean workspacetest -f src/app.pypython -m pytest tests/test_feature.py -qpython -m compileall -q src
The script should fail fast and keep full failure output for the next round. The harness records commands, exit codes, and diffs—not the model’s self-assessment.
Control points for production use
Passing eval is only a gate. Daily use still needs boundaries.
Least privilege. Default write access only to the task directory; no free access to secrets, production config, or other projects. For external dependencies, use reviewed artifact sources and pin versions.
Human–agent split. Agents fit reversible, testable work: adding tests, local bugfixes, extending interfaces in existing style. Data deletion, permission changes, releases, and money-related logic should wait for a human to review the diff and run results.
Observability. Keep the task goal, key commands, patches, and final test results for review. Do not write credentials, personal data, or internal addresses into long-lived traces.
Cost and time. Long loops amplify useless exploration. Cap rounds and duration per task; after repeated identical failures, stop and hand back to a human.
Regression protection. Before merge, run tests related to the change plus a smoke check of the main path. An agent claiming “done” does not replace automated acceptance.
How to read capability gains
Higher scores on internal long-horizon tasks usually mean better planning, tool choice, or recovery—not a business SLA. Ask: which task types improved, did that cost more commands and time, and do failures cluster in environment vs. logic? If only short tasks improve and long tasks still lose the goal mid-run, complex delivery may not get much help.
Do not compare different evals naively. Terminal permissions, network access, whether tests are visible, and timeouts all change difficulty. External communication should describe task definition and acceptance, not an isolated percentage. This article does not cite leaderboard numbers that were not aligned on the same protocol, so incomparable results are not treated as capability conclusions.
A practical checklist
When introducing or upgrading a coding agent, use questions like these instead of a demo.
- Can it turn a vague goal into checkable completion criteria without being given the steps?
- Can it locate first, then edit, and keep changes in relevant files?
- After failure, does it change strategy from exit codes and logs instead of repeating commands?
- Mid-task, does it keep a short, handoff-ready technical state?
- Under hidden tests, are completion rate, useless-action rate, and damage to other tests acceptable?
- Are permissions, time limits, audit, and human confirmation actually in the process?
Long-horizon coding is not generating longer code. It is holding a goal in a constrained terminal, managing state, and ending on objective tests. Design evals as acceptance under real constraints, then wire permissions and regression gates into engineering process, so you can tell whether an agent moved from writing fragments to shipping reliably.
