The Formula for Agent Development: Model Plus Harness

    This article breaks down the engineering formula Model + Harness = Agent and explains why the harness, not the model alone, determines whether an agent can handle real workflows. It covers the five-layer harness architecture, a plugin-based design with a minimal plugin protocol, context management, tool invocation and sandbox safety boundaries, evaluation loops, and a practical adoption roadmap for teams building agents.

    1. An Engineering Formula That Keeps Holding Up

    In agent engineering practice, the industry has gradually converged on a simple formula:

    1. Model + Harness = Agent

    The model provides understanding, reasoning, and generation, and acts as the foundation of the agent. The harness (runtime framework, or carrier layer) covers everything outside the model: the engineering pieces that connect the model to a real workflow. Only when the two are combined do you get an agent that can enter a business environment and handle actual tasks.

    This formula matters because it shifts the discussion from “which model should we pick” to “how do we carry the model.” Many failed deployments are not caused by insufficient model capability but by a missing carrier layer: messy context, unstable tool calls, tasks that cannot be decomposed, execution results that cannot be collected, and quality that cannot be measured. In short, the model sets the ceiling on capability, while the harness sets the floor on delivery.

    The harness is not glue code. It is a complete middle-layer infrastructure that typically includes:

    • Context management: assembling, compressing, retrieving, and isolating conversation and task information;
    • Tool invocation: defining, discovering, routing, executing, and permission-controlling external capabilities;
    • Task planning: breaking vague goals into executable steps and adjusting them dynamically;
    • File read/write and code modification: operating on workspace artifacts inside a controlled sandbox;
    • Terminal execution: running commands, installing dependencies, and executing tests;
    • Feedback collection and evaluation loops: gathering execution results into repeatable quality metrics.

    2. Why a Model Alone Cannot Be an Agent

    There is a gap between single-turn question answering and a real workflow. Real tasks usually have three traits: long duration, multiple steps, and strong side effects. A model is essentially a stateless function. It is good at producing high-quality output for a given input, but not at maintaining long-range consistency, managing external side effects, or correcting itself after failure.

    The pain points fall into four categories:

    1. Context bloat and drift. As steps accumulate, history quickly exceeds the window, key constraints get diluted, and the model starts to “forget” the original goal.
    2. Unreliable tool use. Vague tool descriptions, missing parameter validation, and unreadable error messages push the model into repeated trial and error, sometimes even loops.
    3. Planning disconnected from execution. Plans stay at the natural language level and cannot be mapped to verifiable subtasks and artifacts.
    4. No quality gate. Without evaluation and regression mechanisms, whether a change is an improvement can only be judged by subjective impression.

    The value of the harness is to solve these four problems in engineering terms, turning model output from “looks correct” into “verifiably correct.”

    3. Layered Harness Design

    A maintainable carrier layer is usually split into five layers, top to bottom:

    • Interface layer: the session entry point for users or upstream systems, handling authentication, rate limiting, and streaming output.
    • Orchestration layer: the task planner, state machine, and scheduler that decide “what to do next.”
    • Capability layer: the tool registry, plugin loader, and permission and sandbox policies.
    • State layer: context storage, workspace files, cache, and vector retrieval.
    • Observability layer: logs, metrics, traces, and evaluation datasets.

    The point of this layering is decoupling: the model can be swapped, tools can be extended, and evaluation can evolve independently, while the orchestration logic stays stable.

    4. The Architectural Trade-off of Everything as a Plugin

    “Everything as a plugin” is a common design idea for the carrier layer: models, tools, retrievers, planning strategies, and evaluators are all registered as plugins and connected through a unified contract. At its core is a minimal plugin protocol:

    1. class Plugin:
    2. name: str
    3. schema: dict # Machine-readable description of parameters and returns
    4. def run(self, ctx, **kwargs): ...

    The registry scans plugins at startup and generates a tool manifest that is injected into the context. At runtime, the orchestration layer validates arguments against the schema and routes to the concrete implementation. Sketch of the flow:

    1. registry = Registry()
    2. registry.register(FileReadPlugin(), ToolPlugin(), TerminalPlugin())
    3. plan = planner.build(goal, tools=registry.manifest())
    4. for step in plan.steps:
    5. result = registry.dispatch(step.tool, ctx, **step.args)
    6. ctx = ctx.append(step, result) # Feedback collection
    7. if evaluator.passed(ctx, step): # Evaluation gate
    8. continue
    9. plan = planner.revise(plan, ctx)

    The payoff of pluginization is horizontal scalability and an open ecosystem; the cost is higher contract governance overhead. Versioned schemas, capability declarations, and the principle of least privilege are therefore required, so plugins do not become a new source of instability.

    5. Context Management Is the First Lever for Stability

    Context management usually involves four mechanisms: layered memory (system constraints, task state, recent interactions, long-term facts), on-demand retrieval (handing large repositories and documents to retrieval instead of injecting everything), compressive summarization (structured archiving of completed steps), and isolation (subtasks use separate contexts to prevent cross-contamination).

    A practical rule: keep “constraints” in a stable position, hand “facts” to retrieval, and compress “process” into conclusions. Even across hundreds of steps, the model can still stay aligned with the original goal.

    6. Safety Boundaries for Tool Invocation and Sandboxed Execution

    Tool invocation should follow four steps: declare, validate, execute, and collect. The declaration stage provides a machine-readable schema and a side-effect level. The validation stage checks types, ranges, and permissions. The execution stage runs in a sandbox with restricted filesystem and network egress. The collection stage returns stderr, exit codes, and elapsed time in a unified structured form, making it easier for the model to correct itself.

    For high-side-effect capabilities such as file read/write, code modification, and terminal execution, it is advisable to add approval policies and rollback-capable snapshots, with least privilege as the default. In enterprise environments, general cloud capabilities such as container platforms, object storage, log services, and monitoring and alerting can be combined to build isolated execution and full-chain observability.

    7. Evaluation Loops: Making Improvement Measurable

    A carrier layer without evaluation cannot evolve. In practice, three levels of evaluation should be established: unit level (correctness rate of a single tool call), task level (end-to-end completion rate and number of reworks), and regression level (stable comparison on a fixed dataset). Every time the context strategy or a plugin implementation changes, run the regression set and let data, not intuition, decide whether to keep the change.

    1. Fix the contracts first: define the plugin protocol and context structure before expanding features.
    2. Start from a narrow scenario: pick tasks with controllable side effects and automatically verifiable results, such as code modification and test fixing.
    3. Observability first: have logs, traces, and metrics in place on day one instead of backfilling instrumentation later.
    4. Open the ecosystem gradually: build the plugin marketplace and the permission system in parallel.
    5. Adapt the team shape: bring model, platform, and product capabilities into a single product team to shorten the path from capability to delivery.

    9. Conclusion

    “Model + carrier layer = agent” reminds developers that an agent’s competitiveness comes not only from the model but also from the engineering maturity of the carrier layer. Make context, tools, planning, execution, and evaluation into pluggable, observable, and regression-testable infrastructure, and model capability can truly turn into stable product value.