Evaluating LLMs and AI Agents for Coding: What to Verify Before Selection
This article explores how to evaluate large language models and AI agents for coding tasks from a general technical perspective. It provides actionable testing conditions, evaluation criteria for long-task self-iteration, comparisons between single-agent and multi-agent architectures, and a comprehensive selection checklist to help developers make data-driven decisions.
This article does not evaluate specific products. Instead, it explains what should be verified during model selection from a general technical perspective. Readers can directly apply the testing conditions and checklists provided in this article to their own environments.
I. Fixing the Testing Prerequisites First
The same model may perform very differently under varying conditions. Simply stating that a “model performs well” or “performs poorly” makes results irreproducible and difficult to compare with other solutions. Before testing, at least the following fields should be recorded:
- Model version and invocation method (e.g., IDE plugin, CLI tool, or direct API call).
- Testing framework, number of test cases, and case stability.
- Repository scale, including lines of code, number of modules, and dependencies.
- Permission scope (e.g., whether command execution, file read/write, and network access are allowed).
- Concurrency limits, per-task duration limits, timeout settings, and retry strategies.
- Budget limits, meaning the maximum Token consumption allowed per task or per day.
These fields serve both as conditions for reproducing experiments and as the foundation for subsequent cost accounting. If any item is missing, the test conclusion should be marked as “incomplete conditions.”
II. Long-Task Self-Iteration: Capabilities and Failures
Long-task self-iteration refers to the process where a model autonomously completes planning, coding, testing, and fixing after receiving macro-level instructions. This is fundamentally different from early tools that merely completed code snippets. Evaluation can be divided into two scenarios.
- Building a Web App from Scratch
The testing method involves providing a clear, macro-level requirement, such as building a web application to monitor earnings season. Observe whether the model outputs product planning, sample data structures, and front-end/back-end code.
Acceptance criteria include:
- The page runs normally and can be opened without manual modifications.
- The UI styling and interactions cover the key features specified in the requirements.
- The sample data structure is clear, with well-defined field meanings.
- Back-end logic requires human review and should not be treated as production-ready code directly.
In this scenario, the model can usually set up the scaffolding quickly. Developers can then use multi-turn prompts to supplement the back-end logic, reducing early-stage manual setup efforts. The exact time saved depends on requirement complexity and developer proficiency, which should be tested in your own projects.
- Test-Fix Loop in Local Projects
The testing method involves running test cases in an existing project, allowing the model to read error messages, automatically locate issues, modify code, and rerun tests.
The effectiveness of this loop depends on the following conditions:
- The test cases themselves are stable. If cases fail intermittently, the model may waste effort on unrelated issues.
- Error messages are complete. If there is only “run failed” without stack traces, the model cannot accurately locate the problem.
- Sufficient permissions. If the model cannot execute test commands or read dependencies, the loop will break at the first step.
- A limit on repair rounds. Without a limit, the model may repeatedly modify the same piece of code.
Common failure situations include: the modification scope exceeding the problem itself; passing tests after fixes but introducing new logic errors; or infinite retries due to missing dependencies. Therefore, during acceptance, you should not only check whether the final test passes but also verify whether the modification scope in each round is explainable.
III. Single Agent vs. Multi-Agent: When to Use Which
An Agent refers to a model system capable of calling tools and autonomously executing steps. Single-agent and multi-agent architectures have different suitable use cases.
The single-agent mode is suitable for handling single, coherent tasks. For example, parsing earnings report PDFs of S&P 500 companies, extracting key metrics like revenue and profit, comparing trends across quarters, and generating summaries. These tasks rely on the model’s long-text comprehension and tool-calling abilities. Its main limitation is the finite context window. Long documents require segmented processing, preserving key information between segments.
The multi-agent mode is suitable for tasks that can be decomposed and where different parts require different roles. Common roles include information retrieval, code writing, and quality review. The orchestration layer handles state synchronization and data passing. The advantages of multi-agent lie in concurrent processing and role division, but it also introduces new issues, such as information inconsistency between roles, redundant tool calls, or the entire workflow stalling if one agent fails.
The table below compares the two modes across several dimensions:
| Dimension | Single Agent | Multi-Agent |
|---|---|---|
| Suitable Tasks | Single, coherent tasks | Splittable tasks requiring multi-role collaboration |
| Context Management | Limited by a single window, requires segmentation | Each role holds local context, requires sync mechanism |
| Orchestration Complexity | Low | High, requires defining role boundaries and execution order |
| Failure Recovery | Usually reruns entirely | Requires failure isolation and retry mechanism for individual roles |
| Token Cost | Relatively predictable | Inter-role messaging increases consumption, requires separate tracking |
During selection, you can first run the task through a single agent, then observe whether the bottleneck comes from context length or concurrency. Only after confirming the bottleneck is it worth introducing a multi-agent architecture.
IV. Token Cost and Quota: Common Misconceptions
When evaluating LLMs, benchmark scores only indicate the model’s performance on specific questions. In long tasks, the factors that truly impact productivity include Token consumption, task completion rate, and quota stability.
Some models may consume massive quotas in a short time during complex generation tasks. If quota exhaustion interrupts a task, this is a different issue from a network timeout and should be recorded separately for root cause analysis.
There are three common misconceptions:
- Only looking at benchmark scores without tracking per-task Token consumption.
- Automatically retrying failed long tasks without limits, causing a retry storm that rapidly depletes the quota.
- Failing to set timeout and budget limits, allowing tasks to run indefinitely.
The single-task cost can be estimated as follows:
Single-task cost ≈ (Input Tokens + Output Tokens) × Unit Price × Number of Calls + Cost of Failed Retries
During accounting, record the Token count, number of requests, runtime, and failed retry count for each task. Only with this complete data can you compare the true costs of different models on the same task.
For enterprise users, consider using container platforms and model inference services provided by general cloud providers to build a hybrid cloud AI agent platform. Resource planning should be constrained by Service Level Objectives (SLOs) and quotas. Optimize resource utilization under given SLAs and quotas, and use monitoring data to verify the effects, rather than promising a fixed margin of utilization improvement.
V. Selection Checklist
The following checklist items can be checked one by one, and actual data should be recorded for each:
- Self-iteration verification: Complete a full test-fix loop in a real repository. Record the number of repair rounds, final test pass rate, and file modification scope per round. The pass criterion is that tests pass and the modification scope is explainable.
- Multi-agent verification: Set role boundaries and maximum execution rounds. Record the number of state synchronization failures and information conflicts between roles.
- Cost accounting: Record the Token count, number of requests, runtime, and retry count for each task. The pass criterion is that the single-task cost is within budget.
- Quota verification: Test under expected peak concurrency to confirm whether the quota is sufficient, and record the number of rate-limiting occurrences.
- Failure handling: Verify that timeout, retry limits, and failure alerts function correctly.
- Security check: Confirm that the permission scope contains only the minimum set required for the task, and that keys are stored via environment variables or key management services, not hardcoded in code or logs.
VI. Applicable and Inapplicable Scenarios
The methods in this article are suitable for the following scenarios:
- Projects with relatively complete test cases that can serve as the acceptance criteria for self-iteration.
- Repetitive tasks, such as batch-building pages or batch-fixing similar issues.
- Research tasks requiring multi-role decomposition, where the output of each phase can be independently verified.
The following scenarios are not recommended for direct automated modification: - Core business systems without test coverage, yet allowing the model to directly modify code.
- Scenarios requiring extremely high output accuracy without a human review step.
- Budgets insufficient to cover retry costs, with no budget limit set.
Conclusion
Model selection conclusions should come from measurement data in your own environment, including repair success rate, single-task cost, and failure records. A single benchmark score can only serve as an initial screening reference and cannot be directly used as a basis for procurement or architectural decisions.
