Choosing an AI Agent Framework: Closed Integration vs. Open Assembly
This article explains how to choose an AI agent framework by weighing task risk and whether the framework's modules can be replaced. It covers what a framework handles beyond the language model, a checklist of nine core modules with their design concerns and common failure modes, and design points for the model and tools.
1. The Short Answer
When choosing a framework, look at two things first: how high the risk of the task is, and whether the framework’s modules can be replaced. Teams facing high risk or compliance requirements should prioritize modular, assemblable architectures and reserve operations staff to maintain them. Teams that only run experiments with non-sensitive data can usually get by with an encapsulated (closed) framework, but they should first confirm where their data goes. Most teams fall somewhere in between, and a semi-open framework suits them best.
2. What Frameworks Do and Don’t Do
A large language model only generates text based on its input. Reading files, calling APIs, modifying code, and running multi-step tasks in sequence all depend on the framework. The framework assembles the context, parses the tool-call requests the model emits, executes them in an isolated environment, records the history, and decides when to stop.
A framework does not improve the model’s reasoning ability. It determines how the model’s capabilities turn into actual results. With the same model, a framework with strict parameter validation and tight permissions produces far more reliable results than one with overly broad permissions and no step limit.
Think of the model as a program installed on a computer, and the framework as the hardware and operating system. The machine’s resources, permissions, and interfaces determine what the program can do. This analogy works well for beginners, but when analyzing a specific design, you still need to examine each module individually.
3. Checklist for the Nine Core Modules
The table below lists each module’s responsibilities, design considerations, and common failure modes. When choosing a framework, you can check line by line whether a candidate covers these points.
| Module | Main Responsibility | Design Considerations | Common Failure Modes |
|---|---|---|---|
| Model | Provides reasoning capability | Standardized interface, switchable, configurable parameters | Output format changes after switching models, causing parsing failures |
| Tool | Calls external capabilities | Declared format, parameter validation, result feedback | Parameters with missing fields or out-of-range values still get executed directly |
| Skill | Encapsulates reusable instructions and workflows | Version management, scope of use, subtask decomposition | Outdated skill versions still get invoked, producing inconsistent results |
| Session | Stores messages and execution state | Append-only log, replayable, forkable | Logs get overwritten, making it impossible to reconstruct the process afterward |
| Sandbox | Isolates code and command execution | Minimal file, network, and process permissions | Overly broad permissions lead to accidental deletion or data leaks |
| Storage | Stores long-term memory and reference materials | Retrieval methods, data isolation, expiration policies | Outdated information gets used as fact |
| Loop | Drives the iterative perceive-reason-act cycle | Termination conditions, step limits, error recovery | Unlimited retries consume large amounts of cost |
| Scheduler | Triggers tasks by time or event | Concurrency limits, retry on failure, alerting | Multiple scheduled tasks trigger at once and crowd out resources |
| Interface | User-facing interaction entry point | Replaceable presentation layer, extensible input methods | UI coupled with business logic, so changing the UI requires a rewrite |
4. Design Points for Each Module
4.1 Model and Tools
A framework usually connects to models through a unified request format. It parses the output into either a text reply or a structured tool-call request. Each tool must declare its name, purpose, and parameter structure.
Parameter validation is the step teams most often overlook. Parameters generated by a model may miss fields or fall outside the expected range. Validation logic belongs on the framework side and should not rely on the model to behave correctly. Basic validation covers at least three checks: whether required fields are present, whether types are correct, and whether values fall within the allowed range. When validation fails, the framework should feed the error reason back to the model in a structured form.
