Everything Is a Plugin: Architecture of an Open-Source AI Agent Framework
This article breaks down the design philosophy and engineering practices of an open-source agent framework built on the principle that everything is a plugin. It covers how agent frameworks differ from models and chat clients, the microkernel and plugin contract, the task lifecycle, controllability through permissions, sandboxing, budgets, and observability, extension development practices, and considerations for enterprise adoption.
Recently, an open-source agent framework built on the core idea that “everything is a plugin” released a developer preview. It is neither a new model nor a conversational client. It is an SDK and application framework for building, running, and extending AI agents. It connects to a model service by default, and an adapter layer lets it switch between multiple model providers. It allows a model to read projects, modify files, run command-line tools, manage tasks, and assign subtasks. Users can interact with it through a web interface, a full-screen terminal, a headless command-line interface, or an automation call protocol. This article examines the design philosophy and engineering practices of such frameworks, covering conceptual boundaries, microkernel architecture, plugin contracts, task lifecycle, controllability engineering, extension development, and enterprise adoption.
1. Clarifying the Concept: An Agent Framework Is Not a “Model Shell”
When discussing these systems, the most common mistake is to confuse the model, the chat client, and the agent framework. The model provides reasoning and generation. The chat client provides a conversation interface. The agent framework connects model capabilities to a working environment, including the file system, command line, browser, code editor, task queue, and external services. Its job is not simply to handle multi-turn chat. Its job is to let a model keep executing in a controlled environment, observe results, revise its plan, and eventually deliver outputs.
The “harness” metaphor fits well. A harness connects a powerful but unpredictable force to real work. It also records what the model does, limits what the model is allowed to do, and decides whether to retry or cancel when something fails. As a result, the complexity of an agent framework lies less in the model call itself and more in the execution loop, tool protocols, permission policies, trajectory recording, concurrent subtasks, interruption and recovery, and observability. When an agent searches several files at once, runs tests, accepts follow-up instructions from the user, and can be canceled at any time, mechanisms that look like over-engineering often turn out to be the safety net that incident reviews need most.
2. Microkernel and Plugins: The Design Philosophy of “Everything Is a Plugin”
“Everything is a plugin” does not simply mean that all code is written as plugins. It is a way of dividing responsibilities. The microkernel keeps only the minimum necessary capabilities: plugin registration and discovery, lifecycle management, the event bus, dependency resolution, permission context, and configuration loading. Model adapters, tool execution, user interfaces, task orchestration, log storage, and policy decisions all connect as plugins. This brings clear boundaries. Adding a model provider only requires implementing the adapter contract. Adding a tool only requires declaring its capabilities, input and output schemas, and permission needs. Adding a new interaction form only requires subscribing to session events, without touching the execution core.
The key to a plugin architecture is the contract, not the directory layout. A maintainable plugin should include at least a unique identifier, a version and compatibility range, a capability declaration, input and output schemas, permission requirements, lifecycle hooks, error classification, and observability instrumentation. Before activating a plugin, the microkernel should check dependencies and validate permissions. At runtime, it should inject controlled access to files, the network, commands, and logs through the context, instead of letting plugins hold global resources directly.
interface Plugin {id: stringversion: stringcapabilities: Capability[]permissions: PermissionRequest[]activate(ctx: PluginContext): Promise<void>deactivate(): Promise<void>}interface ToolPlugin extends Plugin {invoke(input: unknown, ctx: ToolContext): Promise<ToolResult>timeoutMs?: numberidempotent?: boolean}
This example is an illustrative contract. ToolPlugin does not operate on real files or processes directly. It requests controlled capabilities through ToolContext. This lets the microkernel apply timeouts, retries, auditing, redaction, and cancellation propagation in one place. Many workspace members are essentially just collections of plugins and modules. Real stability comes from stable contracts and a clear kernel boundary.
3. The Lifecycle of an Agent Task
A typical task can be described as user input, then session and task planning, model reasoning, tool calls, observing results, looping and revising, and finally completing or being canceled. The framework needs to split this loop into observable turns and steps. For each step, it should record an input summary, tool arguments, returned results, duration, errors, and retry decisions. The trajectory is not an afterthought to logging. It is core data for an agent system. It supports debugging and replay, permission auditing, cost attribution, and outcome evaluation.
Subtasks and sub-agents are key extension points for complex work. A main agent can assign stages such as environment checks, asset acquisition, scene setup, and logic writing to subtasks. Each subtask has its own context, budget, and cancellation signal. The framework must handle concurrency control, result aggregation, failure isolation, and dependency ordering. Cancellation should be cooperative. The cancellation signal propagates through the execution context, the child process tree is terminated, temporary files that were already created are cleaned up idempotently, and the trajectory records the cancellation reason and the state at that point.
4. From a Single Prompt to a Working Output
In a public demo, this type of framework reportedly built a runnable first-person shooter web game from a single prompt. The agent ran runtime version checks, network reachability checks, project planning, free asset acquisition, Web 3D scene construction, game loop and interaction logic writing. Another example reproduced a classic three-dimensional animated scene from a text description, which required restoring plot relationships, character actions, and camera composition. The value of these demos lies not in generation speed but in the execution chain. The model did not output all the code at once. It called tools over many rounds and steps, read feedback, fixed errors, and filled in missing dependencies.
For developers, the reusable lessons are these. First, break the task into verifiable stages, each with a clear output and acceptance signal. Second, have tools return structured results so the model does not have to infer state from long blocks of text. Third, classify failures by type, distinguishing missing environment, permission denial, dependency conflicts, syntax errors, and logic errors. Fourth, the trajectory view should let users expand and replay individual steps, which makes it easier to tell whether a plan was wrong or a tool failed. The “zero manual intervention” in these demos should be read as a high degree of automation under demo conditions. It does not mean every production task can run without human approval.
5. Controllability Engineering: Permissions, Sandboxing, Budgets, and Observability
Once an agent can execute commands and modify files, its security boundary must move earlier in the pipeline. The permission model should cover at least allowlisted file read and write paths, command execution approval, network access policies, secondary confirmation for sensitive operations, and isolation of keys and credentials. A sandbox can use containers, namespaces, temporary directories, read-only mounts, and resource limits to confine high-risk operations to an environment that can be rolled back. For write operations, temporary branches or snapshots should be preferred so that changes can be reverted when something fails.
Budget controls matter just as much. These include limits on step count, wall-clock time, model call cost, concurrent subtasks, and tool call frequency. For observability, structured logs, trajectory records, redaction of tool arguments and results, error aggregation, replay, and comparison should form a closed loop. Cancellation is not simply killing a process. The signal must propagate from the session layer down to the tool layer so that state stays consistent. The following is an illustrative policy:
policy:file:read: ["workspace/**"]write: ["workspace/**", "tmp/**"]command:allow: ["build", "test", "lint"]requireApproval: ["deploy", "publish"]network:allowHosts: ["approved-registry"]budget:maxSteps: 200maxWallTime: 30mmaxConcurrentSubtasks: 4
Policies should be composable, auditable, and overridable per tenant, with high-risk capabilities denied by default. The framework should not leave the question of whether an action may run entirely to the model. The kernel should make a deterministic check before each tool call.
6. Best Practices for Extension Development
When developing plugins, follow these principles. Scope plugins around stable capabilities rather than one-off tasks. Keep input and output schemas backward compatible. Make tool calls idempotent where possible, and explicitly mark non-idempotent operations so they require confirmation. Set timeouts and retry limits for every external call. Error classification should drive decisions at higher layers. Instrument key paths with start, end, failure, retry, and cancellation events. For testing, add contract tests and trajectory replay tests alongside unit tests, so that plugin upgrades do not break existing tasks.
async function invoke(input, ctx) {ctx.audit("tool.start", { tool: "search", inputDigest: digest(input) })try {const result = await ctx.withTimeout(5000, () => ctx.capabilities.search(input))ctx.audit("tool.end", { ok: true })return { ok: true, data: result }} catch (e) {ctx.audit("tool.error", { type: classify(e) })return { ok: false, error: classify(e) }}}
For enterprise adoption, teams also need multi-tenant isolation, audit trails, key management, a policy center, model routing, cost quotas, and evaluation datasets. General cloud capabilities such as object storage, container platforms, log services, and monitoring and alerting can support the runtime. The framework design should stay vendor-neutral and replaceable. Ultimately, the measure of such a framework is not how many plugins it has. It is whether it can reliably turn model capability into engineering output while staying controllable, observable, and reversible.
