Agent Runtime Architecture Evolution: Plugin-Based Harness Design and Practice
This article explains why model benchmark scores are no longer the only metric that matters for AI agents, and how the surrounding harness runtime shapes task completion, token cost, latency, and safety. It compares two mainstream engineering routes—the turnkey closed-loop runtime and the microkernel composable runtime—outlines six capability layers that must be designed explicitly in a plugin-based architecture, and offers role-specific advice for developers, new graduates, and traditional programmers.
1. The Underrated Middle Layer: Why Benchmark Scores Are No Longer the Only Metric
For the past two years, discussions of AI capability have almost defaulted to model evaluation scores. In real business settings, however, a clearer consensus is forming:
Agent capability ≈ LLM (reasoning and decision-making) × Harness runtime (execution, scheduling, constraints, environment)
The harness is the runtime layer wrapped around the model that actually lets it get things done. It translates the intent in model output into executable actions, and manages tool calls, processes and the file system, the context window, failure retries, permission approvals, and audit trails. The model is the brain; the harness is the hands and feet, the scheduling hub, and the security boundary.
This explains a common phenomenon: the same model, paired with a different runtime, can show significant gaps in task completion rate, token consumption, end-to-end latency, and safety. The reasons are not mysterious:
- Different context organization directly determines effective information density and the share of wasted tokens.
- Different tool descriptions and error-return formats determine whether the model can self-correct.
- Different sandbox and permission models determine whether risky actions are blocked or executed.
- Different loop termination conditions determine whether a task converges or falls into repeated probing.
Evaluating an agent runtime should therefore cover four dimensions—architectural orientation, capability boundaries, extension cost, and security model—rather than only which model it supports.
2. Two Mainstream Engineering Routes: Turnkey Closed Loop vs. Microkernel Composability
Route 1: The turnkey closed-loop runtime
Solutions in this category package the agent main loop, sandbox isolation, contract-based tool constraints, human approval, context compression, and tracing as built-in components. Developers do not modify the kernel; they embed the agent into business systems through configuration, SDK calls, or a standalone service process.
The advantages are a complete security system, validation at large engineering scale, and a short path to production—enterprises can essentially move in ready to live. The constraints are equally clear: the core loop cannot be modified, leaving limited room for deep optimization; adaptation is best for the vendor’s own models, while third-party models require an extra adaptation layer; external community code is merged only to a limited extent, so evolution depends mainly on official releases.
It is more like a fully finished home: plumbing, wiring, and security are all in place, but the load-bearing walls cannot be moved.
Route 2: The microkernel composable runtime
Solutions in this category use a microkernel as the base and abstract the scheduling loop, sandbox, storage, memory layer, model adapters, and interface layer into replaceable plugins. Developers can rewrite nearly all core flows, and can even orchestrate other AI coding tools as sub-agents.
The advantage is very high freedom, which suits differentiated capabilities and research-oriented exploration. The cost is that you take on responsibility for consistency and security design yourself, while version governance, plugin compatibility, and fault localization all become significantly more complex.
It is more like a bare shell with free-form renovation: you can change anything you want, but you handle the plumbing and wiring inspection yourself.
Neither route is absolutely better. There is only one criterion: whether you need to modify the main loop. If not, choose the closed loop; if yes, choose composability.
3. Key Implementation Points for a Plugin-Based Architecture
If you choose the composable route, the following six capability layers must be designed explicitly rather than patched on afterward.
- Scheduling and loop control: define per-step timeouts, maximum step counts, repeated-action detection, and termination conditions to avoid infinite loops burning tokens.
# Example: a scheduling loop with budget and termination conditionsdef run(task, budget):ctx = Context(task)for step in range(budget.max_steps):if budget.exhausted():return Result(status="budget_exceeded", ctx=ctx)action = model.decide(ctx.render())if action.type == "tool":obs = sandbox.invoke(action.tool, action.args, timeout=30)ctx.append(obs) # tool errors must also be returned so the model can self-correctelse:return Result(status="done", answer=action.text)ctx.compress(keep_recent=8) # context compression strategy as a plugin
- Sandbox and permissions: file system and network access default to least privilege; write operations and external calls go through an allowlist; high-risk actions require mandatory human approval.
- Contract constraints: tools declare inputs and returns with a structured schema, and parameter validation failures reject execution outright, avoiding feeding dirty data back to the model.
- Memory and storage tiering: separate short-term context, task-level memory, and long-term cross-session memory, with hot and cold data landing in memory, databases, and object storage respectively.
- Observability: trace every model call and tool call across the full chain, record input summaries, elapsed time, and token counts, and pair this with logging services and monitoring alerts to locate anomalies.
- Model adapters: converge model differences behind a unified interface, making it easy to run multi-model canary releases and cost comparisons within the same runtime.
4. Recommendations by Role
- Regular developers: shift focus from “tuning prompts” to “designing tools and environments,” and master context engineering, evaluation set construction, and failure replay—capabilities that transfer across runtimes.
- New graduates: prioritize operating systems, concurrency, permission models, and distributed systems fundamentals. Runtime engineering is essentially systems engineering, not text tricks.
- Traditional programmers: existing skills retain high value. Sandboxes, approval flows, auditing, rate limiting, and tracing are all familiar backend topics—only the executing subject changes from humans to models.
5. Conclusion
The second half of the agent competition is not about parameter scale but about runtime quality. Whether you choose a closed loop or composability, the same set of engineering metrics decides success: task completion rate, cost per task, risk interception rate, and operability. To build quickly on a controllable base, you can use general-purpose capabilities such as Baidu AI Cloud’s container platform, object storage, logging service, and monitoring alerts to first close the loop on sandboxing, auditing, and metering, then progressively replace plugins and evolve the architecture.
