Agent Frameworks in Practice: Designing an “Everything Is a Plugin” Architecture

    As AI agents move from conversation to execution, their limits are increasingly defined by the runtime around the model. This article explains how to design an agent framework that connects models to files, processes, browsers, and task queues while controlling permissions, failures, and side effects. It covers runtime boundaries, microkernel and plugin architecture, layered execution, sandboxing, observability, and practical guidance for enterprise adoption.

    As AI agents move from “conversation” to actually getting work done, their upper limit is often determined not by the quality of a single reasoning step, but by the runtime that connects model outputs to real working environments while keeping risk under control. The industry often describes this runtime as a “harness” or “tack”: one end connects to the model, the other to files, processes, browsers, and task queues. In between are permissions, auditing, retries, and cancellation.

    This article explains how to design an agent framework based on the principle that “everything is a plugin,” covering its concepts, capability boundaries, layered architecture, engineering practices, and enterprise considerations.

    1. Clarifying the Concept: A Framework Is Neither a Model nor a Chat Shell

    An agent product is often mistaken for a new model or a conversational interface. More accurately, it is an SDK and application framework for building, running, and extending agents.

    The framework may connect to a particular class of large language model services by default, but it should also support switching between multiple model providers through a unified adapter layer. It should give models the ability to read projects, modify files, execute commands, and split work into subtasks. It should also support multiple access modes, including web interfaces, full-screen terminals, headless command-line execution, and automation through standardized protocols.

    The “harness” metaphor is important. The model provides the driving force, while the file system, command line, editor, and browser provide the mechanisms that can perform real work. The framework is responsible for connecting them while preventing the agent from running out of control. It must record what the agent did, limit what it is allowed to do, and decide whether to retry or cancel when something fails.

    When an agent is reading multiple files, running tests, receiving additional user instructions, and remaining interruptible at the same time, features that may initially appear excessive—such as state machines, session isolation, and audit logs—often become the capabilities teams wish they had during incident investigations.

    2. Capability Boundaries: What the Runtime Must Handle

    A common public demonstration follows this pattern: the user provides a natural-language goal, the agent operates without manual intervention, and after multiple planning rounds and hundreds of steps, it produces a runnable result. Typical stages include environment checks, project planning, asset retrieval, scene construction, and logic implementation.

    These tasks reveal that the runtime must do much more than enable a model to write code. It must support:

    1. Long-running trajectories: Multiple dialogue rounds, numerous tool calls, and replayable intermediate artifacts.
    2. Environment awareness: Detection of runtime dependencies, network availability, and project structure.
    3. Interruptibility: Users must be able to add instructions or cancel a task at any time without leaving partial processes or corrupted files.
    4. Observability: Inputs, outputs, execution time, and failure reasons for every step must be traceable.

    Once a demonstration is translated into engineering requirements, the framework should provide at least workspace isolation, tool sandboxing, step-level logging, a task tree connecting parent and child tasks, and interaction channels for human-agent collaboration.

    3. Design Philosophy: A Microkernel with “Everything as a Plugin”

    “Everything is a plugin” should be an architectural principle rather than a slogan. Variable components should be moved to the boundaries of the system. The core should retain only the essential functions:

    • Session lifecycle management
    • A message bus
    • Permission evaluation
    • Plugin loading
    • Dependency injection

    Model adapters, tools such as file reading, file writing, command execution, retrieval, and browser control, user interfaces such as web, terminal, and headless modes, and protocol gateways should all be registered as plugins.

    This approach provides several direct benefits:

    • Switching model providers does not require changing business logic; only the adapter plugin needs to be replaced.
    • Adding a new tool, such as object storage uploads or message queue delivery, requires only an implementation of the standard tool interface.
    • Interactive applications and automated pipelines can share the same core.

    A microkernel also means that plugins communicate through events and explicit contracts instead of directly calling each other’s internal implementations. This reduces coupling and allows permissions to be granted at the plugin level. For example, one plugin may be allowed to read the workspace but not execute arbitrary commands, while another may execute commands only through auditing and timeout controls.

    4. Layered Architecture: A Clear Path from Input to Execution

    A practical design divides the system into five layers. Stable interfaces should separate the layers so that the model never interacts directly with the operating system.

    Layer 1: Access

    This layer supports web consoles, terminals, headless command-line execution, and automation protocols based on remote procedure calls. It converts user intent into session messages through a unified interface.

    Layer 2: Orchestration

    The orchestration layer manages task planning, subtask allocation, multi-step loops, the merging of additional user instructions, and cancellation propagation.

    It should not execute side effects directly. Instead, it should produce actions that are ready for execution.

    Layer 3: Tools and Policies

    Each action corresponds to a tool call. A policy engine determines whether the action should be allowed, modified, or rejected based on workspace policies, path allowlists, command blocklists, and resource quotas.

    Layer 4: Execution

    This layer writes files, runs processes, and accesses networks within an isolated workspace. Every execution should support timeouts and cancellation, and should capture standard output and exit codes.

    Layer 5: Observability and Governance

    This layer provides trajectory views, step-level logs, audit events, failure classification—such as retryable or non-retryable—and entry points for human intervention.

    In cloud deployments, the observability layer can integrate with general-purpose logging services, monitoring and alerting systems, and object storage for trajectory archives. Observability does not need to be built directly into the core.

    5. Guardrails: Capability Without Constraints Is Not Production-Ready

    Once an agent can modify files and run commands, security and compliance become hard requirements rather than recommendations. At a minimum, the system should include:

    • Workspace sandboxing: By default, the agent should operate only within a designated directory and should not access arbitrary system paths.
    • Command policies: High-risk operations should require confirmation or be blocked outright. Network access can be routed through a proxy and restricted by domain allowlists.
    • Quotas and timeouts: These prevent infinite tool-call loops and uncontrolled creation of child processes.
    • Complete auditing: The system should record who called which tool, when it was called, with what parameters, and what result it produced.
    • Defined cancellation semantics: Cancellation must stop more than model inference. It should also terminate processes, roll back uncommitted changes, or clearly report any remaining artifacts.

    These mechanisms increase implementation effort, but they are what separates an impressive demonstration from a production system.

    6. Engineering Practices for Real-World Development

    1. Define the workspace and target artifacts before enabling tools. An unrestricted, full-permission agent is difficult to review and debug.
    2. Separate planning from execution. Planning can be flexible, but execution must be conservative. Use the policy layer to filter actions between the two.
    3. Treat trajectories as assets. Preserve step-level records so teams can evaluate prompts, tool designs, and the effects of switching models.
    4. Define plugin contracts first. Use structured schemas for tool inputs and outputs instead of allowing the model to generate unconstrained formats that may fail during parsing.
    5. Make human-agent collaboration a first-class capability. For long-running tasks, the ability to insert instructions, pause execution, or change the goal is often more realistic than pursuing complete automation.
    6. Use standard cloud-native components. Container platforms can provide isolated execution, object storage can preserve trajectories and artifacts, message queues can handle asynchronous tasks, and logging and monitoring systems can provide alerts. The framework does not need to depend on proprietary interfaces from a single provider.

    7. Conclusion

    The value of an agent framework lies in connecting model capabilities to mechanisms that can perform real work, while using permissions, auditing, and cancellation to keep that power under control.

    A microkernel and plugin architecture allow models, tools, interfaces, and protocols to evolve independently. Layering keeps side effects manageable, while observability makes long-running trajectories diagnosable.

    For enterprises, it is more valuable to turn workspace isolation, tool policies, and trajectory governance into reusable infrastructure than to focus on one-time demonstrations. With these foundations in place, agents can continue to perform reliably under the same constraints even when the underlying large language model provider changes.