The Agent Formula Explained: Model Plus Runtime Equals Agent

    This article breaks down the engineering formula Agent = Model + Harness, explaining why an agent is more than a larger model. It defines the responsibilities and limits of the model layer, details the seven core runtime capabilities (context management, tool calling, task planning, execution environment, feedback collection, evaluation loops, and observability), and shows how a plugin-based architecture keeps the system extensible. It also outlines a four-step path to a minimal working implementation, common anti-patterns to avoid, and how to combine the design with general-purpose cloud capabilities.

    1. Why the Formula “Model + Runtime = Agent” Matters

    A common misconception in engineering practice is equating an agent with “a bigger model.” In real projects, the model only provides understanding, reasoning, and generation. On its own, it cannot access files, execute commands, call external systems, or maintain long-range state. The industry has gradually converged on a simple engineering formula:

    1. Agent = Model + Harness

    Here, the Harness can be translated as the “runtime” or “carrier layer,” referring to all engineering elements outside the model. It constrains the model’s probabilistic output into a workflow that is executable, rollback-capable, and verifiable. The value of the formula is not conceptual novelty but a clear division of responsibility: the model handles “thinking,” while the runtime handles “doing” and “managing.”

    This division yields three direct benefits. First, replaceability: models can be swapped based on cost, latency, and capability without rewriting the business side. Second, governability: permissions, auditing, rate limiting, and data masking are implemented centrally in the runtime rather than scattered across prompts. Third, evaluability: measuring “model performance” and “orchestration performance” separately avoids mistaking engineering defects for insufficient model capability.

    2. The Model Layer: Capability Foundation and Boundaries

    The model layer’s responsibilities should be strictly limited to three things: understanding input intent, performing multi-step reasoning, and generating structured or natural-language output. To keep the model working reliably, its boundaries must be explicit.

    • Statelessness: a single call retains no memory; cross-turn state must be passed in explicitly by the runtime.
    • Output uncertainty: the same input may produce different phrasing, so downstream steps must validate structure and retry.
    • Limited context: the window is a scarce resource that needs budgeted management rather than unlimited stacking.
    • No side effects: the model cannot directly change the external world; all side effects happen through tool execution.

    Therefore, prompt engineering is only surface-level work in the model layer. What truly determines the product’s ceiling is how the runtime organizes information, constrains actions, and collects feedback.

    3. The Runtime Layer: Connecting the Model to Real Workflows

    The runtime is the largest and most underestimated part of the formula in terms of engineering effort. It includes at least seven categories of capability.

    3.1 Context Management

    Context management is not “stuffing in all the history” but making trade-offs within a limited budget. A layered organization is recommended in practice:

    1. [System constraints] role, safety boundaries, output format
    2. [Task goal] current objective and acceptance criteria
    3. [Long-term memory] structured summaries, user preferences
    4. [Retrieved snippets] material strongly related to the current step
    5. [Recent trajectory] tool calls and results from the last few steps
    6. [Available tools] name, purpose, parameter schema, limits

    The key practices are summary compression, relevance retrieval, and budget allocation. Set a quota for each content type; when the limit is exceeded, compress historical trajectory first while preserving the goal and acceptance criteria.

    3.2 Tool Calling

    Tools are the model’s only channel to the real world. Design points include clear positive naming, parameter schemas with examples, explicit failure semantics (retryable or not), and unified timeout and idempotency policies. The quality of tool descriptions often affects the success rate more than the choice of model.

    1. {
    2. "name": "read_file",
    3. "description": "Reads the text content at the specified path and returns line numbers and content",
    4. "parameters": {
    5. "path": "string, relative path",
    6. "max_lines": "integer, default 200"
    7. },
    8. "errors": ["not_found(retryable=false)", "timeout(retryable=true)"]
    9. }

    3.3 Task Planning

    The essence of planning is breaking a vague goal into verifiable sub-goals. A three-stage approach is recommended: plan first, execute next, then verify. First produce a list of steps and acceptance conditions, then execute step by step, and finally self-check against the acceptance conditions. High-risk actions should require explicit confirmation, and long tasks should have checkpoints to avoid deviation accumulating from a single long execution chain.

    3.4 Execution Environment

    Capabilities such as file reading and writing, code modification, and terminal execution require sandbox isolation, least privilege, and resource quotas. All write operations should support diff preview and rollback; all command execution should have an allowlist and audit logs. The execution environment is the first gate of the security boundary.

    3.5 Feedback Collection

    Tool return values are the main basis for the model to correct its own judgment. Feedback should be structured, concise, and include error codes and remediation suggestions. Avoid feeding large blocks of raw logs directly back, which causes context pollution and noise amplification.

    3.6 Evaluation Loop

    Without evaluation there is no iteration. A three-level evaluation is recommended: single-step tool-call accuracy, task-level completion rate, and regression test suite pass rate. Automatically archive failed samples as regression cases, forming a “failure as an asset” cycle.

    3.7 Observability

    For each run, record the trace identifier, step latency, token consumption, and tool error distribution. Observability data is used both for troubleshooting and for cost optimization and capacity planning.

    4. Plugin-Based Architecture: Everything Is a Plugin

    Organizing the runtime in an “everything is a plugin” way can significantly improve extensibility and collaboration efficiency. Model adapters, tool sets, retrieval strategies, planners, evaluators, and audit policies are all registered as plugins and assembled through a unified contract.

    1. class Plugin:
    2. name: str
    3. def setup(self, ctx): ...
    4. def handle(self, payload): ...
    5. def teardown(self): ...
    6. registry = {}
    7. def register(plugin):
    8. registry[plugin.name] = plugin

    There are three constraints for pluginization. First, stable contracts: plugins do not reference each other directly. Second, declarative capabilities: plugins must describe the permissions and resources they need. Third, pluggable degradation: when a critical plugin is missing, the system enters a restricted mode rather than failing entirely. This way, teams can develop tool plugins and evaluation plugins in parallel without changing the trunk.

    5. A Path to a Minimal Viable Implementation

    A four-step approach is recommended to avoid building a complex framework from the start.

    1. Close the loop: one model call plus two read-only tools to get “plan-execute-feedback” working end to end.
    2. Add constraints: complete output schema validation, timeout retries, and audit logs.
    3. Introduce evaluation: accumulate more than twenty real task cases and establish baseline metrics.
    4. Refactor into plugins: split tools, retrieval, and evaluation into plugins supporting hot-plugging and canary rollout.

    A sample main loop is as follows:

    1. while not done and steps < MAX_STEPS:
    2. plan = model.plan(goal, context)
    3. for action in plan.actions:
    4. result = runtime.invoke(action) # sandboxed execution + audit
    5. context.append(result.summary()) # structured feedback
    6. done = evaluator.check(goal, context) # acceptance criteria check

    6. Common Anti-Patterns and How to Avoid Them

    • Writing safety rules into prompts: they should be pushed down to the runtime’s permission and validation layer.
    • Unlimited history stacking: compress by budget while preserving the goal and acceptance criteria.
    • Vague tool descriptions: provide parameter schemas, examples, and error semantics.
    • Missing evaluation: build a regression set from real tasks and quantify every change.
    • Single long-chain execution: add checkpoints and human confirmation nodes.

    7. Working with General-Purpose Cloud Capabilities

    When deploying an agent system, you can reuse general-purpose cloud capabilities: use a container platform to host the sandboxed execution environment, object storage to save run artifacts and diff snapshots, a message queue to asynchronously decouple long tasks, logging and monitoring/alerting services to build an observability system, and key management to host credentials. These are all common industry categories; specific choices should be evaluated based on compliance, cost, and operational capability.

    8. Conclusion

    The real meaning of “model + runtime = agent” is moving the agent’s complexity from prompts to engineering structure. The model determines the capability ceiling; the runtime determines the deployment floor. Only when context is budgeted, tools are contract-based, planning is acceptance-driven, execution is sandboxed, and results are evaluated does an agent move from a demo to something deliverable. For developers, getting a minimal loop working first and then gradually moving to plugins is the lowest-risk path with the most certain returns.