Agentic Coding: Layered Evaluation and Engineering Practices
This article explains how agentic coding differs from one-shot code generation, what tasks suit a closed loop, and how to evaluate the results in three layers: functional correctness, engineering maintainability, and clarity of expression. It also covers task packages, small-step commits with independent verification, failure classification, and the human review responsibilities that turn code generation into a repeatable engineering capability.
From One-Shot Generation to Closed-Loop Collaboration
Most traditional coding assistance follows a simple pattern: you ask a question, you get a block of text back. The model writes a function, a script, or an explanation directly from the available context, and the interaction ends after that single generation. This works well for completing local logic, explaining an error, or drafting a sample, but it struggles with cross-file changes, dependency constraints, and repeated verification.
Agentic coding changes the way work gets done rather than simply making answers longer. The system is given a basic loop similar to a developer’s: understand the goal, break it into steps, retrieve or read context, produce a change, run checks, and revise based on the results until a verifiable completion condition is met. Reflection here is not decorative prose; it means feeding failure signals back into the decision process.
A usable loop usually contains four kinds of actions.
- Planning: turn the requirement into acceptance-ready subtasks with explicit inputs, outputs, boundaries, and prohibitions.
- Action: modify only the code, configuration, or documentation relevant to the current subtask, avoiding unconstrained large-scale rewrites.
- Observation: judge the result through compilation, static analysis, unit tests, API smoke checks, or logs, rather than relying on the generated text being internally consistent.
- Correction: narrow the change based on the failure cause and record which paths have already been ruled out, so the system does not circle the same error repeatedly.
“Multi-turn conversation” without an observation step is just an extended version of one-shot generation. The real gain comes from repeatable verification, not from the number of turns.
Capability Boundaries and Where It Fits
An agent does not automatically produce a higher correctness rate. It adds state, tool calls, and context length, and it also adds opportunities to drift from the goal, repeat modifications, and mask failures. Tasks that are worth putting inside a loop usually share three traits: the completion criteria can be checked automatically or semi-automatically; the scope of change can be bounded; and failure produces clear feedback, such as a compile error, a failed assertion, or a contract mismatch.
Scenarios better suited to one-shot generation include concept explanations, algorithm drafts, interface sketches, and examples only loosely related to an existing repository. If the environment cannot run, the requirement itself is vague, or there is no regression protection, forcing the system to “keep changing things until it passes” usually just accumulates unreviewable diffs.
For enterprise adoption, assistance and authorization should also be separated. Generated suggestions, draft patches, and change summaries can be merged after human or pipeline review; writing directly to production configuration, changing permissions, or skipping review goes beyond the reasonable boundary of code generation. Quality discussions should center on reviewable artifacts, not on whether the model “seems like a senior engineer.”
Three-Layer Evaluation: From Runnable to Maintainable
A single pass rate cannot describe the ceiling of code generation. It is better to evaluate in three ascending tiers, each of which assumes the previous one holds. Failure at a higher tier cannot be compensated for with wording or interface polish.
Tier 1: Functional Correctness and Constraint Compliance
This tier asks only one thing: given the inputs and constraints, does the behavior match the specification?
The evaluation design should state in advance:
- The happy path and at least one class of edge case, such as an empty collection, out-of-range input, duplicate submission, timeout, or insufficient permissions.
- Explicit invariants, such as monetary amounts represented as integers in the smallest currency unit, identifiers never appearing in plaintext in logs, and errors propagated upward rather than silently swallowed.
- Prohibited behaviors, such as introducing undeclared dependencies, modifying unrelated modules, or deleting existing tests to “pass.”
A sample acceptance description can be short, but it must be executable:
Task: add a discount cap to order amount calculation.Invariants: the discounted amount must not be below 0 and must not exceed the original price.Verification: cover three cases: zero discount, full discount, and an over-limit discount; existing pricing tests must still pass.Done: only the pricing module and its tests are changed; interface paths stay unchanged.
Scoring should focus on whether failures are locatable. If the system can point to the assertion, the data, or the branch after a test fails instead of rewriting the whole block, the loop is working. If it manufactures a “green result” by deleting tests, loosening assertions, or catching all exceptions, it should be marked as failing even when the visible cases pass.
Tier 2: Engineering Structure and Maintainability
Correct code may still be impossible to merge. The second tier examines whether the change looks like a normal engineering commit.
Dimensions that can be checked include:
- Responsibility boundaries: new logic sits at the appropriate layer of an existing module rather than piling up in the entry function.
- Dependency direction: domain rules do not depend backward on interface or infrastructure details; external calls are concentrated in replaceable adapters.
- Error model: failures are distinguishable, loggable, and propagatable; control flow is not hidden inside overly broad exception handling.
- Testability: key branches can be covered with small inputs and do not require a real external environment to judge correctness.
- Change size: the diff is proportional to the task, and names and comments explain “why” rather than restating “what.”
Review with a checklist instead of an impression score. For example: was unnecessary global state introduced; was configuration hard-coded; was backward compatibility broken without explanation; do public interfaces remain stable. A reasonable expectation for generated output is to “meet the team’s existing baseline,” not to suddenly surpass the design level of the whole codebase. The baseline should come from existing project conventions: directory layout, error codes, log fields, test naming. Writing those conventions into the task description is more effective than blaming style inconsistency afterward.
Tier 3: Clarity of Expression and Interface Aesthetics
Aesthetics in engineering is not decoration; it is cognitive load. A reader should be able to understand the control flow, the shape of the data, and what happens on failure within a short time.
On the code side, you can observe:
- Whether names express domain concepts rather than piling up ad hoc abbreviations.
- Whether functions keep a single level of abstraction, avoiding format conversion and retry details mixed into business rules.
- Whether branches stay flat and complex conditions are extracted into named predicates.
- Whether comments retain only non-obvious constraints, tradeoffs, and external contracts.
The same tier applies to user-facing output: command-line prompts, error messages, admin interfaces, and documentation examples. Good feedback explains what happened, what the impact is, and what the next step should be, instead of returning only an internal stack trace or a vague “failed.” Spacing, hierarchy, and default states in interface elements are part of experience quality and should be considered together with accessibility, consistency, and information density; visual novelty cannot substitute for understandability.
Tier 3 should be an optimization target only after the first two tiers are stable. Make the behavior correct and the structure maintainable first, then reduce reading cost. Otherwise you get demo-grade results that are polished in the example but wrong at the boundaries.
How to Make Evaluation a Repeatable Practice
Task Packages, Not Slogan-Style Prompts
Prepare a task package with the same structure for every evaluation: background, constraints, the scope that may be modified, acceptance commands or check steps, and items known to be out of scope. Keep the prompt stable so results from different pipelines or different points in time can be compared. Avoid unverifiable adjectives such as “industrial-grade” or “most elegant” in the prompt, and replace them with observable clauses.
Small Steps and Independent Verification
Let execution proceed in small steps: resolve one failure cause at a time and keep the test output. Verification is best done by a check step outside the executor, such as a fixed test entry point or a review checklist, which reduces “self-declared passes.” If the environment allows only static reading, mark the confidence level of the conclusion explicitly; never describe something unrun as verified.
Failure Classification
Recording failure types is more useful than recording a single total score: specification misunderstanding, missing context, interface misuse, weakened tests, style drift, and getting stuck in repeated modification. Only after classification can you decide whether to improve the task description, the way context is provided, or the review threshold. When repeated modifications exceed an agreed count, stop and hand the work to a human; this is cost control and quality control at the same time.
The Human Role
Humans define invariants, approve scope, review diffs, and decide whether to merge. The agent drafts, retrieves local context, and revises based on failure information. Leaving “final correctness” to an unreviewed automatic loop is only appropriate for low-risk, rollback-friendly changes with sufficient tests. When permissions, money, personal data, or irreversible operations are involved, human confirmation should be the default.
Common Imbalances When Teams Adopt This
Looking only at Tier 1 produces patches that run but cannot be handed over: duplicated logic, bypassed encapsulation, and special values used to hide branches. Looking only at Tier 3 produces examples that read smoothly but do not cover edge cases; they demo well, and the defects surface after merge. Adding conversation turns without adding observation signals raises cost without necessarily raising correctness.
Another imbalance is binding the evaluation to one model generation or one demo. Models get replaced and repository conventions change too. What stays stable is the tiered standard and the task packages. Replaying the same task set periodically to see which tier regressed is closer to engineering management than chasing a single “ceiling demonstration.”
Context needs restraint as well. Irrelevant files, outdated docs, and contradictory conventions all enter the prompt at once, and the system is more likely to pick the most prominent constraint rather than the correct one. Provide the minimum sufficient context: interface contracts, related tests, and the parts of the directory that will actually be modified.
Summary
The value of agentic coding lies in connecting generation, verification, and correction into a loop that can be stopped and reviewed. Evaluation should progress through three tiers, functional correctness, engineering maintainability, and clarity of expression, each using check items written in advance rather than after-the-fact impressions. When a team fixes task packages, failure classification, and human merge authority in place, code generation becomes a repeatable engineering capability instead of an occasional highlight; the ceiling is defined not by one demo but by how clear the constraints are, how real the feedback is, and whether review still works.
