Practical guide · Agent engineering

How to choose an AI agent framework

Choose the smallest runtime that can express your workflow, recover its state, pause risky actions, and show you why a run failed. A framework comparison based on feature lists will push you toward whichever project has the longest documentation. A production-shaped proof task gives you evidence you can use.

Published November 26, 2026 · 12 minute read

The short answer

Start without a framework when one model call or a deterministic sequence can finish the job. Add a framework when you need durable state, branching, resumable approvals, coordinated specialists, or inspectable long-running work. Compare no more than three candidates with the same proof task. Force a crash, pause one consequential tool call, resume it, replay a failed case, and inspect the resulting trace. Pick the option with the least application-owned glue and the clearest recovery semantics, then keep your task contracts, tools, eval cases, and telemetry portable.

Decide whether you need a framework

Many products described as agents are a model call with retrieval and one or two tools. Ordinary application code is often easier to test and operate for that shape. A framework earns its place when it owns a difficult control problem rather than wrapping an API you already understand.

When ordinary code is enough and when to evaluate an AI agent framework
Workflow shapeStart withReason
One response or structured recordProvider SDK and schema validationThere is no durable control flow to manage.
Fixed retrieval and generation sequenceApplication code or a job runnerExplicit steps are easier to test than dynamic orchestration.
Long-running task with checkpointsDurable workflow or graph runtimeA process restart must not lose completed work.
Risky action requiring reviewRuntime with pause and resume semanticsApproval must bind to the exact pending action and state.
Specialists with routing and handoffsAgent or workflow frameworkThe runtime can make transfers and ownership inspectable.

Translate the job into framework requirements

Provider support and starter examples matter, but they rarely decide whether the system survives production. Score candidates on the behavior your team will have to debug at 2 a.m.

  1. Control flow: Can you express deterministic steps, conditional branches, bounded loops, parallel work, and explicit stopping rules without hiding them inside prompts?
  2. Durable state: What is persisted, when is it checkpointed, and what happens if the process dies between a remote side effect and the next checkpoint?
  3. Human approval: Can execution pause for minutes or days, show the reviewer normalized arguments, expire safely, and resume once without replaying completed writes?
  4. Observability: Can one trace connect the user task, model turns, retrieval, tool calls, policies, handoffs, cost, and final business outcome?
  5. Tool boundary: Are schemas typed, results bounded, errors explicit, identity injected by trusted code, and write operations compatible with idempotency?
  6. Portability: Can you keep domain logic, test cases, traces, and tool implementations usable if the framework, model provider, or storage backend changes?

Map the main framework shapes

The projects below overlap, but they start from different abstractions. The right comparison is between mechanisms your workflow needs, not broad claims that every option supports tools and memory.

AI agent framework comparison by control model and useful fit
OptionControl modelUseful starting fitVerify in your proof task
LangGraphState graph with checkpoints and interruptsBranching, long-running workflows where persisted graph state is centralThread storage, replay, interrupt boundaries, and side effects around resumed nodes
OpenAI Agents SDKAgent loop, tools, handoffs, guardrails, sessions, and tracingOpenAI-centered applications that want a small set of agent primitivesSerialized run state, approval resumption, tracing controls, and non-OpenAI dependencies
Google ADKAgents, workflows, sessions, artifacts, plugins, and resumabilityGemini or Google Cloud teams that want explicit workflow agents beside model-driven agentsSession persistence, resumable invocation behavior, deployment target, and trace export
CrewAI FlowsEvent-driven flows that coordinate agents and crewsTeams modeling role-based collaboration inside a larger controlled workflowPersistence, branching, human feedback, replay, and how crew autonomy is bounded
Pydantic AITyped Python agents with deferred tools and external durable execution integrationsPython teams that want type-driven interfaces and control over the surrounding runtimeDeferred result storage, approval identity, retry behavior, and the chosen durable backend
Vercel AI SDKTypeScript model and tool primitives with workflow patternsWeb product teams that need streaming UI and explicit TypeScript orchestrationDurability provider, resumability, server lifecycle, and how workflow state reaches the UI

This table is a shortlist generator. Documentation can confirm that a mechanism exists, but only your proof task can show whether it behaves correctly with your database, queue, authentication, deployment model, and failure policy.

Run the crash-and-resume test

Use the same small workflow for every candidate. A support request is a good test: retrieve an account-safe record, call a read tool, draft a resolution, ask for approval before a credit, execute one idempotent write, and store the receipt.

  1. Write the final-state contract and 20 representative cases before integrating a framework.
  2. Implement the read path, one conditional branch, one tool failure, and one request that needs clarification.
  3. Pause before the write. Persist the exact action, normalized arguments, policy version, reviewer decision, and expiry.
  4. Kill the worker after the external system accepts the write but before the next local checkpoint. Resume without duplicating the effect.
  5. Export a trace and locate the failed step without reading raw prompts from every successful run.
  6. Change the model or one tool implementation and rerun the same cases. Framework coupling should not force a rewrite of the task contract.

Use Learnetto's guides to design the agent's tools, implement approval gates, and make retries and side effects safe. These contracts belong to your application even if the framework supplies adapters.

Use the same task for a two-framework bake-off

AI agent framework scorecard

Score observed proof-task behavior from 0 to 5. Set weights before the trial so a polished demo does not outweigh recovery or security requirements.

Suggested weighted scorecard for choosing an AI agent framework
CriterionSuggested weightEvidence to record
Correct task outcomes25%Pass rate and critical failure slices across fixed cases
Crash recovery and idempotency20%Receipts, checkpoints, resumed state, duplicate-effect count
Approval safety15%Argument binding, expiry, reviewer identity, one-time resume
Debuggability15%Trace completeness, typed errors, time to diagnose planted failure
Application fit15%Glue code, deployment constraints, test setup, storage compatibility
Portability and maintenance10%Framework-specific domain code, upgrade effort, replaceable adapters
Latency under loadRequired thresholdp50 and p95 task latency with the same concurrency
Cost per completed taskRequired thresholdModel, storage, tracing, and orchestration cost for successful outcomes

Keep raw measurements beside the score. A single weighted total can hide a zero in a required category. Reject any candidate that duplicates a side effect, resumes an expired approval, or prevents you from determining whether the user's task finished.

Write the exit plan before adoption

Framework code should coordinate domain operations rather than contain them. Put tool implementations, authorization, schemas, business rules, idempotency records, and outcome checks in application-owned modules. Store conversation and workflow state in formats you can inspect and migrate. Export traces through an open interface where practical, and use stable internal IDs for tasks, tools, policies, and releases.

The Model Context Protocol can standardize some tool and context connections, but it does not settle orchestration, authorization, durability, or outcome evaluation. Treat protocol compatibility as one adapter property. Keep the security boundary in trusted application code and test the exact transport and server you deploy.

Decision checklist

  • The workflow needs a framework-owned capability that ordinary code does not already provide clearly.
  • The same proof task and cases were used for every candidate.
  • Crash recovery, resumed approvals, and uncertain writes were tested rather than inferred from docs.
  • A trace connects the request to the final business outcome without collecting sensitive content by default.
  • Tool authorization and business rules remain outside the model.
  • Task contracts, eval cases, tool code, and state can survive a framework change.
  • The selected framework passed every mandatory category before weighted preferences were considered.

Build evidence before committing

If you need structured teaching first, compare the best AI agent courses for developers. Then use the production AI engineering learning path and agent observability workflow to turn the proof task into an operable system.