How to Choose an Agent Development Framework

    A practical guide to selecting an agent framework by system shape, control-flow needs, and production risk—not by popularity. It covers problem definition, abstraction trade-offs, a capability matrix, scenario-based choices, a minimal loop for evaluation, and engineering work frameworks do not own.

    Agents are not “another wrapper around a large-model API.” In multi-step reasoning they must decide whether to call tools, how to pass context, when to stop, and how to recover from failure. A framework’s value is turning those recurring control flows, state models, and integration points into reusable engineering structure. Market options fall roughly into three groups: highly packaged enterprise frameworks, application frameworks oriented to interactive UIs, and deliberately small runtimes. Selection should start from the system you need to ship, not from brand recognition.

    Define the problem before the framework

    Use a short problem list to bound the search so feature matrices do not drive the decision.

    • Is the task single-turn Q&A, multi-turn chat, or a long workflow with planning, parallel subtasks, and human confirmation?
    • Does it run as server-side batch work, a real-time web session, or a background job inside an existing business system?
    • Are tools a few read-only queries, or writes that change data, call external APIs, and trigger approvals?
    • How long must state live: short-term memory within one request, or cross-session progress and audit trails?
    • What is the team’s primary language, and what gateway, identity, and observability stack already exist?
    • After launch, who owns evaluation and regression, prompt and tool changes, and cost and latency budgets?

    These six questions discriminate better than “does it have every feature.” Completeness often means more concepts and more default behavior; minimalism often means you implement permissions, retries, and observability yourself. Either can be the right answer.

    Abstraction level sets learning cost

    Frameworks differ first in who holds control.

    Highly packaged stacks typically include a planning loop, tool protocols, session storage, permission hooks, and evaluation entry points. They fit teams building complex agents or enterprise apps who want less boilerplate. The cost is a heavier conceptual model: upgrades require understanding the framework’s default semantics for messages, tool results, and stop conditions.

    UI- and streaming-oriented stacks put model calls, incremental tokens, and frontend state on one path. They fit web agents that stream as they generate, support mid-run cancel, and need tool results on the client immediately. They may not cover approvals, idempotency, and compensation in enterprise workflows.

    A minimal kernel usually offers a message loop, tool registration, and little else. The learning path is short, prototypes start quickly, and each model decision stays visible. Production needs—memory compression, permissions, rate limits, tracing—must be added for the business. For personal projects or idea validation, that trade-off is often cheaper.

    Mature application stacks tend to have rich docs, examples, and community patterns for complex orchestration. The curve is steeper because the same goal often has several historical paths, and newcomers mix abstractions.

    Treat this as a spectrum, not a ranking. The low-barrier end favors iteration; the high-density end reduces a homegrown control plane. Stars on public code hosts measure discussion; package-registry downloads are closer to real integration. Older projects often look hotter because of history. After adjusting for that, still weigh maintenance activity, breaking-change frequency, and issue response—not a single number.

    Compare with a fixed capability matrix

    Hold the same capabilities constant so the comparison is not slogan-level “has feature X.”

    1. Model access: a unified interface over vendors; streaming, tool calling, and structured output. Switching models should not rewrite the business loop.
    2. Tool protocol: parameter validation, timeouts, idempotency keys, and error classes as first-class. Writes must distinguish retryable from non-retryable.
    3. Orchestration: fixed graphs, dynamic loops, or both. Long tasks need checkpoints; simple Q&A does not need a graph editor.
    4. State and memory: clear boundaries for context-window management, summarization, and external storage; ability to reproduce a run.
    5. Human-in-the-loop: pause, approval, and human edits of tool arguments expressible in the framework.
    6. Safety: tool allowlists, parameter sandboxes, secrets kept out of prompts, output-side sensitive-data filtering.
    7. Observability: each decision, tool input, and duration in logs and traces—not only the final answer.
    8. Evaluation: regression on fixed cases for tool-choice accuracy and task completion.
    9. Deployment: library, service, or both; fit into existing containers and gateways.
    10. Team cost: examples that cover failure paths; concept count matched to team size.

    Rankings are only “roughly better on one dimension.” Learning curve is often gentler for minimal kernels and some lightweight vendor agent tools, and steeper for long-lived, layered orchestration stacks. Enterprise selection should include “who can still change this loop in three months,” not only the day-one demo.

    Converge by scenario

    Personal projects that need to prove tool calling quickly: prefer a minimal kernel. Understand the loop first; add a heavier state machine later. Adopting a full ecosystem too early spends time on configuration instead of the problem.

    Web products that emphasize streaming and session state: prefer runtimes tightly coupled to the UI. Cancel, reconnect, partial results, and frontend consistency matter more than how elaborate a backend graph can be.

    Complex agents closer to professional coding assistants, or agents that enter enterprise processes: prefer highly packaged frameworks or mature orchestration. Hard problems are permission boundaries, long-running recovery, multi-tool failure combinations, and audit—not the first conversational demo.

    If one organization runs experiments and production together, two runtimes are acceptable, but tool definitions, evaluation cases, and trace fields should be shared. Otherwise experiment results will not transfer.

    A minimal loop to test any framework

    Whatever you pick, accept it against the same mental model: the model decides, tools produce verifiable side effects, the loop owns budget and stop.

    1. def run(goal, tools, max_steps=8):
    2. trace = [{"role": "user", "content": goal}]
    3. for step in range(max_steps):
    4. decision = model.decide(trace, tool_specs(tools))
    5. if decision.kind == "final":
    6. return decision.text, trace
    7. if decision.name not in tools:
    8. trace.append({"role": "tool", "error": "unknown_tool"})
    9. continue
    10. try:
    11. output = tools[decision.name](**decision.args)
    12. trace.append({"role": "tool", "name": decision.name, "output": output})
    13. except RetryableError as exc:
    14. trace.append({"role": "tool", "error": str(exc), "retry": True})
    15. except FatalToolError as exc:
    16. return f"tool failed: {exc}", trace
    17. return "step budget exceeded", trace

    When reading docs, ask: where is the step budget; will unknown tools be retried forever; do retryable errors consume the same budget; are final answers stored separately from tool outputs; can traces join every step of one task. If those answers are unclear, a long feature list is not enough.

    Production work the framework will not own

    Frameworks reuse control flow; they do not automatically solve the following.

    Context: store retrieval results, tool outputs, and historical summaries separately; do not dump raw logs into the next prompt. When over the window, drop data that can be fetched again; keep the goal and confirmed facts.

    Tool governance: declare side-effect level, timeout, and max return size per tool. Queries retry by default; charges, mail, and permission changes do not, or require a business idempotency key. Validate parameters with schemas; do not let the model concatenate commands freely.

    Identity and permissions: call business systems as the caller, not as the model. If the framework only offers one global key, split credentials by user and by tool outside it.

    Cost and latency: separate caps for planning steps and tool steps. Streaming also needs a first-token bound. A loop without a budget amplifies calls under bad prompts.

    Observability and evaluation: record model version, tool version, input hashes, and stop reason. Regression on a small golden set should cover “must not call a tool” and degradation after tool failure. Demo chats will not catch prompt drift.

    Release: version prompts, tool schemas, and model routing as config. In canaries compare task completion and human takeover rate, not only subjective fluency.

    These capabilities can use object storage for traces, queues for long jobs, containers for the runtime, and logs and alerts for step counts and error rates. They are generic cloud primitives and need not be locked to one framework. On an enterprise cloud such as Baidu AI Cloud, treat the agent runtime as an ordinary service: network isolation, secret management, elasticity, and audit follow existing standards rather than a one-off, unreviewable path.

    Decision order

    Decide in this sequence instead of committee feature voting.

    1. Write one critical path that must ship in two weeks and includes at least one tool failure.
    2. Implement that path on each candidate with the same step limit, timeouts, and log fields.
    3. Compare lines of code, hidden behavior you cannot bypass, and time for a newcomer to change stop conditions.
    4. Add a security case: unauthorized tool, oversized return, duplicate submit. Frameworks that cannot express it are out.
    5. Estimate upgrade cost a year out: breaking-change history, locked model interfaces, and whether in-house patches can still merge.

    If the path is a one-off script, choose minimal and accept a later rewrite. If it already includes approval and audit, do not start from a tiny kernel and backfill an enterprise control plane—that is usually more expensive than a packaged stack. If product value is real-time conversational UI, do not trade frontend experience for backend orchestration complexity.

    Common misjudgments

    Treating downloads and discussion heat as fit. Heat means someone uses it, not that it matches your failure model. Treating “multi-agent support” as a complexity solution. Multiple roles sharing unbounded context and the same write permissions make debugging harder. Treating happy-path samples as production capacity. Production differences are almost always timeouts, partial failure, and human intervention. Finally, do not drive the same side-effecting tools with two orchestration semantics, or idempotency and audit will not line up.

    The end of selection is not declaring one framework universally better. It is matching control flow, permissions, and observability to task risk. Low risk: fewer abstractions. High risk: hard requirements on stop conditions, tool boundaries, and replayable traces. Compared that way, a team can explain a choice between fast iteration and enterprise delivery, and keep the business loop stable when models or UIs change.