Agentic Coding: Model Evaluation and Production Practices

    As large language models move from code completion toward task delivery, agentic coding has become a growing focus for engineering teams. This article explains what agentic coding requires, proposes evaluation dimensions beyond single-point benchmark scores, and discusses long-context and thinking-mode usage. It also examines lessons from a vector-graphic generation test and outlines a production loop covering task orchestration, tool routing, validation, repair, permission governance, and cost control.

    As large language models move from “code completion” toward “task delivery,” agentic coding has gradually become a focus for engineering teams. Agentic coding does not mean asking a model to write more lines of code. Instead, it gives the model a relatively complete task goal and lets it decompose steps, call tools, execute changes, repair based on feedback, and finally deliver a verifiable result. Once this capability enters a real R&D process, evaluation criteria shift from “does the generated code look plausible?” to “is task completion stable, is cost controllable, and is the process auditable?”

    1. Capability Positioning: From Code Generation to Task Closure

    Traditional code generation mainly focuses on single files, single functions, or local completion. Input and output boundaries are clear, and developers usually inspect the result immediately after generation. Agentic coding is different: it needs to understand repository structure, locate defects, modify multiple files, add tests, run commands, and continue repairing based on error feedback. Its core capabilities can be divided into five layers:

    1. Task understanding and planning: Decompose natural-language goals into executable steps and identify dependencies and risk points.
    2. Context management: Preserve system constraints, repository summaries, retrieval snippets, tool results, and validation feedback in long context windows.
    3. Tool invocation: Use general tools such as file read/write, command execution, test running, and browser operations as needed.
    4. Validation and reflection: Judge results through compilation, unit tests, static checks, rendering validation, and other methods, and repair based on failure information.
    5. Delivery and explanation: Output change summaries, impact scope, validation results, and remaining risks.

    Therefore, when evaluating this type of model, it is not enough to check whether code snippets “look good.” The key question is whether the model can complete a closed loop in a controlled environment. Long context windows and larger output budgets can indeed relieve pressure on repository-level understanding and multi-file modification, but longer context is not always more effective. A more reasonable engineering approach is to organize context in layers: put system constraints first, followed by task instructions and acceptance criteria; inject repository summaries and retrieval snippets on demand; and backfill tool results and validation feedback in a timely manner to avoid irrelevant information crowding out the effective window. Thinking mode is suitable for complex planning and failure reflection, but it increases latency and token cost. Teams should set budget limits and use lightweight paths for simple tasks.

    2. Evaluation Dimensions: Avoid Being Misled by Single-Point Scores

    In public evaluations, these models are often observed across dimensions such as code repair, multilingual code repair, terminal operations, tool invocation, browser tasks, and comprehensive knowledge reasoning. These dimensions are useful references, but engineering selection cannot rely only on single-point scores. More reliable evaluation should cover six types of metrics: task completion rate, validation pass rate, average cost, end-to-end latency, failure recoverability, and security/compliance. Task sets, runtime environments, and tool permissions should be fixed to ensure reproducibility.

    Capability dimension Key question Suggested validation method
    Repository-level code repair Can it locate cross-file dependencies and minimize changes? Use a fixed defect set and check patch pass rate and regression tests
    Multilingual migration Does it understand constraints in different language ecosystems? Use a cross-language small-task set and check compilation and unit tests
    Terminal operations Does it have state awareness and command error correction? Execute multi-step commands in a sandbox and record the recovery process
    Tool invocation Are parameters correct, and can failures be retried? Tool contract tests and exception injection
    Browser tasks Are page understanding and action sequences stable? Replayable page tasks and screenshot validation
    Comprehensive reasoning Does it rely on memory rather than on-site reasoning? Change phrasing, change data, and add distractors for contamination-resistance testing

    Evaluation reports should also include failure categories, such as “wrong localization,” “incomplete patch,” “test misjudgment,” “tool parameter error,” “context loss,” and “excessive modification.” Only by clearly separating failure modes can teams decide which layer the model is suitable for: a draft generator, a repair suggester, or an agent allowed to execute automatically in a sandbox. For enterprise users, the recommended path is offline evaluation first, then small-traffic online validation, and finally gradual expansion of tool permissions.

    3. Engineering Use of Long Context and Thinking Mode

    Long context is suitable for carrying repository summaries, interface contracts, historical discussions, and validation logs, but it is not advisable to insert all raw files at once. A more robust strategy is “summary + retrieval + backfill”: first maintain a structured repository summary, then retrieve relevant file snippets by task, and after tool execution backfill only key results and error summaries. The output side should also be controlled in stages to avoid generating an extremely large patch at once and making review difficult.

    Thinking mode can be used for plan generation and failure reflection. In engineering, “planning” and “execution” can be separated: the planning stage outputs steps, expected artifacts, and validation methods; the execution stage calls tools step by step; after validation failure, only the failure summary and relevant context are sent back for reflection to avoid full replay. The following illustrative pseudocode shows task orchestration and the validation loop without relying on specific interfaces:

    1. task = "fix the defect and add regression tests"
    2. constraints = load_project_rules()
    3. plan = model.plan(task, constraints, repo_summary)
    4. for step in plan.steps:
    5. if step.type == "tool":
    6. result = tool_router.call(step.name, step.args)
    7. else:
    8. result = model.generate(step.prompt, context_builder.build(step))
    9. check = verifier.validate(step.expected, result)
    10. if not check.ok:
    11. feedback = summarize_failure(check)
    12. plan = model.reflect_and_repair(plan, feedback, max_steps=3)
    13. if plan.need_human:
    14. break

    The key to this pseudocode is not the model call itself but verifier and tool_router: the former turns “looks right” into “validation passed,” while the latter centralizes tool permissions, parameter validation, and audit records. Agentic coding without a verifier can easily become uncontrolled automatic modification.

    4. Empirical Observation: Lessons from a Vector-Graphic Generation Test

    A common generative code test is to ask a model to output vector-graphic code for “a pelican riding a bicycle.” This task looks entertaining, but it can expose many issues: the model needs to understand object parts, spatial relationships, colors, and renderable structure, and it must translate semantics into executable code. When the same type of prompt is tested across multiple representative models or different technical routes, common results are inconsistent: some have complete overall composition but missing details, such as missing legs or pedals; some are rich in detail but loosely structured, with incorrect relationships between wheels and frame; some have reasonable colors but deviate in object semantics, producing code that renders but does not look like the target object; and some are over-decorated, causing the main structure to collapse.

    These phenomena offer three engineering lessons. First, generative code must undergo executable validation. Vector graphics should be checked through parsing and rendering, while business code should go through compilation, unit tests, and static checks; it is not enough to check whether the text is fluent. Second, prompts should explicitly list key parts and acceptance criteria, for example, “include a frame, two wheels, pedals, and the rider’s two legs, with a clear object hierarchy,” to reduce omissions caused by free-form model behavior. Third, visual tasks require post-validation, such as rendered screenshots, structure parsing, part counting, or manual spot checks. The same applies to code tasks: whether a patch is minimal, whether tests cover the change, and whether interfaces remain compatible should all be judged by a verifier.

    A single empirical test only shows sample-level behavior and cannot directly prove production readiness. A more reasonable conclusion is that models for agentic coding already have strong potential on general tasks, but failure modes differ significantly across task types, so validation loops and permission governance are required as safeguards.

    5. Production Practice: Task Orchestration and the Validation Loop

    For production deployment, a recommended closed loop is “task abstraction—planning—tool routing—execution—validation—repair—delivery.” After a task enters the system, it should first be structured: goal, scope, prohibited modifications, acceptance commands, timeout, and budget. The planning stage requires the model to output checkable steps and expected artifacts. The execution stage calls tools in a sandbox, and all commands and file changes are logged. The validation stage should at least cover syntax/compilation, unit tests, static checks, and interface contracts; visual tasks add rendering validation; frontend tasks add screenshot and accessibility checks. In the repair stage, whether to retry is determined by failure type, with a maximum number of rounds; if the threshold is exceeded, the task is escalated to a human.

    Permission governance is equally important: tools should follow least privilege, command execution should run in isolated environments, network access should be enabled on demand, secrets should not enter context, sensitive data should be redacted, and audit logs should be traceable. Cost control can be achieved through context compression, retrieval caching, lightweight models for simple tasks, and thinking mode only for complex tasks. On Baidu AI Cloud, general capabilities such as container platforms, function computing, object storage, log services, and monitoring/alerting can be combined to build isolated execution environments, artifact storage, and observability chains; specific choices should still be weighed around task isolation, elasticity, auditing, and cost goals.

    6. Conclusion

    The value of large models for agentic coding lies not in single-point code generation but in the task loop of “planning—execution—validation—repair.” Evaluation should consider task completion rate, validation pass rate, cost, latency, and failure recoverability at the same time. In use, long context should support layered context management, thinking mode should support complex planning and reflection, and verifiers and sandboxes should constrain uncertainty. Only by placing model capabilities into an engineering system that is verifiable, auditable, and rollback-capable can agentic coding truly move from demos to delivery.