Agent Architecture/Beyond LangChain
Intermediate18 min

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...RecommendationWhy
Single tool-calling loop, one providerDirect APIA while loop + the SDK is all you need. No framework code to debug.
Streaming UI in Next.js / ReactVercel AI SDKBuilt exactly for this. useChat, useCompletion, streamText — zero plumbing.
Branching, loops, checkpointing, HITLLangGraphGraph-based state machines are the right abstraction. Nothing else matches.
Multi-agent team, fast prototype in PythonCrewAIRoles + tasks → working crew in under an hour.
Multi-agent in TypeScript / Node.js backendMastraLangGraph Python wrappers in TS are painful. Mastra is the native alternative.
Agents that negotiate via conversationAG2Conversation-driven orchestration is AG2's core model.
Google Cloud / Vertex AI deploymentGoogle ADKNative Cloud Run + Agent Engine integration; everything else adds friction.
Python agents with sandboxed code executionOpenAI Agents SDKBuilt-in harness + sandbox; other frameworks require manual wiring.
The most common mistake

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.

YesNoYesNoYesNoBuilding an agent?Simple one-call loop?no state, no branchingRaw SDKanthropic / openai SDKNeed graph control or HITL?parallel branches, routingLangGraphgraphs + HITL + checkpointsWant batteries-included?auto context, filesystem, subagentsDeep Agentsharness + built-in toolsLangChaincustom middleware

start here — pick the right layer before writing code