Agent Harness Architecture: Minimal Kernel vs. Fully Plugin-Based Design

    This article compares two design approaches for Agent Harnesses, the runtime frameworks that manage agent loops, sessions, tool calls, and streaming output. A minimal kernel leaves most features to the ecosystem, while a fully plugin-based design makes even the agent loop replaceable. The article explains how kernel size, the baseline for extension, learning curves, and maintenance costs differ between the two, and offers guidance for choosing between them.

    1. Why the Harness Architecture Debate Matters

    As large language model applications move from single calls to long-running autonomous loops, the Agent Harness (the agent runtime framework) takes on more responsibility. It manages the Agent Loop, session state, tool calls, streaming output, terminal interaction, and other low-level capabilities. The industry has split into two distinct design philosophies over how much a harness should do.

    One is the “minimal kernel” approach. The kernel keeps only the minimum agent loop and model communication, and leaves everything else to the upper-layer ecosystem. The other is the “fully plugin-based” approach. Even the agent loop becomes a replaceable plugin. The framework provides a bare “empty socket,” and users assemble whatever they need.

    Neither approach is right or wrong in absolute terms. However, each shapes developer experience, learning curve, and maintenance cost. The sections below compare them along several key dimensions.

    2. Kernel Boundaries: The Design Trade-offs Behind Lines of Code

    The most direct measure of how heavy a harness is comes from its kernel lines of code (LoC). Still, the raw count does not tell the whole story.

    Take the minimal kernel approach. Its core package usually includes only the agent loop, model provider adapters, and streaming communication. These can fit in a few thousand lines of code. A kernel of this size has clear advantages:

    • Easy to audit: A senior engineer can read through a few thousand lines in a day or two, and fully understand how each model call and message flows through the system.
    • Lower upgrade risk: A smaller kernel means fewer breaking changes, and upper-layer dependencies stay more stable.
    • Less cognitive load: Users can reason about agent behavior without understanding complex internal mechanisms.

    The fully plugin-based approach goes further. It aims to remove the kernel entirely, making the agent loop and model communication layer pluggable components. However, a fact is easy to overlook. Even after the loop and communication modules are extracted, the remaining infrastructure, such as the runtime container, session logging, and plugin loading mechanism, often takes up roughly as much code as a minimal kernel. The “empty socket” still has weight. Plugin-based design shifts complexity from fixed code into composition and configuration, but the overall system does not get lighter.

    3. The Real Baseline for Extension: What Users Actually Build On

    A common point of confusion is what “extensibility” is measured against: the kernel, or the full distribution?

    Take the minimal kernel approach. Although the kernel has only a few thousand lines, a complete usable version usually also includes a command-line interface, a terminal UI (TUI), session management, a small set of basic tools, and a plugin mechanism. Together these can grow the codebase past 100,000 lines. Most developers who talk about “extending” a minimal kernel actually build on this full distribution, not on the bare kernel from scratch.

    This matters because it determines two typical forms of extension.

    1. Plugin-level extension (the officially recommended path)

    The official design intent is usually that developers do not need to fork or modify internal framework code. They inject custom capabilities at the plugin level. To support this, the framework exposes many of its lower-level capabilities to the plugin layer. For example:

    1. // Illustrative code: register a custom tool through a plugin
    2. export default function myPlugin(ctx: PluginContext) {
    3. ctx.registerTool({
    4. name: "query_database",
    5. description: "Run a read-only database query",
    6. parameters: { /* JSON Schema */ },
    7. execute: async (args) => {
    8. // Custom business logic
    9. return await runQuery(args.sql);
    10. },
    11. });
    12. }

    The advantage is that upgrades are painless and components can be shared across the ecosystem. The cost is that the plugin API surface must be large enough. Framework designers must keep balancing how much internal capability to expose against keeping the architecture clean.

    2. SDK-level embedding (the deep integration path)

    Teams that need heavy customization usually do not modify the source code. Instead, they use the harness as an SDK. For example, they call a factory method such as createAgentSession() to create a full agent session inside their own application, then take over its input and output. This is easier to maintain than forking, and more flexible than plugin development alone. It is a practical middle ground.

    Some teams choose the heaviest path and modify the full source code directly. This is common early in a project, but later version upgrades become extremely painful, so it is generally not recommended as a long-term strategy.

    4. The Fully Plugin-Based Approach: Freedom and Cost of LEGO-Style Assembly

    The core idea of the fully plugin-based approach can be summarized as “Everything is a Plugin.” Tools, prompts, and the agent loop itself are all replaceable plugins. This creates a “LEGO brick” experience. In theory, you can replace the loop with a custom state machine, swap the model layer for any provider adapter, or move session storage to any backend.

    This design is especially valuable in these scenarios:

    • Research: Teams that frequently experiment with different loop strategies, such as ReAct, Plan-and-Execute, or multi-agent collaboration.
    • Heterogeneous runtimes: Platform operators who need one framework to support multiple execution environments, such as local processes, containers, and remote sandboxes.
    • Heavy customization: Enterprises with special compliance requirements for message flow, tool approval, or permission control.

    The cost is also clear: the learning curve is significantly steeper. If the framework organizes plugins around a specific dependency injection or component container mechanism, developers must understand that mechanism before they can write working plugins. This approach works well only for teams willing to spend time working with the bricks. For developers who just want to get an agent running quickly, the cold-start cost of this route is noticeably high.

    5. An Architectural Trend Worth Watching

    Both approaches are evolving. Newer minimal kernels tend to grow heavier, moving capabilities that used to live in the plugin layer down into the kernel to provide a consistent, out-of-the-box experience. Designers usually take care to keep the kernel from intruding into other layers, so existing plugin ecosystems are not broken.

    The fully plugin-based approach is also converging. Overly aggressive exposure of low-level internals leads to unstable plugin APIs. As a result, a common adjustment in later versions is to tighten boundaries and move some low-level logic back inside the framework.

    This reflects a classic architectural principle: where the abstraction boundary sits determines the shape of the ecosystem. A kernel that is too thin fragments the ecosystem. A kernel that is too thick makes extension rigid. A well-designed harness keeps a balance between these two extremes.

    6. Selection Advice for Developers

    Based on the analysis above, three questions can guide the decision:

    1. How much custom logic will your team write? If you only need to add a few tools or adjust prompts, a minimal kernel with a plugin mechanism offers the best value. If you need to replace the loop strategy or deeply modify the runtime, the freedom of a fully plugin-based approach fits better.
    2. How long a learning curve can you accept? A LEGO-style framework requires understanding its component container and dependency injection mechanism, which means a significant upfront investment. A minimal framework is closer to “read the source and you understand it.”
    3. Are you using it as a product or as a library? If it is a product, prioritize a complete out-of-the-box distribution. If it is a library, focus on whether the SDK’s session creation, lifecycle management, and event streams are well designed.

    7. Conclusion

    The debate over harness architecture comes down to where control points sit. A minimal kernel hands control points to the ecosystem, and a fully plugin-based design hands them to the user. Understanding the trade-offs between these two approaches matters more than comparing line counts. The real weight of a framework is not its line count but the complexity its users have to carry. Whichever path you choose, clarifying your extension requirements and your team’s capability limits is the basis for a sound technical decision.