AI Agents in Practice: How the Model and the Harness Layer Work Together

    Most teams have already plugged a large language model into their development workflow, yet they remain stuck at "ask a question, get an answer." This article explains why real engineering delivery breaks down and introduces a simple equation: agent = model + harness. It breaks the harness into four responsibilities (boundaries and permissions, tool and environment access, process control, and acceptance with feedback), shows a minimal runnable loop, and covers rule files, task decomposition, context hygiene, human-AI division of labor, evaluation, enterprise engineering constraints, common failure modes, and a risk-based adoption sequence. Readers will learn how to turn a demo agent into a sustainable, auditable development assistant.

    From “Answering” to “Delivering”

    Many teams have already connected a large language model to their development workflow, yet they are still stuck at the “ask one thing, get one paragraph” stage. Code can be generated, requirements can be broken down, and solutions can be written in great detail. But the moment work enters a real engineering environment, problems surface immediately: files edited in the wrong place, commands executed without control, context piling up into a mess, and completion claimed before the tests have even finished. The root cause is often not the model itself, but the runtime system outside the model that is responsible for constraints, integration, and acceptance.

    The industry often uses a compact equation to understand agents: agent = model + harness. The model handles understanding, reasoning, and generation; the harness connects those capabilities to the file system, terminal, web, knowledge base, and toolchains, and it defines what the agent can do, in what order, and to what degree before it counts as finished. Without a harness, the model is just a talking reasoning engine; with a harness, it can keep completing tasks in a controlled environment.

    The “harness” metaphor fits well. The model is like a strong horse that does not know the way; the harness is the reins, the saddle, and the route map: it limits the range of activity, provides callable capabilities, records state along the way, and pulls the agent back when it drifts off target. The project conventions, tool configurations, task-splitting strategies, and test gates that engineering teams maintain day to day essentially all belong to this layer, not to the model’s parameters.

    What the Harness Actually Manages

    The harness can be seen as four responsibilities, none of which can be missing.

    First, boundaries and permissions. By default the model does not know which directories are writable, which commands are forbidden, or which data must not leave its domain. The harness must answer these questions with explicit policy: workspace scope, read-only versus writable partitions, whether network access is allowed, how secrets are injected without entering the prompt, and whether to retry or escalate to a human on failure. The earlier permissions are written, the easier auditing becomes afterward.

    Second, tool and environment access. The model does not “open the repository” by itself. It needs standardized tool interfaces: read files, search code, run builds, query logs, call internal APIs. Interface descriptions should be short and deterministic, covering inputs, outputs, side effects, and failure modes. Too many tools make the model hesitate in its choices; too few force it to “pretend to execute” in natural language. The right granularity is: one tool per verifiable action.

    Third, process control. Complex tasks cannot be generated end to end in one shot. The harness must break the goal into checkable steps, for example: locate first, then modify, then compile, then test, and finally summarize the diff. Each step retains state: current assumptions, files already changed, unresolved issues. Process control also includes loop limits, timeouts, and budgets, to keep the model from retrying the same error indefinitely.

    Fourth, acceptance and feedback. Generation does not equal completion. The harness should chain tests, static checks, diff review, and human confirmation into a gate. Failure information should be returned in structured form, rather than stuffing an entire terminal log back into the context verbatim. Good feedback points out “which assertion failed, and how the expected and actual results differ,” giving the next round of edits a clear target.

    A Minimal Runnable Loop

    You do not need to build the whole platform at once during implementation. The minimal usable form is usually: a fixed workspace, a few tools, clear completion conditions, and replayable logs.

    The flow can be written as pseudocode, emphasizing that control stays with the harness rather than the model’s free improvisation:

    1. task = read requirements and constraints
    2. loop until step limit reached or acceptance passed:
    3. plan = model(task, current state, available tool descriptions)
    4. if plan needs a tool:
    5. result = execute tool within permissions(plan.action)
    6. state = merge(state, result summary)
    7. else:
    8. state = merge(state, plan.conclusion)
    9. if completion conditions met(tests, diff, checks):
    10. return change description and evidence
    11. return reason for incompletion and steps taken

    There are three design points here. Separate planning from execution: the model proposes actions, and the runtime decides whether to allow them. Evidence over narrative: completion must come with test output or check results, not “I’ve fixed it.” Compressible state: keep only the summary useful for the next step, so the context is not drowned by historical logs.

    Why Rule Files Are Part of the Harness

    Teams often write their conventions into a document for the model to read: code style, directory conventions, prohibited actions, pre-commit checks. Such files are not decoration; they are the policy source of the harness. Well-written conventions have four characteristics.

    Executable. Instead of “code must be robust,” write “public interfaces must have failure branches, and the specified checks must pass after changes.” Locatable. Point out where the configuration, entry points, and tests live, reducing the model’s need to roam the entire codebase. Negative. Explicitly list what must not be done, for example: do not modify generated directories, do not commit secrets, and do not delete test cases just to pass checks. Updatable. Conventions evolve with the repository; an outdated rule is more dangerous than no rule, because it leads the model into bad habits.

    Conventions should also distinguish “always follow” from “follow only for this task.” Put stable constraints in global rules, and put this task’s goal, scope, and non-goals in task rules. Mixing them together leaves the model unable to tell which has priority.

    Task Decomposition and Context Hygiene

    When long tasks fail, it is usually a context-management failure. An effective approach is to cut a large goal into small, independently verifiable goals, each with its own input, output, and exit condition. For example, “fix a bug” can be split into reproduce, locate, minimal change, regression, and impact explanation. At the end of each segment, do a summary and write the key facts into the state, rather than relying on the model to remember the entire conversation.

    Context hygiene also includes: trim tool returns before injecting them; for repeated errors, keep only the latest one and the diff; discard search results unrelated to the current file promptly; and desensitize sensitive fields before they enter the model. If the harness cannot trim, even the strongest model will be dragged down by noise.

    Human-AI Division of Labor: Automation Is Not Abdication

    The goal of the harness is not to remove humans entirely, but to place them at high-risk decision points. What is suitable for automatic execution: read-only search, formatting, tests in an isolated environment, and small patches with a clear scope. What usually needs human confirmation: expanding permissions, external releases, data deletion, dependency upgrades, and structural changes that are hard to roll back.

    Confirmation points should be designed as “rejectable proposals”: show the action to be executed, its scope of impact, and the rollback method, rather than just asking “continue?” After a human rejects, the harness should write the rejection reason back into the state, so the next round does not force through with the same plan.

    Evaluate the Harness, Not Just the Model

    Switching to a stronger model does not necessarily raise delivery quality proportionally. More diagnostically valuable metrics live in the harness: the number of tool calls per task, the ratio of ineffective retries, the number of over-permission attempts, the first-pass test rate, the number of human interventions, and the time from failure to a reproducible fix. These metrics show whether the problem lies in tool descriptions, permissions, decomposition, or acceptance.

    The evaluation set should also be split by task type: read-only Q&A, single-file changes, cross-module bugs, and integration verification that requires external dependencies. Different tasks demand different harness strategies, and a single “chitchat accuracy” score cannot represent engineering delivery capability.

    Engineering Constraints for Enterprise Adoption

    Once inside an enterprise environment, the harness must satisfy engineering governance, not just “get the model running.”

    Identity and audit. Every tool call should be traceable to the task, the operator, and the time; logs should be retained long enough for review, but the logs themselves must not become a new repository of sensitive data. Environment isolation. The environment that executes commands is isolated from production; dependencies and network access are granted with least privilege. Repeatability. The same input on the same repository version should produce comparable process records, making it easier to compare whether a policy change is genuinely better. Failure recovery. After an interruption, work can resume from the most recent checkpoint, rather than consuming context from the start.

    If a team already uses cloud object storage to store artifacts, logging and monitoring to observe tasks, and a container platform to provide isolated execution environments, these capabilities should serve the constraints above: traceable artifacts, observable runs, and isolable failures. There is no need to bind the harness to a specific proprietary interface; what matters is that permissions, state, and acceptance always remain under the runtime’s control.

    Common Failure Modes

    Piling up tools without writing completion conditions. The model keeps calling tools but never knows when to stop. Writing only prompts, without controlling execution. The model can “describe” a dangerous command, and if the runtime accepts it wholesale, the risk turns from text into real side effects. Looking only at the final answer, not the intermediate evidence. A summary that looks complete may hide the fact that tests were never run. Stuffing all history into the context. Reasoning quality in the latter half drops noticeably, showing up as repeated edits and forgotten constraints. Substituting a single success case for a policy. An occasional pass cannot be extrapolated; you must work backward from failure samples to shape the gates.

    It is best to proceed from low to high risk. First, go read-only: let the model search and explain within a fixed repository, with all write operations disabled. Next, do suggestion-style changes: output only patches, applied by a human. Then do controlled writes: restrict directories, and enforce diff review and automatic checks. Only then do multi-step autonomy: allow planning, execution, and retries in an isolated environment, while keeping a human escalation channel.

    At each step up, fill in the corresponding logs, permissions, and rollback, rather than pursuing “full automation” first and adding safety later. Model capabilities will change, but the harness’s policies, tool contracts, and acceptance standards are the assets a team can accumulate over the long term.

    Understanding an agent as “a model plus an auditable harness mechanism” helps move the discussion away from parameters and leaderboards and back to engineering questions: Are the boundaries clear? Are the tools verifiable? Is the process recoverable? Is completion backed by evidence? Get these four things solid, and the agent goes from a demo to a sustainable development assistant.