AI Coding Agents in Practice: Distinguish Models from Agent Frameworks First

    This article explains why LLMs and agent frameworks should be evaluated separately, how to assess AI coding tools using completion rate, verifiability, change scope, cost, rollback, and manual correction metrics, and how to use structured task descriptions, permission boundaries, and verification loops to make agent output more stable.

    1. First Clarify Two Concepts: Large Models and Agents

    Before evaluating an intelligent coding tool, it is necessary to distinguish two layers. One is the large language model, and the other is the agent framework that wraps the model. They are often referred to together as “AI coding tools,” but their capability boundaries, cost structures, and failure modes are different.

    1.1 Large Models: Reasoning Cores That Only Process Text

    The basic interface of a large language model is simple: it receives text and outputs text. It is good at understanding requirements, reasoning through logic, generating code, and explaining errors, but it has no execution capability of its own. It cannot directly open files on your computer, run terminal commands, or call version control systems. The model can only make judgments based on the text you provide.

    Models of different sizes differ clearly in capability and cost and can generally be divided into three tiers:

    • High-end models: These have the strongest reasoning capability and are suitable for high-value tasks such as complex problem analysis, system architecture review, and root-cause analysis of difficult defects. Per-call cost is higher, and responses are slower.
    • Balanced models: Performance and cost are close to balanced, making them the main force for daily coding. Most feature development, unit test writing, and code review can be handled by them.
    • Lightweight models: These respond quickly and cost little, making them suitable for batch and structurally simple work such as code formatting, generating sample data, and batch rewriting comments.

    When choosing a model tier, first judge the complexity of the task and the cost of errors, and then decide which tier to use. Assigning all tasks to the strongest model will drive up costs, while assigning architecture decisions to a lightweight model may produce superficially reasonable but actually flawed solutions.

    Large models are usually accessed in three ways: directly through a web chat interface, programmatically through an official API, or indirectly through a hosted service provided by a cloud platform. Note that web subscriptions and API calls usually use two separate metering systems. The former charges by subscription period, while the latter charges by the amount of input and output text. Mixing the two when thinking about costs can easily lead to deviations in budget estimates.

    1.2 Agents: Giving the Model Hands and Feet

    An agent is an execution framework built around a large model. Its core idea is to let the model interact with the external environment through “tool calls” and feed execution results back to the model, forming a loop. A typical agent usually contains four parts:

    1. Model: Responsible for planning the next action and understanding execution results.
    2. Tool set: Capabilities such as reading files, searching code, running tests, and executing commands. Each tool has a clear input and output format.
    3. Context management: Determines which historical information should be retained and which can be compressed or discarded.
    4. Loop control: Specifies the maximum number of steps, timeout periods, and which operations require human confirmation.

    The following is illustrative pseudocode for an agent loop, used to explain the execution flow. It is not an interface from any specific product:

    1. def run_agent(goal, model, tools, max_steps=20):
    2. messages = [{"role": "user", "content": goal}]
    3. for step in range(max_steps):
    4. reply = model.generate(messages, tools=tools.schema())
    5. if reply.is_final:
    6. return reply.text
    7. for call in reply.tool_calls:
    8. # High-risk operations such as writing files and running commands require human confirmation
    9. if call.name in tools.need_confirm and not ask_user(call):
    10. messages.append(tool_denied(call))
    11. continue
    12. result = tools.run(call)
    13. messages.append(tool_result(call, result))
    14. raise RuntimeError("Maximum steps exceeded; task not completed")

    This loop reveals the essence of how an agent works: the model only decides “what to do next” each time, while the tool layer actually reads and writes files and executes commands. In other words, an agent’s performance is jointly determined by the model’s reasoning capability and the tool design.

    1.3 Why the Two Must Be Distinguished

    Distinguishing models from agents has three practical implications.

    First, problem localization becomes more accurate. When tool results are unsatisfactory, the cause may lie in model reasoning, missing context, insufficient tool permissions, or unreasonable loop design. Without distinguishing these factors, teams often attribute the problem vaguely to “the model not being smart enough” and repeatedly switch models without finding the real bottleneck.

    Second, cost estimation becomes more reliable. Large models are billed by text volume, while an agent calls the model multiple times during a single task. Each round of calls sends the previous conversation and tool results back into the model, so the input volume of a multi-step task grows with the number of steps. A seemingly simple requirement may consume several times or more than a single round if the agent runs more than a dozen rounds.

    Third, capability comparisons become fairer. The same model may perform very differently in different agents. When comparing two tools, if you only look at the name of the underlying model and ignore its tool design and process control, the conclusion may be distorted.

    2. How to Evaluate the Experience of Using Intelligent Coding Tools

    User experience is subjective, but it can be broken down into several metrics that can be recorded and compared. Below is an evaluation method that can be executed directly.

    2.1 Evaluation Dimensions

    It is recommended to observe the following seven dimensions:

    Dimension Measurement Description
    Task completion rate Number of successfully completed tasks divided by total tasks Reflects the basic reliability of the tool
    Result verifiability Whether it can pass tests or static checks More important than “looking right”
    Change scope controllability Whether the number of changed files matches task expectations Out-of-scope changes are a common risk
    Response time Time from issuing an instruction to obtaining a result Affects the interaction rhythm
    Per-task cost Input and output volume consumed per task Determines whether it can be used at scale
    Rollback capability Whether changes can be quickly reverted Related to version control workflows
    Manual correction cost Time spent on manual remediation The ultimate composite metric

    Among these, manual correction cost best reflects real value. Even if a tool has a high completion rate, its net benefit may be limited if every output requires half an hour of review and repair.

    2.2 Design a Controlled Trial

    To avoid drawing conclusions based on impressions, you can design a small controlled trial:

    1. Select five to ten representative tasks, covering types such as fixing known defects, adding unit tests, small-scale refactoring, writing documentation for unfamiliar modules, and troubleshooting log errors.
    2. Fix the input conditions, including the same version of the code repository, the same prompt template, and the same acceptance criteria.
    3. Record structured data for each run to facilitate later statistical analysis.

    Below is an example of a record structure:

    1. from dataclasses import dataclass
    2. @dataclass
    3. class TrialRecord:
    4. task_id: str # Task ID
    5. model_tier: str # Model tier: high-end / balanced / lightweight
    6. steps: int # Number of agent loop steps
    7. elapsed_sec: float # Total elapsed time (seconds)
    8. files_changed: int # Number of files actually changed
    9. tests_passed: bool # Whether automated tests passed
    10. needed_manual_fix: bool # Whether manual repair was needed

    Once enough data has been accumulated, you can group statistics by task type and model tier to observe which tasks are suitable for handing over to an agent and which tasks should be led by humans.

    2.3 Common Misjudgments

    Three types of misjudgments are particularly common during evaluation.

    First, treating a successful demonstration as stable capability. Demonstrations usually select the most ideal scenarios and cannot represent the complexity of daily work. Evaluation should use randomly selected real tasks.

    Second, looking only at the final result and not at the process. Even if the code finally passes tests, hidden risks still need to be recorded if the agent casually modifies unrelated modules, deletes a comment, or changes a configuration file.

    Third, ignoring hidden costs. If agent-generated code lacks comments, uses inconsistent naming, or deviates from team style conventions, maintenance costs will gradually emerge. These costs are difficult to detect in a single evaluation and need to be reviewed after some time.

    3. Engineering Practices: Making Agents Produce Reliable Output

    The quality of agent output depends largely on how it is used. The following practices can be implemented.

    3.1 Structure the Task Description

    Vague instructions lead the agent to fill in assumptions on its own, and the result often deviates from expectations. A structured task description usually contains four elements: goal, constraints, acceptance criteria, and relevant file scope. Example:

    1. [Goal] Add date-range filtering to the order export API.
    2. [Constraints]
    3. - Do not change the response structure of existing APIs.
    4. - Do not introduce new third-party dependencies.
    5. - Use the project's existing convention for date parameter format.
    6. [Acceptance criteria]
    7. - All newly added unit tests pass.
    8. - Existing tests have no regressions.
    9. - Empty dates and reversed date ranges produce clear error messages.
    10. [Scope] Only the export module and its test directory.

    This format has two effects. It makes the requirement explicit and reduces the room for the agent to guess on its own; at the same time, it provides a checklist for subsequent acceptance, making it easier for humans to verify item by item.

    3.2 Set Permissions and Security Boundaries

    Because agents have tool-calling capabilities, permission design must follow the principle of least privilege.

    • Read/write separation: By default, only read permissions are granted. Writing files and executing commands require explicit authorization or human confirmation.
    • Sensitive information isolation: Keys, credentials, and personal data should not appear in prompts or code. Such information should be injected through environment variables or a dedicated secrets management service and should not be written to logs.
    • Command allowlist: The agent can be restricted to executing only fixed commands such as builds, tests, and format checks, and prohibited from arbitrarily performing high-risk operations such as deletion or network transmission.
    • Audit logs: Record the time, parameters, and results of every tool call for later tracing. The logs themselves should also be connected to a logging service and protected by access control.

    3.3 Establish a Verification Loop

    Agent-generated code cannot be merged directly into the main branch. It must go through checks that are the same as, or even stricter than, those for human-written code. Common loops include:

    1. Reproduce first, then fix: For defect-type tasks, require the agent to first write a test that can reliably reproduce the problem, then modify the implementation, and finally confirm that the test turns to passing.
    2. Automated checks: Run unit tests, integration tests, static analysis, and format checks. Any failure should block merging.
    3. Human code review: Reviewers focus on logic correctness, boundary conditions, and security risks.