AI Agent Frameworks: Four Design Paradigms and How to Choose
An AI agent framework shapes much more than tool calling: it determines how an application manages state, executes actions, extends capabilities, and operates in production. This article explains the division between model weights and the agent harness, compares four architectural paradigms, and outlines seven evaluation criteria and key implementation pitfalls.
1. Why Changing the Framework Changes the Product
Connect the same large language model to four differently designed agent runtimes, and you can get four very different applications. One exposes only a minimal reasoning loop. Another serves multiple clients through a shared backend. A third writes newly learned skills into long-term memory. A fourth brings heterogeneous messaging channels behind a unified entry point.
The model and its weights remain unchanged, and even the prompts may be similar. Yet the product’s boundaries, extension mechanisms, and operational costs differ substantially.
This explains a common selection problem: frameworks all advertise “tool calling” and “multi-turn conversations,” but their practical differences emerge in session state management, tool execution boundaries, extensibility, and observability. Making a sound choice starts with separating these concepts.
2. Model Weights vs. the Agent Harness
At its core, a large language model takes tokens as input and predicts tokens as output. The model itself does not retain previous conversation turns or independently read files, send requests, or call external systems.
To make a model perform actions, it needs a surrounding runtime, commonly called a harness. This layer is responsible for:
- Assembling context: Combining and trimming system prompts, message history, tool descriptions, and retrieved information.
- Executing actions: Parsing structured tool-call intentions from model output and turning them into function calls, script execution, or API requests.
- Maintaining state: Storing sessions, compressing context, and persisting intermediate task artifacts.
- Enforcing constraints: Checking permissions, applying parameter allowlists, blocking dangerous operations, and reviewing outputs.
An agent therefore has two parts: model weights provide reasoning capabilities, while the harness turns tokens into actions and information from the external world back into tokens. Together, they form the agent users experience.
An important, sometimes counterintuitive implication is that the harness can influence results as much as the model—and in some scenarios, more. Ambiguous tool descriptions lead to incorrect tool selection. Aggressive context trimming causes long-running tasks to lose critical constraints. Without retries and idempotency, tool workflows may fail under real-world conditions.
Differences in framework codebase size largely reflect differences in design priorities. A teaching implementation of a few hundred lines exposes the minimum working loop. A larger engineering-oriented framework builds connectors, guardrails, and observability into dedicated subsystems. Size is not a measure of quality; it indicates the intended scope.
3. Four Common Design Paradigms
Paradigm 1: A Minimal Loop for Understanding the Fundamentals
The smallest usable harness consists of a loop:
messages = [system_prompt, user_input]while not finished:reply = model.generate(messages, tools=tool_schema)messages.append(reply)if reply.tool_calls:for call in reply.tool_calls:result = dispatch(call) # Actual side effects occur heremessages.append(to_tool_message(result))continuefinished = True
Its value is clarity: it exposes the basic structure of agent = model + loop + tool dispatch.
This is a useful starting point for teaching, prototype validation, and algorithm experiments. It should not, however, be expected to provide concurrency control, permission isolation, or failure recovery out of the box.
Paradigm 2: A Shared Server with Multiple Clients
In this design, the harness runs as a persistent service, and session state resides on the server. Command-line tools, desktop applications, mobile applications, and CI pipelines connect as thin clients.
The main benefit is consistency of state and capabilities. All entry points share the same toolset, session history, and permission policies.
The trade-off is a set of engineering responsibilities that cannot be avoided:
- Session isolation and tenant boundaries.
- Asynchronous execution of long-running tasks and reconnection after disconnects.
- Queuing and rate limiting for concurrent requests.
- Compatibility during server upgrades.
This architecture is a natural fit for shared team use and centralized auditing.
Paradigm 3: Reusable Skills and Memory Write-Back
The distinguishing feature here is where the loop ends. A conventional agent may discard its execution process after completing a task. This paradigm instead abstracts successful action sequences into reusable skills, stores them in long-term memory, and invokes them when similar tasks arise rather than reasoning through the entire process again.
Three design questions need attention:
- Skill representation: Should a skill be a parameterized template or a complete execution trace?
- Retrieval and matching: What similarity threshold determines whether to reuse a skill or attempt the task again?
- Rollback: How can an incorrect skill be removed or reversed before repeated reuse amplifies its damage?
This approach turns one-off reasoning into an accumulating asset and can be a major source of lower costs over time.
Paradigm 4: Multi-Channel Connector Aggregation
This design creates a unified message-ingestion layer. Instant messaging, email, support tickets, webhooks, and other heterogeneous channels are adapted to a common event model. The layer above sees only events such as “a message arrived” or “a reply needs to be sent.”
The challenge is not simply the number of connectors. It is the difference in channel semantics: message formats, identity systems, rich-media capabilities, and rate limits vary.
The abstraction must support graceful capability degradation rather than assume that every channel offers equivalent functionality.
4. Seven Reusable Evaluation Criteria
When choosing a framework, score it against a consistent set of criteria instead of comparing the length of its feature list:
- State ownership: Does session state live on the client or the server?
- Extension mechanism: Does adding a tool require configuration changes, a plugin, or modifications to the core?
- Memory model: Is the system stateless, limited to short-term context, or able to write back to long-term memory?
- Access surface: Does it support a single entry point, multiple clients, or multiple channels?
- Guardrails: What permission model, audit logs, and human confirmation steps are available?
- Observability: Does it natively emit traces and metrics?
- Change cost: Can upgrades break existing sessions or plugins?
These dimensions reveal architectural trade-offs that broad feature claims often obscure.
5. Implementation Priorities and Common Pitfalls
Four concerns should be designed early when moving an agent into production:
- Tool-call idempotency and timeouts: Define how repeated calls and stalled operations are handled.
- Tiered context trimming: Preserve recent messages in their original form while summarizing older history.
- Bounded retries and human takeover: Establish limits for automated recovery and a path for intervention.
- End-to-end traceability: Record enough information to investigate why the model selected the wrong tool.
For deployment, stateless components can scale elastically on container platforms. Session and skill data can reside in object storage or databases. Message queues can absorb spikes in incoming traffic, while logging, monitoring, and alerting complete the operational feedback loop.
Baidu AI Cloud includes corresponding categories of these general infrastructure services, which can be combined according to architectural requirements. Service availability should be checked for the intended deployment region.
Three common mistakes are worth avoiding:
- Treating framework complexity as a measure of its capability ceiling.
- Introducing memory write-back prematurely for workloads without long-running tasks.
- Neglecting guardrails and giving execution-capable agents direct access to production environments.
Conclusion
Start with two architectural decisions: where state belongs and how capabilities are extended. Only then compare feature counts.
The model sets the capability ceiling. The harness determines whether the application can reliably reach it.
