Agent Framework Comparison
A decision guide for choosing between LangGraph, CrewAI, AG2, OpenAI Agents SDK, Google ADK, Mastra, Vercel AI SDK, and Direct API — structured around cost, lock-in risk, failure modes, and concrete trade-offs rather than feature lists.
Quick Reference
- →Direct API: no framework — minimal imports, full control, best for simple tool-calling loops or when you own the whole loop
- →LangGraph: graph-based state machines, fine-grained control, checkpointing, HITL — the production standard for complex stateful agents
- →CrewAI: role-based multi-agent, easiest path to a crew prototype — trades control for speed at the cost of debugging opacity
- →AG2 (formerly AutoGen): community fork of AutoGen post-split, conversation-driven multi-agent, MIT, Python — Microsoft's AutoGen is now maintenance-only
- →OpenAI Agents SDK: Python-first, built-in sandboxing and code harness, 100+ LLM support, April 2026 update added long-horizon task support
- →Google ADK: Python/Java/Go/TS, enterprise-grade, native Google Cloud integration — the choice when deploying to Vertex AI Agent Engine
- →Mastra: TypeScript-native, workflow engine + agents + built-in RAG, v1.0 released Jan 2026 — fills the gap for Node.js backends
- →Vercel AI SDK v6: TypeScript, unified AI Gateway, hooks + streaming — purpose-built for Next.js and frontend AI features
Do You Even Need a Framework?
The question most framework comparison articles skip is the most important one: should you use a framework at all? Every framework adds dependencies, lock-in, and a layer of abstraction between your code and the API. For many production agents, the cost of that abstraction is not justified.
| Your agent needs... | Recommendation | Why |
|---|---|---|
| Single tool-calling loop, one provider | Direct API | A while loop + the SDK is all you need. No framework code to debug. |
| Streaming UI in Next.js / React | Vercel AI SDK | Built exactly for this. useChat, useCompletion, streamText — zero plumbing. |
| Branching, loops, checkpointing, HITL | LangGraph | Graph-based state machines are the right abstraction. Nothing else matches. |
| Multi-agent team, fast prototype in Python | CrewAI | Roles + tasks → working crew in under an hour. |
| Multi-agent in TypeScript / Node.js backend | Mastra | LangGraph Python wrappers in TS are painful. Mastra is the native alternative. |
| Agents that negotiate via conversation | AG2 | Conversation-driven orchestration is AG2's core model. |
| Google Cloud / Vertex AI deployment | Google ADK | Native Cloud Run + Agent Engine integration; everything else adds friction. |
| Python agents with sandboxed code execution | OpenAI Agents SDK | Built-in harness + sandbox; other frameworks require manual wiring. |
Reaching for a framework before you've written the agent. Write your agent as a direct API loop first. Count the lines of framework-specific code you'd need to add. If the framework code exceeds your business logic, you are paying an abstraction tax with no return.
start here — pick the right layer before writing code