Evaluating LLM Coding Agents for Real-World Software Engineering
Traditional code-generation benchmarks focus on whether a model can generate a function that passes unit tests. Real software development is broader: an agent must understand an existing repository, locate defects, modify multiple files, run tests, interpret failures, and deliver a change that can be reviewed and merged. This article presents an evaluation framework centered on task completion, covering terminal execution, multi-file changes, regression risk, long-context utilization, staged execution, observability, and practical team adoption.
1. Why Evaluation Criteria Are Changing
Code-generation models have traditionally been evaluated by asking them to generate a function from a natural-language description and then checking the result with unit tests. This approach measures local generation quality and works well for tasks with clear boundaries, such as algorithm problems and function completion.
Real-world development is rarely that simple. Developers must first understand a repository’s directory structure and dependencies, locate a defect, modify multiple files, run tests, interpret failure messages, iterate on the implementation, and finally deliver a change that can be merged. Systems that can complete this workflow are generally referred to as coding agents. Unlike code-completion tools, coding agents decide what to do next and continue calling tools until the task is complete.
As a result, coding-agent evaluation should shift from asking “What code did the model generate?” to asking “What task did the model complete?” The following sections describe the main capability dimensions.
2. Task Execution in a Terminal Environment
Terminal-based evaluations examine how a model behaves in a command-line environment. A typical task includes the following steps:
- Read the requirements and repository documentation
- Use search and file-inspection commands to locate relevant code
- Build the project, install dependencies, and run tests
- Interpret error output and decide what to do next
- Determine whether the task is complete within the step limit and exit proactively
These steps correspond to several distinct capabilities.
The first is correct tool usage, including whether parameters follow the required format and whether commands can be executed successfully. The second is state tracking. The model must remember which files it has already modified and avoid repeating ineffective operations. The third is error recovery. When it encounters insufficient permissions, missing dependencies, or test failures, it should try alternative repair paths instead of repeatedly issuing the same command. The fourth is termination judgment. The model should stop only after the problem has actually been resolved, rather than declaring success prematurely.
A single aggregate score can hide these differences. The same model may achieve significantly different results across task sets, sandbox configurations, and step limits. Therefore, directly comparing scores across evaluation frameworks is often unreliable. Readers should examine the detailed evaluation settings rather than relying on rankings alone.
The following simplified framework shows how an execution process can be recorded:
function run_agent_on_task(agent, task, max_steps):sandbox = task.prepare_isolated_sandbox()history = []tool_errors = 0steps = 0while steps < max_steps:action = agent.next_action(task.description, history)if action.type == "finish":breakobservation = sandbox.execute(action)if observation.is_error:tool_errors += 1history.append((action, observation))steps += 1passed = task.verify(sandbox)return {task: task.id, passed: passed, steps: steps, tool_errors: tool_errors}
This pseudocode highlights two important points.
First, tasks must run in isolated sandboxes because model-generated commands can have unexpected side effects. The sandbox should use least-privilege access, avoid mounting real credentials, and remain disconnected from production environments.
Second, evaluation results should include the number of steps, the number of tool errors, and the final verification result. These metrics make it easier to analyze why a task failed.
3. Multi-File Changes and Regression Risk
Fixing a problem often requires changes across multiple files. This creates a common risk: the target test passes, but existing functionality is broken. Many changes that appear successful merely bypass an error without addressing its underlying cause.
When evaluating multi-file modification capabilities, consider the following metrics:
- Hidden-test pass rate. Use test cases that the model has not seen to reduce overfitting to known tests.
- Regression rate. Run the project’s complete existing test suite and count the cases that passed before the change but failed afterward.
- Minimality of changes. Track the number of modified files and lines. Unrelated formatting changes, renames, and broad rewrites should reduce the score.
- Reviewability. Assess whether the change includes a clear explanation and whether it is easy for a human to inspect and roll back.
In team environments, model-generated changes can be submitted on a separate branch for human review before merging. Manual review should remain mandatory for changes involving high-risk areas such as authentication, payments, and data migrations.
4. Long Context: Capacity Is Not the Same as Utilization
Some models support very large context windows and can accept many files, documents, or historical records in a single request. This is attractive for large projects and multi-file research tasks. Developers do not need to manually split the material, and analysts can compare multiple reports within one conversation.
However, context-window length only indicates how much input a model can receive. It does not guarantee that the model can accurately use every piece of information. Three issues deserve particular attention.
First, important evidence can be buried. When the input contains large amounts of irrelevant material, the model may overlook an important passage in the middle or be misled by similar but unrelated code.
Second, consistency can decline across multiple reasoning turns. As a conversation grows longer, the model’s memory of early constraints may weaken, causing contradictions between earlier and later conclusions.
Third, cost and latency generally increase with input length. Each request must process the full context, increasing both expense and response time.
A more reliable approach is to filter information before supplying it to the model. Common techniques include keyword- and semantic-based retrieval, loading only files related through the dependency graph, and splitting large tasks into multiple stages. The following example illustrates how to assemble context under a fixed budget:
function build_context(query, index, budget_tokens):candidates = index.search(query, top_k: 30)sorted_candidates = sort candidates by score, descendingselected = []used = 0for chunk in sorted_candidates:cost = estimate_tokens(chunk.text)if used + cost > budget_tokens:continueselected.append(chunk)used = used + costreturn selected
The core idea is to define an explicit token budget and prioritize content most relevant to the task. The appropriate budget depends on model pricing, task complexity, and the latency that the team can accept.
5. Staged Execution and Observability
For complex tasks, a staged workflow is generally more reliable:
- Planning: Identify the modules involved and the expected changes based on the requirements.
- Localization: Retrieve and inspect relevant code to confirm the source of the problem.
- Modification: Update files according to the plan and run focused tests after each change.
- Validation: Run the complete test suite, check for regressions, and generate a change summary.
Staged execution allows the output of each phase to be inspected. Errors can be detected early instead of accumulating until the final result.
At the same time, teams should record each action, observation, token usage, and elapsed time. These logs help analyze failures and support auditing and cost accounting. Logs may contain code snippets or internal paths, so access controls should be applied during storage. Secrets and personal information should not be recorded.
6. Recommendations for Team Adoption
Teams planning to introduce coding agents can follow these steps:
- Build an evaluation set from internal repositories and include historically resolved defects so that the benchmark reflects real work.
- Fix the execution environment, step limit, and random seed. Run each task multiple times and examine the distribution of success rates rather than relying on a single run.
- Track pass rate, regression rate, token usage, and elapsed time together. Avoid optimizing only for success rate while ignoring cost.
- Start with lower-risk tasks, such as adding tests, correcting documentation errors, and organizing log formats, before expanding the scope.
- Keep human review for all automatically generated changes, especially those involving security, permissions, and data.
The purpose of evaluation is to determine whether a model can reliably complete work in a team’s specific environment. Public leaderboards can provide useful reference points, but final adoption decisions should be based on the team’s own data.
