Two Approaches to Agent Harness Design: Lightweight Core vs. Everything-as-a-Plugin

    Agent runtime frameworks, or Harnesses, can follow two design paths: a small core with extensions built around it, or a core in which every component is a replaceable plugin. This article compares the two approaches on extensibility, code footprint, upgrade cost, and operational risk, and suggests which one fits business teams and platform teams.

    Why Harness Architecture Becomes a Bottleneck Before Model Capability

    A large language model solves the problem of single-turn inference. An agent must solve the problem of completing tasks continuously. Between the two sits a substantial engineering layer. The Agent Loop handles planning and execution. Tool calling connects the agent to the outside world. Session management maintains context and state recovery. Streaming delivers real-time feedback. CLI, TUI, and Web interfaces let humans intervene. Observability helps locate the cause of failures.

    Together, these layers form the agent runtime framework, called the Harness. Model capability determines whether an agent can reason well. The Harness determines whether the agent can carry out work reliably. For this reason, Harness architecture often becomes a development bottleneck sooner than model selection does.

    Harness designs in common use fall into two broad approaches. One holds that the core should be as small as possible, with all extensions placed on the outside. The other holds that everything is a plugin, and even the Agent Loop should not be hard-coded. Both approaches emphasize extensibility, but they define the boundary of extension in fundamentally different ways.

    Route 1: Lightweight Core, Heavy Plugins, SDK-Based Delivery

    Design Motivation

    The basic belief behind this route is that most developers do not need to modify the agent’s core loop. They need a stable core with clear extension points.

    The core layer therefore handles only the most basic work:

    • Maintaining the basic execution order of the Agent Loop;
    • Managing session lifecycle and context;
    • Calling the model adapter layer;
    • Handling streaming output and basic errors;
    • Providing a unified entry point for plugin registration.

    Everything else sits outside the core. This includes model provider adapters, tool collections, the command-line interface, the terminal interface, session persistence, and the plugin mechanism. Users can create a session and run tasks through the official SDK. They can also connect custom tools through the plugin protocol without forking the core.

    This design usually produces a “light core, heavy periphery” shape in terms of code size. The core can stay fairly restrained. However, once the full deliverable includes model adapters, the streaming protocol, CLI/TUI, session management, the tool set, and the plugin mechanism, the total code can still grow past 100,000 lines. In other words, a lightweight core does not mean a lightweight project. The complexity moves from “you must understand the core” to “you can load the periphery on demand.”

    Extension Model: Plugins and SDK Together

    From an engineering perspective, the typical user path on this route is:

    1. Call the SDK to create an agent session;
    2. Register custom tools or callbacks through the plugin interface;
    3. Configure the model, prompts, and context strategy at the session level;
    4. Embed the agent into an existing business system.

    A representative code example looks like this:

    1. from agent_sdk import create_session
    2. session = create_session(
    3. model_config="...",
    4. tools=[web_search, code_runner],
    5. session_store="redis",
    6. )
    7. result = session.run("Analyze this log and suggest a fix")

    The plugin mechanism can be extended further:

    1. register_plugin("tool.http_request", HttpTool(timeout=30))
    2. register_plugin("middleware.audit", AuditMiddleware())

    This model suits business teams well. The framework maintains the core logic, and business differences are expressed through plugins and configuration. When the framework is upgraded, teams do not need to migrate large amounts of custom code.

    Advantages

    First, stability is easier to maintain. A smaller core presents a smaller surface for breakage and lowers the cost of regression testing.

    Second, the upgrade path is clear. If users have not modified the core, a framework upgrade only requires verifying plugin compatibility. If users have heavily forked the core, every upstream update requires a fresh merge, and the cost can quickly get out of control.

    Third, the framework is well suited to integration as an SDK. Many enterprises do not want to build a standalone agent product. They want to embed agents into ticketing systems, operations platforms, or customer service systems. An SDK-based Harness can significantly reduce integration complexity.

    Fourth, a community and ecosystem form more easily. The clearer the extension points, the more obvious it is to third-party developers where their code belongs. They do not need to guess at the framework’s internal structure.

    Trade-offs

    The lightweight core route has clear limitations. To keep the core stable, the framework abstracts many capabilities into plugin interfaces. When those interfaces are not well designed, users may find that the change they want has no matching extension point. They then have to modify the core or work around the framework.

    Another risk is that the plugin interface can become a “hidden second core.” Once a large amount of low-level logic is exposed to the plugin layer, the plugin protocol effectively becomes a public API that is harder to maintain than the core itself. If a later version needs to change internal implementation, it may be constrained by the compatibility of existing plugins.

    Route 2: Everything Is a Plugin, Even the Core Is Just a Host

    Design Motivation

    This route is more aggressive than the lightweight core route. It does not stop at providing extension points. It holds that any component can be replaced. The Agent Loop, model adapters, streaming output, the file system, tool executors, session storage, UI panels, and even the Harness’s own scheduling logic are all plugins.

    Under this architecture, the core resembles an “empty socket.” It provides no concrete Agent Loop, binds to no particular model protocol, and fixes no file system implementation. It only connects the components and maintains their lifecycles and message contracts.

    Why an “Empty Socket” Is Not Necessarily Lightweight

    This route has a counterintuitive consequence. Once the Agent Loop, model calls, HTTP/SSE transport, and tool execution are all moved out of the core, the remaining “pure framework” may not be lighter than a lightweight core approach.

    The reason is that an empty socket must carry a large amount of abstraction work:

    • Defining unified interfaces across plugins;
    • Managing dependency injection and component lifecycles;
    • Propagating context and tracing call chains;
    • Unifying error handling and retry strategies;
    • Designing session serialization and recovery;
    • Maintaining state consistency during hot swapping;
    • Providing a replayable event log.

    Each of these capabilities requires a lot of code. As a result, if the Agent Loop and other business components are removed, the remaining abstraction layer may still exceed 10,000 lines, and possibly much more. It appears to contain nothing, but in practice everything must be turned into an interface. This design does not reduce the amount of code. It increases the freedom to replace components.

    Typical Use Cases

    This route suits teams that need deep customization of the Harness itself.

    For example, a team may want to replace the local file system with a sandboxed one to limit the agent’s effect on the host machine. On the lightweight core route, this might be handled as a single tool plugin. On the everything-is-a-plugin route, the file system itself can be swapped as a pluggable component.

    A team may also want to experiment with a new Agent Loop. Instead of the simple “think, call a tool, continue” pattern, the loop might follow a “plan, execute, verify, reflect” cycle. In an everything-is-a-plugin architecture, the Agent Loop implementation can be replaced directly, rather than adding callbacks to a fixed loop.

    Another category is Harness “self-evolution.” Since every component is a plugin, an agent could in theory inspect its runtime environment, register new plugins, replace old ones, and even modify its own execution strategy. This capability fits AI research experiments. In production, it requires strict permission controls and audit mechanisms.

    Session replay is also a common need. As long as all components communicate through a unified event channel, the framework can record the complete event stream and replay it during debugging. This is valuable for locating behavioral deviations in multi-turn conversations.

    Costs and Risks

    The everything-is-a-plugin approach has real costs. First, the learning curve is steeper. Developers must understand not only the business logic but also the plugin protocol, dependency injection, lifecycles, and event propagation. LEGO is a fitting comparison: there are many bricks and strong combinatorial power, but building a working system requires understanding the entire instruction manual first.

    Second, many users do not need to replace the Agent Loop, and they do not want to write model adapters. They may only want to change the style of the default Web interface or add a button. In an everything-is-a-plugin architecture, even these changes may be packaged as “replacing a component,” which pushes users into a deeper abstraction layer than they need.

    Third, debugging can become harder. Because components can be hot swapped, the runtime combination of components becomes dynamic. The same error may appear under different plugin combinations and behave differently each time. Without strong logging, tracing, replay, and version tagging, locating problems can be very time-consuming.

    Fourth, security boundaries must be redesigned. When the file system, model calls, and tool execution can all be replaced, plugins gain very high privileges. If plugin sources are not controlled, a malicious plugin could bypass the original security mechanisms. Plugin signing, permission declarations, sandbox isolation, and audit logs therefore become required infrastructure rather than optional features.

    Key Differences Between the Two Routes

    Dimension Lightweight Core Route Everything-Is-a-Plugin Route
    Core responsibility Keeps a minimal Agent Loop, sessions, and model calls Keeps only component connections and contracts, with no fixed business implementation
    Code size profile Small core, large periphery Heavier abstraction core, highly componentized overall
    Extension method Plugins, SDK, callbacks, configuration Replace any component, hot swapping, runtime composition
    Target users Business developers, enterprise integration teams Platform engineers, AI research teams
    Learning cost Low to medium; only extension points need to be understood Higher; the entire component model must be understood
    Upgrade and maintenance Easier, as long as the core is not forked The deeper the customization, the harder the upgrades
    Customization freedom High, but limited by available extension points Very high; almost nothing is fixed
    Production risk Plugin compatibility and insufficient extension points Over-abstraction, loss of permission control, harder debugging

    Selection Guidance and Adoption Boundaries

    For most business teams, I recommend starting with the lightweight core route. The reason is straightforward. The goal of a business team is not to invent a new Harness. It is to solve business problems with agents. A stable core, a clear SDK, and a manageable plugin system protect delivery speed and long-term maintainability.

    If you choose the lightweight core route, pay close attention to the stability of the plugin protocol. Do not depend on the framework’s internal implementation in business code. Use only the public extension points where possible. You should also set up plugin compatibility tests to catch silent failures after framework upgrades.

    For platform teams and AI research teams, the everything-is-a-plugin route can offer far more room to experiment. If the goal is to explore Harness self-evolution, sandboxed execution, multi-agent collaboration, or custom reasoning loops, this architecture can support faster iteration. Adopting it, however, requires strict governance:

    • Plugins must declare their permissions to prevent unauthorized access;
    • All component versions must be traceable;
    • Hot-swap operations need approval and rollback mechanisms;
    • The runtime environment must be isolated from the host machine;
    • Critical paths must retain complete session replay and audit logs.

    A hybrid approach is also possible. Offer a lightweight SDK and a stable plugin system externally, and keep a deeply customizable experimental Harness internally. This serves ordinary developers while still letting the platform itself evolve quickly.

    Finally, lines of code are not the only measure of a Harness’s quality. A lightweight core route is not necessarily easy, and an everything-is-a-plugin route is not necessarily complex. What determines the experience is whether the extension boundaries are clear, whether the plugin protocol is stable, and whether the documentation and debugging tools are complete. When choosing between them, do not only ask whether the framework can be extended. Ask whether your team is willing to bear the cognitive and maintenance costs that come with the chosen extension model.