Plugin-Based AI Agent Frameworks: From Model-Centric Design to Modular Architecture
A plugin-based agent framework separates the language model from the engineering infrastructure that turns its output into action. This article explains the Model + Harness architecture, breaks down its core components, and outlines practical steps for integrating tools, enforcing permissions, managing sessions, and improving agent behavior through execution traces.
Plugin-Based AI Agent Frameworks: From Model-Centric Design to Modular Architecture
1. Understanding the Architecture: Agent = Model + Harness
As AI coding tools become more common, it is easy to equate an agent with a particular product. A more useful engineering perspective separates an agent into two layers:
Agent = Model + Harness
- Model: The underlying large language model interprets intent, generates plans, and produces structured tool-call requests. It sets the upper bound on the agent’s reasoning capabilities.
- Harness: The engineering infrastructure outside the model that enables the agent to act. This includes tool invocation, task planning and scheduling, sandbox isolation, state storage, session management, execution-loop control, permissions, and auditing.
Many AI coding assistants tightly package these layers together. Model capabilities, built-in tools, and interaction workflows become a single closed system. This can deliver a smooth experience for specific tasks, but it also creates structural limitations: models are difficult to replace, tools are difficult to extend, sessions are tied to execution environments, and teams have limited room for customization.
An alternative approach emerging in the community is to move the model out of the architectural center and treat it as a replaceable component. Models, tools, sandboxes, and session stores can all be swapped. Even the agent’s main execution loop can be reimplemented.
This modular approach is the foundation of a plugin-based agent framework.
2. Why a Plugin-Based Architecture Matters
Models Evolve Quickly
Model versions change frequently, and different models offer different trade-offs in tool-calling reliability, long-context handling, and cost. Hard-coding agent logic around one model locks in that choice. A common model interface allows teams to switch models by replacing the adapter rather than rewriting the agent.
Engineering Requirements Vary
Code scanning, test execution, and deployment tooling differ substantially between organizations. Plugins let teams register their own tools without forking the entire framework.
Security Boundaries Need to Evolve Independently
Sandbox isolation, permission controls, and operation auditing are separate from model capabilities, yet they directly affect whether an agent can be used in production. Implementing these capabilities as independent plugins makes it easier for security teams to review and upgrade them separately.
Observability Is Essential for Reliable Engineering
Agent execution paths are unpredictable. Each model call, tool execution, and state change needs to be recorded. Observability is therefore a natural candidate for a reusable plugin rather than task-specific logic.
3. Core Components of the Harness
A complete harness typically includes the following pluggable components.
3.1 Model Adapter
The model adapter exposes a common interface: it accepts a list of messages and returns text or tool-call requests. It handles differences between models in function-calling formats, streaming output, and multimodal input.
class ModelProvider(Protocol):def chat(self, messages: list[Message],tools: list[ToolSchema]) -> ModelOutput: ...
A model that implements this protocol can be integrated without making the agent loop aware of provider-specific differences.
3.2 Tool Registry
Tools are declared through a common schema that specifies their names, parameters, execution functions, and permission levels.
Key design considerations include:
- Declarative registration: Register tools through configuration or decorators so that adding a tool does not require changes to the framework’s core code.
- Permission tiers: Distinguish read-only tools, tools that modify state, and high-risk tools. Write operations should require user confirmation by default.
- Standardized results: Regardless of their internal implementation, tools should return structured results that the model can interpret.
3.3 Agent Loop
The agent loop follows the familiar cycle of perceiving, reasoning, acting, observing, and reasoning again. It forms the framework’s backbone, but it should also be designed as a replaceable strategy.
A simple ReAct-style loop can suit lightweight tasks. More complex loops with planners, subtask decomposition, retries, and recovery are better suited to longer workflows.
The boundaries between loop iterations are natural integration points for cross-cutting capabilities such as monitoring and checkpoint-based recovery.
3.4 Sessions and Session Storage
Sessions hold multi-turn context, task history, and persistent state. Their design should address three key concerns:
- Context trimming: Decide how to summarize, compress, or move history to external storage when it becomes too long.
- Recovery: Support resuming a task from the last checkpoint after a process crash.
- Isolation: Keep session state strictly separated across tasks and users.
3.5 Sandbox Execution Environment
Agents must execute code and run tests in controlled environments. Common approaches include container-based isolation, temporary workspaces, network and filesystem allowlists, and resource limits.
The sandbox should be available as a standard plugin while also allowing organizations to integrate their existing isolation platforms.
3.6 Observability
Observability components collect logs, execution traces, token usage, and alerts in a consistent way.
In practice, they should record summaries of model inputs and outputs, every tool invocation and its arguments, and failure and retry sequences. They should also support trace replay so that a task’s execution path can be reconstructed and examined.
4. Practical Steps for Getting Started
1. Start with a Minimal Execution Loop
Use the default configuration to connect a model, basic file and command tools, and a single-iteration loop. Understand the full lifecycle of a tool call before introducing custom components.
2. Define Your Tool Conventions Early
Wrap internal CI scripts, code review rules, and deployment workflows as standardized tool plugins. This generally provides more value than modifying the framework itself.
3. Establish Permissions Before Connecting Real Repositories
Define confirmation requirements for write operations and establish an audit approach before giving the agent access to a real codebase. Addressing these boundaries early helps avoid later rework.
4. Use Traces to Guide Iteration
Examine how the agent fails on real tasks: selecting the wrong tool, inventing parameter values, or getting stuck in a loop. Use those observations to make targeted improvements to prompts, tool descriptions, and loop strategies.
5. Conclusion
The idea behind “everything is a plugin” is to turn the agent from a tightly packaged product into an engineering system assembled from interchangeable components.
The model becomes one slot in that system. Tools, execution loops, storage, and sandboxes each have distinct responsibilities and can be replaced as requirements change.
For enterprise developers, the value of this architecture is reduced dependence on a single technology stack and an agent system that can be maintained and evolved over time. Understanding Agent = Model + Harness is the first step toward a production-ready agent architecture.
