AI Coding Agent Harness Selection and Cost Evaluation

    This article explains why the execution harness around an LLM matters as much as the model itself for coding agents. It breaks down five core harness components—system prompts, toolchains, project-level context, subagents, and permission management—and discusses billing models, native model-harness fit, cost per successful task, and how to build an internal benchmark for repeatable evaluation.

    1. Background: Beyond the Model, the Harness Matters

    More developers are connecting large language models to terminals or editors so the model can read code, modify files, run commands, and complete multi-step tasks. In these scenarios, the same model can perform very differently in different execution harnesses. People often compare two tools directly and ask which one is better, but that comparison can confuse two variables: model capability and harness design.

    A harness refers to the entire runtime environment outside the model, including the system prompt, available tools, how project-level context is injected, task decomposition mechanisms, and permission controls. The model handles reasoning and generation, while the harness turns reasoning results into reliable actions. A well-designed harness helps model capability translate consistently into results. A poorly designed one can cause repeated trial and error, unauthorized operations, or lost context even when the model itself is strong.

    Therefore, selection should start with two questions: What capabilities does my task need from the harness? And which combination delivers the best value for those capabilities?

    2. Five Core Components of an Execution Harness

    2.1 System Prompt

    The system prompt defines the agent’s role, behavioral boundaries, and output conventions. A mature prompt usually contains three types of content:

    • Working style: read relevant code before modifying it, run verification after changes, and ask when requirements are ambiguous.
    • Coding conventions: naming style, directory structure, and dependency management rules.
    • Output conventions: format of change descriptions, whether large-scale refactoring is allowed, and whether tests should be included.

    The more specific the prompt, the less unrelated exploration the model performs. However, an overly long prompt consumes context window space and increases the base cost of every call, so there is a tradeoff between completeness and conciseness.

    2.2 Toolchain

    Tools are the only channel through which the agent interacts with the external world. Common tools fall into four categories:

    • Read tools: read files, list directories, and search text.
    • Write tools: create, modify, and delete files.
    • Execution tools: run builds, tests, and script commands.
    • External tools: access network resources or internal service interfaces.

    The number and granularity of tools directly affect outcomes. With too few tools, the agent may need workarounds for simple operations. With too many tools, the model must choose from a large set at every step and is more likely to pick the wrong one. A better approach is to keep each tool focused on a single responsibility, keep parameters simple, and document the appropriate use case for each tool.

    2.3 Project-Level Context

    Project-level context is background information automatically injected by the harness, such as project instruction files, architecture documents, and common commands. Its purpose is to reduce repeated exploration at the start of each session.

    These files should stay short, accurate, and maintainable. It is best to record only information the model cannot infer directly from the code, such as special build command flags, caveats about legacy modules, and directories that must not be modified. Dumping a full description of the entire codebase into the context can reduce the proportion of key information.

    2.4 Subagents and Task Decomposition

    When a task spans multiple modules, a single session can exceed the context limit, and intermediate results can interfere with one another. A subagent mechanism splits a large task into independent subtasks, each with its own context and tool subset, and the main agent aggregates the results.

    The benefit of decomposition is isolation and parallelism; the cost is additional coordination overhead. Tasks suitable for decomposition usually have these characteristics: low dependencies between subtasks, results that can be verified against clear criteria, and a large amount of content to search or read.

    An illustrative configuration is shown below. It only demonstrates structure and does not correspond to any specific product:

    1. agent:
    2. system_prompt: role definition + coding conventions + output format
    3. tools:
    4. - name: read_file
    5. risk: low
    6. approval: auto
    7. - name: run_shell
    8. risk: high
    9. approval: ask_user
    10. sub_agents:
    11. - name: code_search
    12. tools: [read_file, search_text]
    13. max_turns: 8

    2.5 Permission Management

    Permission management determines what the agent can do and who must approve each action. A reasonable tiering model usually looks like this:

    1. Low-risk operations such as reading files and listing directories are allowed automatically.
    2. Medium-risk operations such as modifying files within the project are allowed within specified directories, with change records retained.
    3. High-risk operations such as deleting data, accessing external networks, or executing unknown scripts require human confirmation.

    Permissions that are too loose create risks of data corruption or leakage. Permissions that are too strict interrupt workflows frequently and make developers lose patience. Permission strategy should match the blast radius of the task and follow the principle of least privilege.

    3. Tradeoffs Between Cost and Native Fit

    Two common dimensions in selection are billing method and degree of fit.

    There are two billing methods. Subscription pricing charges a fixed fee by tier and suits individual developers with frequent, stable usage. Metered pricing bills by input and output tokens and suits teams with highly variable usage or a need for precise cost accounting.

    Native fit means the harness and model are highly matched in tool-call formats, prompt style, and context management. With good fit, the model produces fewer format errors, missing tool parameters, and duplicate calls, resulting in fewer overall turns. Generic fit means the same harness can connect to multiple models, offering greater flexibility, but some details require manual tuning.

    When comparing costs, do not look only at the per-call price. Calculate the cost per successful task:

    1. Cost per successful task = total cost / number of validated tasks
    2. Total cost = Σ (input tokens × input unit price + output tokens × output unit price)

    Even if a harness has a low unit price, a high failure rate and many retries can make the final cost per successful task higher. Conversely, a solution with a higher unit price but a high first-pass rate may not be more expensive.

    4. Build Your Own Evaluation Benchmark

    General leaderboards cannot reflect your codebase and working habits. The most reliable method is to construct a set of internal tasks and test them directly.

    Suggested steps:

    1. Select 15 to 30 tasks from recent real work, covering four categories: new features, bug fixes, refactoring, and test additions.
    2. Define automatically checkable pass criteria for each task, such as tests passing or API return values matching expectations.
    3. Fix the initial code state and run the tasks in each candidate harness, recording the results.
    4. Measure pass rate, average rounds, elapsed time, and cost, then calculate cost per successful task.

    Illustrative evaluation code:

    1. def evaluate(tasks, run_agent):
    2. results = []
    3. for task in tasks:
    4. start = now()
    5. outcome = run_agent(task.prompt, workdir=task.repo)
    6. results.append({
    7. "passed": task.verify(outcome),
    8. "rounds": outcome.rounds,
    9. "tokens": outcome.input_tokens + outcome.output_tokens,
    10. "seconds": now() - start,
    11. })
    12. return summarize(results)

    Note that the same task may produce fluctuating results when run at different times. It is advisable to run each task at least two or three times and average the results, while keeping prompts and project context consistent to ensure a fair comparison.

    5. Selection Recommendations

    Priorities differ by scenario. The following table offers a reference:

    Scenario Prioritize Notes
    Individual daily coding with stable usage Unit price and user experience Fixed fees are easier to budget
    Large codebase with multi-module changes Subtask decomposition and context management Determines whether cross-module tasks can be completed
    Team collaboration requiring auditability Permission tiers and change records Supports compliance and traceability
    High-frequency automation tasks Cost per successful task Failed retries are amplified

    When putting a harness into practice, check the following:

    • Does the project instruction file contain only information the model cannot infer from code?
    • Do tools have a single responsibility and a labeled risk level?
    • Do all high-risk operations include a human confirmation step?
    • Have you measured pass rate and cost using your own task set?
    • After switching harnesses or models, have you rerun the same evaluation?

    Model capabilities will continue to iterate, and execution harnesses are evolving quickly. Rather than chasing a single “best tool,” it is better to build a repeatable evaluation method so that selection conclusions can be updated as requirements and environments change.