Decision guide
AI Agent Frameworks Compared
How should you build an AI agent: your own loop, an agent SDK, a graph framework or a hosted platform?
Side by side
| Criterion | Plain SDK loop | Claude Agent SDK | LangGraph | OpenAI Agents SDK | CrewAI | Managed agent platform |
|---|---|---|---|---|---|---|
| Control over the loop | Total | High (hooks, permissions) | High (explicit graph) | Medium | Lower (framework-driven) | Configuration-level |
| Persistence and resumption | Build it yourself | Sessions | Checkpointing built in | Sessions; build long-running persistence | Limited; add your own | Built in (hosted sessions) |
| Built-in tools and sandbox | None | Files, shell, web; you provide the machine | Bring your own | Hosted tools on OpenAI's platform | Tool integrations | Hosted sandbox per session |
| Model portability | Any (you choose the SDK) | Claude | Many providers | OpenAI-first; others via adapters | Many providers | The platform's models |
| Learning curve | Lowest to start | Low | Medium-high | Low | Low | Low (API concepts) |
| Operational burden | Yours | Yours (runs in your process) | Yours (or their platform) | Yours | Yours | Mostly the provider's |
When to choose each
Plain SDK loop
Call the model API with tools and run the loop yourself (often under 100 lines).
Choose when
- One or a few tools and a clear task
- You want full control and minimal dependencies
- Learning how agents work
Avoid when
- Long-running agents that need persistence, resumption or sandboxes
Claude Agent SDK
The agent harness behind Claude Code as a library: built-in file and shell tools, permissions, context management, subagents and MCP.
Choose when
- Coding, file and terminal-heavy agents
- You want a proven loop with context management and permissions
- Claude models
Avoid when
- Strict multi-provider model portability
- Simple single-call features
LangGraph
A graph-based framework for stateful agents: nodes, edges, checkpoints, human-in-the-loop and resumable runs.
Choose when
- Workflows with explicit steps, branches and approval points
- Long-running runs that must survive restarts
- You want to mix providers
Avoid when
- Small agents where a graph adds ceremony
OpenAI Agents SDK
A lightweight SDK for agents with tools, handoffs between agents, guardrails and built-in tracing.
Choose when
- Multi-agent handoffs with little code
- Teams already on OpenAI models and tracing
Avoid when
- Deep custom orchestration and persistence needs
CrewAI
A framework for role-based multi-agent 'crews' with tasks and processes.
Choose when
- Prototyping multi-agent collaboration quickly
- Business workflows described as roles and tasks
Avoid when
- Tight control over every step, cost and latency
Managed agent platform
A hosted service runs the agent loop and a sandbox for its tools (for example Claude Managed Agents); you define the agent and start sessions.
Choose when
- You don't want to run loops, sandboxes or schedulers yourself
- Scheduled or long-running agents with file workspaces
- Versioned agent configurations
Avoid when
- Data or tools that must stay entirely inside your infrastructure (unless the platform offers self-hosted sandboxes)
Verdict
Start with a plain loop to learn what your agent actually needs; most production agents are a model, a few well-designed tools and strict limits. Move to the Claude Agent SDK for coding and file-heavy agents, LangGraph when you need explicit stateful workflows with checkpoints and approvals, the OpenAI Agents SDK or CrewAI for quick multi-agent prototypes, and a managed platform when you'd rather not run loops, sandboxes and schedules yourself. Whatever you choose, evals, tracing and approval gates matter more than the framework.
Learn more
- Integrating LLM APIs
- AI Agents and MCP in Production
- LLM Evals and Guardrails
- System Design Problems
- Write a bounded tool-calling loop (AI & LLM APIs)
- Use MCP server tools from your own app (AI & LLM APIs)