Open Source Agent Harness: Reshaping AI Agent Infrastructure
This article examines why the runtime system, known as an Agent Harness, is becoming the new bottleneck for AI agents in engineering environments. It clarifies four commonly confused concepts—model, protocol, framework, and harness—and explains the engineering meaning of a plugin-based "everything is a plugin" architecture, including dependency inversion, startup assembly, runtime replacement, and observable dependency graphs. It then breaks down seven key subsystems: model adapters, the agent loop, tool registry, session and log persistence, sandbox and approval, context compression, and sub-agents with a web interface. The article closes with practical recommendations on defining boundaries, observability, tool design, cost guardrails, and managing preview-stage compatibility risks.
1. Why the Runtime System Is Becoming the New Bottleneck for Agents
Over the past two years, most industry attention on AI agents has focused on model capabilities: longer context windows, stronger reasoning, and more reliable structured output. But once agents move into real engineering environments—reading and writing files, executing commands, querying databases, driving browsers, and running unattended for long periods—the focus shifts. The key question becomes whether the runtime system that hosts the model is reliable, observable, and scalable enough.
This execution environment built around the model is commonly called an Agent Harness. A recent open source project introduced a plugin-centric agent harness with the positioning “everything is a plugin.” It is driven at the core by dependency injection and a plugin container, and it is currently in developer preview, with the maintainers explicitly warning that breaking changes may follow. What makes it worth attention is not that it is “another AI coding tool,” but that it decomposes an agent into a plugin tree that can be reassembled at startup and replaced or unloaded at runtime: model adapters, the main agent loop, the tool registry, session logs, the sandbox, approvals, context compression, sub-agents, and even the web interface all exist as plugins.
Setting aside the specific product, this article discusses a general technical question: what should next-generation agent infrastructure look like?
2. Clarifying Four Commonly Confused Concepts
To understand the value of a harness, you first need clear boundaries.
1) A model is not an agent. A model receives messages and generates the next piece of text or tool-call intent. It does not know the current working directory, the process environment, or the file system state, and it does not inherently have command execution, editing, version control, browser, or database access. A model outputting the intent to “read a file” does not mean the file has been reliably read.
2) A protocol is not an agent. Standardized approaches such as the Model Context Protocol address how tools, resources, and prompts are uniformly exposed and discovered, but they do not provide a complete task loop, session recovery, context compression, permission decisions, or execution state management.
3) A framework is not the same as a harness. Development frameworks centered on graph orchestration and chained calls are oriented toward helping developers build business flows. A harness is closer to a complete, ready-to-run execution environment: it not only describes how nodes connect, but also actually handles model requests, tool dispatch, process execution, log persistence, user approval, and the interaction interface.
4) A prompt is not a runtime. Prompts influence model behavior tendencies, but they cannot provide transactionality, idempotency, rollback, or auditability.
In short: the model is the brain, the protocol is the interface specification, the framework is the scaffolding, and the harness is the “operating system” that actually gets the agent running and keeps it running.
3. The Plugin Core: What “Everything Is a Plugin” Means in Engineering
“Everything is a plugin” is not a marketing slogan; it is a strong constraint on replaceability. Its engineering meaning includes at least four layers:
- Dependency inversion: The core loop depends only on abstract interfaces, not concrete implementations. A model adapter only needs to implement a unified contract of “input message sequence, output messages and tool calls.”
- Startup assembly: At startup, configuration determines the plugin set and order, forming a plugin tree. The same core can be assembled into a “local file-based agent,” a “cloud container-based agent,” or a “read-only analysis agent.”
- Runtime replacement: A capability can be hot-swapped without restarting the process—for example, switching the logging backend from local files to a centralized logging service.
- An observable dependency graph: The plugin container typically has dependency resolution and lifecycle management, making it clear who depends on whom and when each plugin is initialized and destroyed.
Illustrative configuration (pseudocode, expressing only the assembly idea):
harness:plugins:- model_adapter: { id: local_llm, order: 10 }- agent_loop: { id: default_loop, order: 20 }- tool_registry: { sources: [builtin, mcp_gateway] }- sandbox: { type: container, network: none }- approval: { policy: ask_on_write }- context: { strategy: summarize, threshold: 0.7 }- session_store: { backend: object_storage }- sub_agent: { max_depth: 2 }- web_ui: { enabled: true }
The direct benefit of this design is separation of concerns: changes to the model provider, the way tools are integrated, or the approval policy are all confined within a single plugin boundary and do not pollute the main loop.
4. Seven Key Subsystems of a Harness
4.1 Model Adapter
It converts the internal unified message format into the format required by a specific model interface, and handles streaming output, tool-call parsing, error retries, and rate-limit backoff. The adapter makes “switching models” a configuration action rather than a refactoring effort.
4.2 The Main Agent Loop
The typical form is an iterative “reason—call—observe—reason again” cycle: the model proposes the next action, the runtime executes it and feeds back the result, repeating until the task is complete or a termination condition is triggered. Engineering practice must explicitly design maximum iterations, timeouts, repeated-action detection, and termination reasons; otherwise the agent easily falls into unproductive loops and runaway costs.
4.3 Tool Registry
It centrally manages built-in and external tools, handling parameter schema validation, permission annotations, idempotency declarations, and call auditing. The quality of tool descriptions directly determines how accurately the model selects tools, so the registry should support versioning and gradual rollout.
4.4 Session and Log Persistence
Sessions need to support recovery: record each step’s messages, tool calls, return results, and state snapshots so that the process can continue from a checkpoint after a crash. Logs should be structured to make it easy to integrate with general logging services and monitoring and alerting systems.
4.5 Sandbox and Approval
When executing untrusted code, isolation is the baseline: containerized execution, least privilege, read-only mounts, network disabled by default, and resource quota limits. The approval plugin routes high-risk actions (deletion, writes to production, sending data externally) to human confirmation, forming a “deny by default, allow on demand” policy.
4.6 Context Compression
Long tasks inevitably overflow the context window. Common strategies include sliding windows, summary-based compression, relevance-based retrieval and reinjection, tool-result truncation, and externalizing structured memory. The key principle is traceability: compression must not lose audit clues.
4.7 Sub-Agents and the Interaction Interface
Sub-agents are used for task decomposition and parallel exploration, and need limits on recursion depth and total budget. The web interface handles human-agent collaboration, displaying the execution trace and supporting interruption and takeover.
5. Practical Recommendations
- Define boundaries before choosing a model: Clarify which actions may run automatically and which require approval.
- Treat observability as a first-class concern: Instrument the trace, elapsed time, token consumption, and tool failure rate as metrics.
- Follow the principle of least surprise in tool design: Clear naming, minimal parameters, and actionable error messages.
- Put cost guardrails in place early: Set iteration limits, budget caps, and concurrency caps.
- Account for preview-stage risk: For open source components in preview, pin versions, keep a rollback path, and reserve an adaptation layer for breaking changes.
6. Conclusion
Competition in agent infrastructure is shifting from “how strong the model is” to “how stable the runtime system is.” The harness approach centered on a plugin tree writes replaceability, observability, and governability into the architecture itself. The takeaway for developers is clear: when building agents, design the runtime skeleton first, then let the model deliver its capabilities within it. For enterprises looking to accelerate adoption on this basis, Baidu AI Cloud’s general capabilities in container platforms, object storage, logging services, and monitoring and alerting can support an auditable, extensible foundation for running agents.
