Open-Source AI Agent Frameworks: Everything Is a Plugin
This article explains the core architecture behind modern open-source AI agent frameworks, where tools, models, interfaces, and policies are all implemented as plugins. It clarifies what an agent framework actually is, breaks down the four plugin categories, outlines a five-layer runtime design, and covers the permission and observability requirements needed for production use. You will also find practical rollout advice, a minimal plugin contract example, and four acceptance criteria for turning the "everything is a plugin" idea into a maintainable engineering structure.
## 1. From “Model Capability” to “Engineering Foundation”: Getting the Concept Right
Before discussing AI agent application frameworks, it is worth clearing up a common misconception: these frameworks are neither a new large language model nor a chat window aimed at end users. They are closer to a software development kit and application framework for building, running, and extending agents.
Typical capabilities include letting a model read project context, modify files, execute command-line operations, manage tasks, split and dispatch subtasks, and interact with users through a graphical interface, a terminal interface, a headless command-line mode, or automation protocols. A framework may connect to one model service by default, but it is usually designed to switch between multiple model providers so teams can meet different requirements for cost, latency, and compliance.
The metaphor behind the word “framework” is worth unpacking. It originally referred to harnesses and restraint devices. One level of abstraction up, its job is to connect the “force of intent” generated by a model to mechanisms that can actually execute—the file system, the command-line environment, the browser, the code editor—without letting that force run out of control: recording what it did, limiting what it can do, and deciding whether to retry or cancel when something fails.
This also explains why the codebase of such projects is often quite large. When an agent retrieves multiple files, runs tests in parallel, accepts additional instructions from the user, and must support cancellation at any time, the parts that look like “over-engineering” early on quickly become the capabilities you most want to have during an incident review.
2. Why “Everything Is a Plugin” Became the Mainstream Architecture Choice
Traditional tool software tends to hard-code functionality into the main flow: adding a new file format, a new execution environment, or a new interaction entry point requires changing core code. Agent frameworks face far more uncertainty—tool types, model providers, and interaction methods are all evolving quickly, and hard-coding makes the system decay fast.
The core judgment behind a plugin architecture is simple: externalize what changes, consolidate what stays stable. What stays stable is scheduling, state, permissions, and auditing; what changes is the specific tools, the specific models, and the specific interfaces. Around that judgment, you can separate four plugin categories:
- Tool plugins: file read/write, command execution, retrieval, browser operations, and so on;
- Model plugins: model integration and parameter adaptation across different providers;
- Interaction plugins: graphical interfaces, terminal interfaces, and automation protocol integration;
- Policy plugins: permission checks, audit records, retry and circuit-breaker rules.
A sample plugin description can be written as the structure below. The emphasis is on “declaring capabilities + declaring risk” rather than exposing a concrete implementation:
{"name": "file_editor","capabilities": ["read", "write", "patch"],"risk_level": "medium","requires_approval": ["write", "patch"],"timeout_ms": 15000}
The scheduler relies only on this declaration to decide who can be invoked, whether human confirmation is required, and what to do after a timeout—without caring how the plugin is implemented internally. Adding a capability no longer means modifying the main trunk: plugins can be developed, tested, and retired independently.
3. Layered Design: Turning “It Works” into “It Is Controllable”
A practical agent runtime foundation is usually divided into five layers.
The first is the access layer, which handles interaction with users, including interfaces, terminals, and automation protocols. Its responsibility is input collection and result presentation; it should not carry business judgment.
The second is the orchestration layer, responsible for task decomposition, subtask dispatch, and result aggregation. The boundary between serial and parallel execution needs to be explicit here: reads and retrieval can run in parallel, while writes and publishing actions are better kept serial to avoid overwriting one another.
The third is the execution layer, where plugins actually run. The execution layer must run in a restricted environment—for example, a containerized working directory, a limited file system view, and controlled network egress.
The fourth is the governance layer, responsible for identity, permissions, quotas, and auditing. All high-risk actions should pass a policy check and leave a traceable record.
The fifth is the model adaptation layer, which hides differences between model providers behind a unified interface so that upper-layer orchestration logic stays stable.
The value of this layering is that replacing any one layer does not trigger a global rewrite. Switching model providers affects only the adaptation layer; adding an interaction method affects only the access layer.
4. Permissions and Observability: Two Non-Negotiables for Agent Engineering
The biggest difference between an agent and a script program is that an agent’s behavior is decided on the fly by a probabilistic model. Permission design therefore cannot rely on “the model will behave itself”; it has to come from external constraints.
The principle of least privilege is recommended: read-only by default, with write and execution operations requested on demand; human confirmation for high-risk actions; a timeout, retry limit, and resource quota set for every plugin; and a distinction between “retryable errors” and “non-retryable errors” for failed actions to avoid amplifying side effects.
Observability is equally indispensable. At minimum, three kinds of records are needed: action logs (what was invoked and a summary of the parameters), decision traces (why that action was chosen and what the candidates were), and result snapshots (the key differences before and after a change). When an unexpected modification occurs, these three records together form the basis for a postmortem.
A simplified policy check looks like this:
def guard(action, ctx):if action.risk_level == "high" and not ctx.approved:return "denied: need approval"if action.name not in ctx.allowed_plugins:return "denied: plugin not enabled"if ctx.budget_exceeded(action):return "denied: quota exceeded"return "allowed"
5. Implementation Advice: Start with a Minimal Viable Plugin Set
In engineering practice, it is not advisable to pursue a “full plugin ecosystem” from day one. A safer path is to first define a unified plugin contract, then implement three to five high-frequency plugins—such as file reading, command execution, retrieval, and logging—get the permission and audit chain working end to end, and expand from there.
For deployment, you can combine general cloud capabilities: a container platform to handle isolation and elasticity for execution environments, object storage to hold task artifacts and snapshots, logging services and monitoring alerts for observability, and a message queue for dispatching asynchronous subtasks and collecting results. These are all standard industry categories; selection should weigh compliance, latency, and cost as the primary trade-offs.
Acceptance can be defined by four criteria: adding a plugin requires no change to the orchestration layer; any high-risk action can be intercepted and recorded; no half-finished state remains after a task is cancelled; and existing task flows still run after switching model providers. Meeting these four shows that “everything is a plugin” has moved from an idea to a maintainable engineering structure.
