Which Agent Framework in 2026? LangGraph vs CrewAI vs AutoGen vs OpenAI Agents SDK vs Claude Agent SDK vs Pydantic AI
A decision guide to the major AI agent frameworks — control vs. abstraction, multi-agent models, state and durability, and which fits your project.
By Imtiaz RayhanUpdated 10 min read
On this page
- The control ↔ abstraction spectrum
- The six at a glance
- The frameworks
- LangGraph — control and durability
- CrewAI — role-based crews
- AutoGen / AG2 — agents as conversation
- OpenAI Agents SDK — a minimal standard loop
- Pydantic AI — type-safe agents in plain Python
- Claude Agent SDK — batteries included on Claude
- How to choose
- Continue exploring
Pick an agent framework by how much control you need. LangGraph gives explicit, durable state graphs for production; CrewAI and AG2 offer high-level multi-agent abstractions; the OpenAI Agents SDK is a minimal, standard agent loop; Pydantic AI is the type-safe, model-agnostic loop for Python; the Claude Agent SDK is the batteries-included path for Claude.
Key takeaways
- The core trade-off is control vs. abstraction: LangGraph (explicit graphs) at one end, CrewAI/AutoGen (high-level multi-agent) at the other.
- LangGraph wins for production: persistence, checkpointing, human-in-the-loop, and resumable state.
- CrewAI models role-based crews with event-driven Flows for control; AG2 v1.0 models agents on a network of typed channels, and the old AutoGen classes now live in the separate ag2-classic package.
- The OpenAI Agents SDK is a minimal, provider-agnostic agent loop with handoffs, guardrails, sessions, and tracing.
- The Claude Agent SDK runs Claude Code's own agent loop as a library, with tools, permissions, hooks, and subagents included. It is Claude-only.
- Pydantic AI brings Pydantic's type safety to agents: validated outputs, typed tools and dependencies, most major providers and local models by changing one string, and durable execution on engines such as Temporal, DBOS, Prefect and Restate.
- Frameworks are not exclusive — prototype high-level, then move hot paths to LangGraph for control.
There are more agent frameworks than there are good reasons to choose between them on vibes. The useful way to decide is one axis: how much control do you need over the agent's control flow? Everything else — multi-agent model, ecosystem, ergonomics — follows from that.
The control ↔ abstraction spectrum
At one end, you specify the agent's behavior explicitly as a state machine; at the other, you describe roles or a conversation and let the framework coordinate. More abstraction means faster to start and less to maintain; more control means you can guarantee behavior, persist state, and debug production failures.
- High control / explicit → LangGraph
- High-level / multi-agent abstraction → CrewAI (roles), AutoGen/AG2 (conversation)
- Minimal, standard loop → OpenAI Agents SDK
- Typed, model-agnostic loop in Python → Pydantic AI
- Batteries-included on Claude → Claude Agent SDK
The six at a glance
Facts from each project's repository and docs, checked November 27, 2026.
| LangGraph | CrewAI | AG2 | OpenAI Agents SDK | Pydantic AI | Claude Agent SDK | |
|---|---|---|---|---|---|---|
| Maintainer | LangChain | CrewAI Inc. | Volunteer maintainers (ag2ai) | OpenAI | Pydantic | Anthropic |
| Licence | MIT | MIT | Apache-2.0 | MIT | MIT | MIT |
| Languages | Python, JS/TS (LangGraph.js) | Python | Python | Python, JS/TS | Python | Python, TypeScript |
| Install | pip install -U langgraph | uv tool install crewai | pip install 'ag2[openai]' | pip install openai-agents | uv add pydantic-ai | pip install claude-agent-sdk |
| Control model | Graph of nodes and edges over shared state | Role-based Crews, event-driven Flows | Agents on a Network: a hub plus typed channels | One agent loop with handoffs | One typed agent loop; graphs optional | Claude Code's agent loop as a library |
| Multi-agent | Subgraphs and explicit edges | Crew of agents with tasks | Channels: conversation, consulting, discussion, workflow | Handoffs and agents-as-tools | Delegation through tools, hand-off in code | Subagents |
| State and resume | Checkpointers (in-memory, SQLite, Postgres) keyed by thread_id | Typed Flow state | Hub keeps a write-ahead log and audit trail | Sessions | Durable execution on Temporal, DBOS, Prefect, Restate | Sessions you can resume or fork |
| Models | Any, through LangChain integrations or your own calls | Set per agent as a provider/model string | Provider extras: ag2[openai], ag2[anthropic], ag2[gemini], ag2[ollama] | OpenAI APIs plus "100+ other LLMs" | Most major providers and local models | Claude only |
The frameworks
LangGraph — control and durability
LangGraph has you model the agent as an explicit graph of nodes and edges over shared state. Its README calls it "a low-level orchestration framework for building, managing, and deploying long-running, stateful agents," and the docs are direct about the trade: it "does not abstract prompts or force a fixed agent architecture." You write the nodes as plain functions, wire the edges, and compile:
from langgraph.graph import StateGraph, MessagesState, START, END
from langgraph.checkpoint.memory import InMemorySaver
def mock_llm(state: MessagesState):
return {"messages": [{"role": "ai", "content": "hello world"}]}
graph = StateGraph(MessagesState)
graph.add_node(mock_llm)
graph.add_edge(START, "mock_llm")
graph.add_edge("mock_llm", END)
graph = graph.compile(checkpointer=InMemorySaver())
graph.invoke(
{"messages": [{"role": "user", "content": "hi!"}]},
{"configurable": {"thread_id": "thread-1"}},
)The checkpointer is what you are paying the wiring cost for. Every step's state is saved under a thread_id, so a run can stop for a human (interrupts let you inspect or edit state and continue), survive a crash, and resume where it left off. InMemorySaver loses everything on restart; SqliteSaver is for local development and PostgresSaver for production. Where it loses: the first demo takes longer than in any other framework here, and tracing and managed deployment live in LangSmith, a separate commercial product. Best when reliability and debuggability matter more than time-to-first-demo.
CrewAI — role-based crews
In CrewAI you describe agents by role, goal and backstory, give them tasks, and let the crew work through them. It is an open-source Python framework (Python 3.10 to 3.13) with two layers that its README describes as "autonomous agent collaboration through Crews and precise, event-driven control through Flows." A Flow is an ordinary class whose methods fire on events and share typed state; a Crew can run inside one step. Trimmed from the README's example:
from crewai.flow.flow import Flow, listen, start
from crewai import Crew, Agent, Task, Process
from pydantic import BaseModel
class MarketState(BaseModel):
sentiment: str = "neutral"
class AnalysisFlow(Flow[MarketState]):
@start()
def fetch_market_data(self):
self.state.sentiment = "analyzing"
return {"sector": "tech", "timeframe": "1W"}
@listen(fetch_market_data)
def analyze_with_crew(self, market_data):
analyst = Agent(
role="Senior Market Analyst",
goal="Conduct deep market analysis with expert insight",
backstory="You're a veteran analyst known for identifying subtle market patterns",
)
task = Task(
description="Analyze {sector} sector data for the past {timeframe}",
expected_output="Detailed market analysis with confidence score",
agent=analyst,
)
crew = Crew(agents=[analyst], tasks=[task], process=Process.sequential)
return crew.kickoff(inputs=market_data)The CLI scaffolds a project with crewai create crew <project_name>, which as of November 2026 generates a JSON-first layout (agents in agents/*.jsonc, tasks in crew.jsonc); --classic gives the older crew.py plus YAML layout. Where it loses: a Crew decides its own delegation, so the same input can take different paths, and you reach for Flows as soon as you need a guaranteed order. Managed deployment, tracing and governance are in CrewAI AMP, the commercial suite. Best for collaborative, role-shaped work you want running quickly.
AutoGen / AG2 — agents as conversation
The name covers three things now, and picking the wrong one costs a rewrite. Microsoft's AutoGen repository is archived: its README says Microsoft "is not providing bug fixes, security fixes, new features, or support for this project" and sends new users to Microsoft Agent Framework. The community fork, AG2, shipped a v1.0 that is not the AutoGen you remember: pip install ag2 "no longer ships the autogen import name or the classic agent classes." ConversableAgent, GroupChat and import autogen now live in a separate package, ag2-classic, which is still maintained.
New AG2 (Python 3.11 or newer) is async and smaller at the single-agent level:
import asyncio
from ag2 import Agent
from ag2.config import OpenAICompletionsConfig
agent = Agent(
"assistant",
prompt="You are a helpful assistant.",
config=OpenAICompletionsConfig(model="gpt-4o-mini"),
)
async def main() -> None:
reply = await agent.ask("Summarize the main differences between Python lists and tuples.")
print(reply.body)
asyncio.run(main())Multi-agent work runs on the Network: a hub that owns the registry, a write-ahead log and the audit trail, with agents talking over typed channels (conversation, consulting, discussion, and workflow, a declarative transition graph that is the closest thing to a classic group chat). Where it loses: AG2 v1.0 "is not a drop-in upgrade from Classic," most tutorials online still show the old API, and the project is run by volunteer maintainers. Best for conversational and research-style multi-agent systems, if you start on the v1 API.
OpenAI Agents SDK — a minimal standard loop
The OpenAI Agents SDK is a small framework with few primitives: an Agent (a model with instructions, tools, guardrails and handoffs), a Runner, sessions for conversation history, and built-in tracing. Its README calls it "provider-agnostic, supporting the OpenAI Responses and Chat Completions APIs, as well as 100+ other LLMs." The whole hello-world is three lines:
from agents import Agent, Runner
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
print(result.final_output)Multi-agent work is delegation: one agent hands the conversation to another, or calls another agent as a tool. The SDK has grown past the loop, with human-in-the-loop approvals, sandbox agents that work in a container over long tasks, and realtime and voice agents, plus a JS/TS version. Where it loses: there is no graph and no checkpointing of arbitrary state, so branching logic lives in your own Python, and tracing and hosted tools are most complete on OpenAI's platform. Best when you want a clean standard loop without a heavy abstraction.
Pydantic AI — type-safe agents in plain Python
Pydantic AI, from the team behind Pydantic, is a typed, model-agnostic agent loop for Python. Agent outputs are validated against your Pydantic models, tool arguments are checked before your code runs, and dependencies and outputs are typed, so your IDE and type checker flag mismatches before you run anything. Pydantic says this moves "whole classes of errors from runtime to write-time." Switching between OpenAI, Anthropic, Gemini, Amazon Bedrock and local models means changing one string.
Multi-agent work starts simple: one agent delegates to another through a tool, or your code hands off between agents, and pydantic-graph adds typed state machines when control flow outgrows that. The production pieces are built in: durable execution on engines such as Temporal, DBOS, Prefect and Restate, tools that pause for human approval, MCP client support, AG-UI and Vercel AI SDK adapters for front ends, and Pydantic Evals for offline and online evaluation. Instrumentation is OpenTelemetry, so traces go to Pydantic's Logfire or any other OTel backend. V2, the current stable line, shipped on June 23, 2026, under the MIT license. Best when you want FastAPI-style type safety and validated outputs without a heavy abstraction.
Claude Agent SDK — batteries included on Claude
The Claude Agent SDK is Anthropic's first-party toolkit, and it is a different kind of thing from the other five: a library that runs the Claude Code agent inside your own Python or TypeScript process. Anthropic's docs say it gives you "the same tools, agent loop, and context management that power Claude Code." The Python package bundles the Claude Code CLI, so there is nothing else to install:
import anyio
from claude_agent_sdk import query, ClaudeAgentOptions
async def main():
options = ClaudeAgentOptions(
allowed_tools=["Read", "Write", "Bash"], # auto-approve these tools
permission_mode="acceptEdits", # auto-accept file edits
)
async for message in query(prompt="Add a test for the parser module", options=options):
print(message)
anyio.run(main)Out of the box the agent has Claude Code's toolset (Read, Write, Edit, Bash and others), a permission system, hooks that run your code at points in the agent lifecycle, subagents, MCP servers (including in-process ones defined as Python functions), sessions you can resume or fork, and the skills, commands and memory in your project's .claude/ folder. Where it loses: it runs Claude models only, and you get Claude Code's loop as designed, not a graph you can rewire. If you want Anthropic to host the agent, that is Managed Agents, a separate product. The most complete path if you're committed to Claude.
How to choose
- Production agent needing state, checkpoints, HITL → LangGraph (head-to-head with the minimal loop: OpenAI Agents SDK vs LangGraph).
- Fast role-based multi-agent prototype → CrewAI.
- Conversational / research multi-agent systems → AG2 (AutoGen's community continuation; start on the v1
ag2API, notag2-classic). - Already on Microsoft AutoGen → plan a migration: the repository is archived, and Microsoft points to Microsoft Agent Framework.
- A clean, minimal, provider-agnostic loop → OpenAI Agents SDK.
- Validated, typed outputs across providers, in Python → Pydantic AI.
- Building on Claude, want the smoothest path → Claude Agent SDK.
- A TypeScript team that wants one language end to end → Mastra or LangGraph.js; see Mastra vs LangChain.
- A single model with a few tools → maybe no framework — write the loop directly.
These aren't mutually exclusive. A common trajectory is to prototype high-level (CrewAI or AG2), then move the production-critical path to LangGraph once you need control and durability. Whatever you pick, the next two problems are the same everywhere: giving the agent agent memory architecture and making its tool calling robust — and then making it production-ready.
Continue exploring
- eval-driven-developer — Drive AI feature development with evals the way TDD drives code: define success criteria and a representative eval set before iterating on prompts or agents.
- Google ADK — Google's open-source, code-first framework to build, evaluate, and deploy AI agents.
- OpenHands — Open-source autonomous AI software-development agent (formerly OpenDevin) — writes code, runs commands, and browses the web in a sandbox.
Frequently asked questions
- What is the best AI agent framework in 2026?
- There's no single best — it depends on how much control you need. LangGraph is the strongest choice for production agents that need explicit state, checkpointing, and human-in-the-loop. CrewAI and AG2, the community continuation of AutoGen, are fastest for prototyping multi-agent systems (role-based crews vs. conversational agents). The OpenAI Agents SDK is a clean minimal loop, Pydantic AI is the type-safe option for Python teams, and the Claude Agent SDK is the most complete path on Claude. Match the framework to your control and durability needs, not to hype.
- LangGraph or CrewAI?
- Choose CrewAI to stand up a role-based multi-agent prototype fast with minimal wiring. Choose LangGraph when you need explicit control over the agent's state machine — branching, loops, persistence/checkpointing, and resumable human-in-the-loop. A common path is to prototype in CrewAI and move the production-critical workflow to LangGraph when control and durability start to matter.
- Pydantic AI or LangGraph?
- Choose Pydantic AI when you want validated, typed outputs and a plain-Python agent loop that switches models by changing one string. It grows into multi-agent work through delegation and hand-off, with pydantic-graph and durable execution engines such as Temporal and DBOS for longer workflows. Choose LangGraph when the graph is the design itself: explicit state, checkpointing and resumable human-in-the-loop as first-class features.
- Do I even need an agent framework?
- Not always. If your agent is a single model with a few tools in a simple loop, you can write it directly against a model SDK and skip the abstraction. Reach for a framework when you need multi-agent coordination, durable/resumable state, human-in-the-loop, or built-in tracing — the things that are tedious and error-prone to hand-roll.
- How is the Claude Agent SDK different from these frameworks?
- The Claude Agent SDK is Anthropic's first-party toolkit, and it runs the Claude Code agent as a library in your Python or TypeScript process, with its built-in tools, permissions, hooks, MCP, subagents, and sessions. The others are model-agnostic frameworks you assemble an agent from. If you're committed to Claude and want the smoothest path, the Claude Agent SDK is the natural choice; if you need provider flexibility or a specific orchestration model, pick accordingly.
Filed under
agents · frameworks · comparison · langgraph · crewai · pydantic-ai
About the author
Software developer · Co-founder of DotCamp
Imtiaz Rayhan is a software developer and co-founder of DotCamp, the WordPress plugin company behind Ultimate Blocks, WP Table Builder and Tableberg. He has published plugins on WordPress.org since 2017, and the plugins he develops there have more than 100,000 active installations. He writes and maintains AgentsCamp and builds its sibling projects OptimizeCamp, GritShip and SurePrompts.
Related
- ToolAutoGen (AG2)Microsoft's multi-agent conversation framework, now archived in favour of Microsoft Agent Framework. AG2 is the community fork that is still developed.
- ToolCrewAIAn MIT-licensed Python framework that runs role-based AI agents as crews and wires them into event-driven Flows, with a hosted enterprise platform, CrewAI AMP.
- ToolLangGraphA low-level, MIT-licensed library and runtime for building stateful agents as graphs, with checkpointing, human-in-the-loop interrupts and streaming.
- GuideAgent Memory Architecture: Short-Term, Long-Term, and When to Use EachHow AI agents remember: working vs long-term memory, a record schema, an extraction prompt, scoped retrieval, and Mem0, Zep, Letta and LangGraph compared.
- GuideProduction Tool & Function Calling: Feed Errors Back as ObservationsHow agents use tools: the call, observe, retry loop, a weak vs strict tool schema, error results the model can act on, idempotency keys, and default caps.
- AgentAgent Reliability ReviewerUse this agent to make an AI agent production-ready — reviewing its loops, cost controls, error handling, tool use, human-in-the-loop gates, checkpointing, and observability, then reporting concrete failure modes and fixes. Examples — "is our agent safe to ship?", "our agent loops forever / burns tokens, harden it", "add guardrails and recovery before we put this agent in front of users".
- GuideLangGraph vs CrewAI: Agent Frameworks Compared (2026)LangGraph vs CrewAI with the same task coded in both: explicit graph and checkpointers vs roles, tasks and Flows. Licences, versions, hosting.
- TermAgent EngineeringAgent engineering is the discipline of building reliable AI agents — designing the tools, context, guardrails, evals, and recovery paths around the model.