AI Agent Framework Selection: Core Dimensions and Engineering Practices
As LLM-based agents move from demos into production systems, framework choice becomes an engineering decision rather than a popularity contest. This article presents a five-layer capability model for evaluating agent frameworks, compares three technical paradigms, outlines a practical decision path and common anti-patterns, and explains why state and observability should be externalized to keep the architecture stable as frameworks evolve.
1. Starting Point: Agents Have Moved from Demos to Engineering
Since 2024, LLM-based agents have moved rapidly from proof of concept into business systems. Unlike single-turn question answering, an agent must autonomously decompose goals, call external tools, and revise its strategy across multiple iterations. This makes “how to organize an agent” a real engineering problem. Many development frameworks have emerged, and their marketing messages are highly similar, but their underlying abstractions differ greatly. Selecting a framework by popularity often leads to refactoring costs in the middle of a project.
The right approach is therefore not to compare “which framework is stronger,” but to first establish a product-independent capability evaluation model and then determine whether a technical paradigm matches your constraints.
2. A General Capability Model: Five Layers
Any agent framework, regardless of its form, can be decomposed into five layers. Scoring each layer is more reliable than reading a feature list.
1. Model Access Layer
Focus on whether it supports multi-model switching, structured output constraints, streaming responses, timeouts and retries, and token usage statistics. Production environments almost inevitably involve mixing models, assigning different cost tiers to different tasks. If the access layer is tightly coupled to one vendor’s API, later migration costs will be high.
2. Orchestration and Control Layer
This is where frameworks differ most, and it determines the agent’s behavioral boundaries. Evaluate whether it supports conditional branching, parallel fan-out/fan-in, loops and termination conditions, human-in-the-loop approval interrupts, and failure rollback. Frameworks without explicit termination conditions are prone to infinite loops and cost overruns in production.
3. Tool and Execution Layer
This includes tool description schema generation, parameter validation, execution sandboxing, timeout and circuit breaking, and idempotency design. Tool calls are the only channel through which an agent interacts with real systems. Least privilege and audit logs must be built into the framework layer, not added as after-the-fact patches.
4. State and Memory Layer
Distinguish between short-term context (conversation window management, summarization and compression) and long-term memory (vector retrieval, structured user profiles). The key question is who owns the state. Implicit framework-held state hinders horizontal scaling, while explicit externalization into a cache or database supports multi-instance deployment.
5. Observability and Governance Layer
This includes full-chain tracing, retention of inputs and outputs for each reasoning step and tool call, evaluation set regression, and cost and latency dashboards. Without this layer, the “unexplainability” of agents makes production issues impossible to locate.
3. Trade-offs Among Three Technical Paradigms
Paradigm A: Graph-based state orchestration
Model the agent as a state graph of nodes and edges, where nodes are computation steps and edges are transition conditions. The advantages are explicit control flow, testability, and easy instrumentation. The disadvantages are high upfront modeling cost and flexibility constrained by the graph structure. This paradigm suits relatively stable processes with high compliance requirements, such as ticket handling and risk review assistance.
Paradigm B: Role-collaborative multi-agent
Define multiple agents with role prompts that collaborate through dialogue or task assignment. The advantages are fast prototyping and strong adaptability to open-ended tasks. The disadvantages are poor behavioral convergence, high token consumption, and difficult debugging. This paradigm suits exploratory tasks and content production pipelines.
Paradigm C: Code-first minimalist paradigm
Avoid heavy abstractions and use only basic functions to wrap the loop of “call model, parse, execute tool, feed back result,” with developers controlling the flow through ordinary code. The advantages are few dependencies, the best portability, and controllable performance. The disadvantage is that observability and memory capabilities must be built in-house. This paradigm suits teams with mature engineering systems.
Illustrative pseudocode (framework-agnostic):
def run_agent(state, tools, model, max_steps=8):for step in range(max_steps):reply = model.invoke(state.messages, tools=tool_schema(tools))if reply.tool_calls:for call in reply.tool_calls:result = tools[call.name](**validate(call.args)) # validation + sandboxed executionstate.messages.append(tool_result(call.id, result))else:return reply.text # explicit termination conditionraise BudgetExceeded(step) # safety cutoff to avoid infinite loops
4. Decision Path and Common Anti-Patterns
A four-step convergence process is recommended. First, clarify whether the task requires a deterministic process, which determines whether to choose A or C. Second, assess the team’s engineering maturity; if it is low, lean toward B for prototyping, but plan for refactoring. Third, calculate the cost and latency budget; multi-agent collaboration often incurs several times the overhead of a single agent. Finally, use 20–50 real samples for small-scale regression and compare success rates rather than demo effects.
Common anti-patterns include treating prompt complexity as a capability moat; allowing state to reside implicitly inside the framework, which prevents scaling; granting overly broad tool permissions; lacking an evaluation set and relying on manual trial runs after every change; and introducing multi-agent systems too early, which complicates simple problems.
5. Supporting Infrastructure
After an agent goes live, general cloud product categories are sufficient to support its operation: container platforms host stateless executors, message queues decouple tasks and shave peaks, object storage saves intermediate artifacts, logging services and monitoring and alerting cover tracing and cost dashboards, and key management services host tool credentials. By externalizing these capabilities, the framework becomes a replaceable implementation detail, which is the target state for selection.
Conclusion: Do not ask “which framework is best.” Ask “how much control does my task need, and how much complexity can my team handle?” Score frameworks with the five-layer capability model, match constraints with the three paradigms, and keep state and observability externalized. Only then can the architecture remain stable while frameworks continue to evolve rapidly.
