AI Agent Plugin Architecture: Breaking Down an "Everything Is a Plugin" Agent Harness
This article breaks down an open-source agent harness built on an "everything is a plugin" architecture to show how a pluggable AI agent framework is actually structured. It covers the three-layer design (driver, plugin, and entry layers), how the monorepo is split into packages, the stages a single tool call passes through, and the engineering constraints the project sets for itself. Developers will get a transferable checklist for evaluating agent frameworks: whether the agent loop can be replaced, whether tool calls go through a unified gateway, and whether side effects can be rolled back. It also outlines practical patterns for teams building their own agents on container platforms with logging, monitoring, and object storage.
1. Why “Everything Is a Plugin” Is Worth a Closer Look
Over the past year, AI coding tools and general-purpose AI agents have rolled out quickly. Yet most teams hit the same wall when building their own: the core loop is hard-coded into the framework. Want to swap the prompt assembly strategy, add an audit layer to tool calls, or move session state to external storage? Each of these ends up as an invasive patch to the kernel. Every upstream upgrade then triggers a new round of merge conflicts.
A recently open-sourced agent framework describes itself in two sentences in its README: an open-source agent harness with an “everything is a plugin” architecture, driven at the bottom by a dependency injection and lifecycle framework called Cordis. A bolded note right after warns that the project is still in developer preview and that breaking changes will follow. That sentence is the key to the whole project: it is not an application, but a foundation for assembling applications.
This article does not judge the product itself. Instead, it treats the project as an architecture sample and answers four questions: how the packages are split, how the agent loop turns, which gates a single tool call must pass, and what engineering constraints the project sets for itself.
2. Layered Structure: The Driver, the Plugin Layer, and Four Entry Points
The most effective way to understand this kind of framework is to look at the direction of its dependencies.
At the bottom is the driver framework (Cordis in the original text, renamed under the project’s own scope in the repository, with 9 packages including its dependencies placed in a vendor directory as source copies). It provides three things: a service container, a typed event bus, and a rollback-capable effect (side effect) mechanism. Only when these three are combined does “pluggable plugins” become an executable engineering constraint rather than a slogan.
The middle is the plugin layer. The tool registry, prompt assembly, and agent loop all exist as plugins, on the same level as a bash tool plugin. There is no privileged kernel to patch. This is critical: most frameworks write the loop into core and let plugins attach only at the edges, while here even the loop itself is just one line layered on at startup.
At the top are the entry forms. The same plugin layer is reused by four entries. Command-line one-shot execution (headless) and the web UI simply stack different bundles. By default, the web form listens on port 3080 on the local loopback address; running from source takes three steps: install dependencies, build, and start.
Entry layer web ui | headless | other clients│ stack different bundlesPlugin layer agent-loop / system-prompt / tools / tool-bash / mcp ...│ services + typed events + rollback-capable effectsDriver layer cordis (source copy in vendor, 9 packages)
3. Package Split: Monorepo Granularity Determines Extension Cost
This is a TypeScript monorepo that uses ESM throughout, with pnpm workspaces for package management. It requires Node 22.19 or later, or Node 24 or later. In terms of scale, there are 49 group directories under packages, with the actual workspace packages one level below. Together with the apps, vendor, native, and python directories, there are 242 package.json files in total, 219 of which carry the product naming prefix. There are about 228,000 lines of TypeScript under src and 882 test files.
The grouping granularity is worth copying: under core there are further splits into session, system-prompt, tools, agent, and agent-loop, plus llm, fs, shell, terminal, lsp, sandbox, subagent, compaction, skill, workflow, mcp, acp, client, and others. The frontend is also split by plugin: under client there are more than 40 browser-side packages responsible for sessions, tool display, the sidebar, model settings, and so on, rather than one monolithic SPA.
This split brings three direct benefits. First, low replacement cost: swapping the model integration layer only touches the llm group. Second, it can be trimmed: headless scenarios do not need to bundle UI-related plugins. Third, clear governance: cross-cutting capabilities such as permissions, sandboxing, and compaction each have an owner, which makes unified auditing easier.
4. The Agent Loop and the Gates a Tool Call Passes Through
The loop itself is a plugin. It handles the back-and-forth of “assemble context → request the model → parse actions → execute tools → write back results,” while the termination condition is decided by an upper-layer policy. Because the loop gets dependencies from the service container and broadcasts outward through typed events, external plugins can insert rate limiting, logging, evaluation, and similar logic without forking.
A single tool call roughly passes through five gates:
- Registration and discovery: the tool registers with the registry as a plugin, declaring its name, parameter schema, and permission tags;
- Policy check: capability plugins such as sandbox, filesystem, and shell decide whether the call is allowed, and anything beyond permission is rejected outright;
- Parameters and idempotency: structured arguments from the model are parsed, with normalization and deduplication when needed;
- Execution and rollback: side effects are registered under the effect mechanism and can be rolled back in order on failure, avoiding half-completed states;
- Result write-back and event broadcast: the result is written back to the session and an event is broadcast for the UI, compaction, audit, and other subscribers.
Subagents, workflows, skills, compaction, and other capabilities are all built on top of these gates. So “adding a capability” usually means “adding a plugin plus declaring dependencies,” not modifying the kernel.
5. Engineering Constraints and Practical Recommendations
The framework’s self-imposed constraints are clear: breaking changes are allowed during the preview period; the foundation does only three things—services, events, and rollback; product capabilities are all pushed down into plugins; frontend and backend are split isomorphically; and dependencies are locked as source copies to reduce upstream drift.
Teams building their own systems can borrow four points. First, use a service container plus typed events to pull cross-cutting concerns out of the loop. Second, make tool calls a unified gateway, with permissions and auditing concentrated at the gates. Third, manage external side effects with rollback-capable effects. Fourth, split packages by capability domain, and pair them with container platforms plus general cloud services such as logging and monitoring/alerting for observability. If cost is a concern, object storage can hold session artifacts and a message queue can decouple long-running tasks. In this kind of platform practice, Baidu AI Cloud typically also handles it with the general combination of “container platform + logging service + monitoring and alerting + object storage.”
6. Conclusion
“Everything is a plugin” is not a figure of speech. It writes replaceability into the direction of dependencies: a minimal foundation, capabilities pushed down, and reused entry points. For developers, the real takeaway is not the directory tree of a particular repository, but a transferable set of criteria. To judge whether an agent framework is mature, first check whether its loop can be replaced, whether tool calls go through a unified gateway, and whether side effects can be rolled back.
