The Universal Formula for Agent Development: Model Plus Harness
This article breaks down the widely used formula Agent = Model + Harness, explaining why the harness—not the model—usually determines whether an agent can actually deliver. It walks through the six core modules of an execution framework (context management, tool calling, task planning, state and file operations, terminal and code execution, and feedback with evaluation loops), then offers a reference layered architecture, practical adoption advice, and common pitfalls to avoid.
1. What the Formula Really Means: Turning “Reasoning” into “Delivery”
In agent engineering, the industry often summarizes system design with a highly abstract formula:
Agent = Model + Harness
The Model is the large language model with capabilities for understanding, reasoning, and generation. It is the cognitive foundation of the entire system. The Harness refers to all engineering work outside the model—the execution framework required to connect the model to a real workflow. Only when the two are combined do you get an agent that can enter a live business environment and take on concrete tasks.
The value of this formula is that it clarifies the boundary of responsibility: the model is responsible for “thinking it through,” while the execution framework is responsible for “getting it done, keeping it stable, and making it verifiable.” When agent projects underperform, the problem is often not the model itself but a missing harness—without context management, the model forgets constraints; without tool calling, the model cannot reach real data; without an evaluation loop, quality regressions go undetected.
2. The Six Core Modules of an Execution Framework
2.1 Context Management
Context is the agent’s short-term memory and workbench. Engineering here needs to solve three problems. First, budget allocation: partition the limited context window into quotas for system constraints, task goals, retrieved material, conversation history, and tool results. Second, compression and summarization: apply layered summarization to stale content while preserving decision-critical information. Third, retrieval injection: fetch fragments from a knowledge base or object storage on demand instead of stuffing everything in at once.
Illustrative context assembly logic:
def build_context(system, task, history, retrieved):budget = 8000parts = [("system", system), ("task", task)]for doc in retrieved[:5]:parts.append(("ref", doc.snippet))for turn in history[-6:]:parts.append(("hist", turn))return truncate_by_token(parts, budget)
2.2 Tool Calling
Tools are the interface layer between the model and the outside world. Key design points include: write clear semantic descriptions and parameter schemas for each tool so the model can select correctly; set idempotency keys and secondary confirmation for write operations; trim and structure returned results to keep noise from crowding out the context; and unify timeout, retry, and rate-limiting policies to prevent cascading failures.
2.3 Task Planning
The planning module breaks a vague goal into executable steps. A common approach is to generate a plan first, execute it step by step, and allow replanning based on observations. Engineering should cap the maximum number of steps and the maximum cost to avoid infinite loops, and set checkpoints at key nodes so the flow can be interrupted and resumed.
2.4 State and File Operations
Real workflows need to persist intermediate artifacts. Writing drafts, patches, and logs to a file system or object storage lets the model “think on disk” during long tasks and makes it easier for humans to step in and review. File reads and writes should be constrained by a directory allowlist to prevent unauthorized access.
2.5 Terminal and Code Execution
Executing commands and code in an isolated environment is a key capability for agents handling engineering tasks. The principle of least privilege must be followed, using a separate sandbox, read-only mounts, and resource quotas, with approval and audit records established for high-risk operations.
2.6 Feedback Collection and the Evaluation Loop
An agent without feedback cannot iterate. Tool returns, execution logs, and human corrections should be collected uniformly as structured signals, with offline evaluation sets and online monitoring alerts built on top. Use logging services and monitoring and alerting systems to track success rate, step count, latency, and cost, forming a “run—measure—improve” cycle.
3. Reference Architecture and Adoption Advice
A practical layered structure looks like this: an access layer handles sessions and permissions; an orchestration layer handles task planning and flow control; a capability layer wraps tools, retrieval, and execution sandboxes; a data layer carries state, logs, and evaluation samples; and an operations layer provides monitoring, alerting, and cost control.
Three principles are recommended when putting this into practice. First, close the loop on a narrow scenario, validate the formula with a single high-value task, then expand horizontally. Second, ship evaluation and runtime together, avoiding “launch first, add evaluation later.” Third, design permissions and auditing up front, especially for capabilities involving terminal execution and file writes.
4. Common Pitfalls
One is treating an agent as nothing more than a longer prompt while ignoring the engineering quality of the execution framework. Another is designing tools at too coarse a granularity, which makes selection difficult for the model and drives up the error rate. A third is lacking cost and step constraints, so tasks fall into repeated retries. A fourth is evaluation samples that are disconnected from the real distribution—metrics look good, but the live experience is poor.
5. Conclusion
“Model + Harness = Agent” reminds developers that model capability is only the ceiling; the execution framework determines the actual level of delivery. Build the six modules—context, tools, planning, state, execution, and evaluation—solidly, and carry runtime and operations on general cloud capabilities such as container platforms, object storage, logging services, and monitoring and alerting. Only then can model capability be reliably converted into measurable, evolvable productivity.
