AI agent frameworks compared: LangGraph, CrewAI, OpenAI, Claude, ADK and more
Nine Python agent frameworks compared on version, core idea, strengths and when to skip each, plus one task run in plain Python, LangGraph and Pydantic AI.
Every agent framework wraps the same loop. The model reads the conversation, either asks for a tool or answers, your code runs the tool, and the result goes back into the conversation. The frameworks differ in what they put around that loop: graphs and checkpoints, role-playing crews, handoffs between agents, a ready-made coding agent, typed outputs, or retrieval.
This post compares nine Python frameworks as they stand on 22 November 2026, with version numbers pulled from PyPI that day. Then it runs one small two-tool task three ways (plain Python, LangGraph and Pydantic AI) with a stubbed model, so you can see how much each framework adds and what you get back for it. A last test checks that each runner stops a model that never stops calling tools.
If you want the patterns these frameworks implement (ReAct, plan-and-execute, reflection, routers), read AI agent architectures explained. For multi-agent designs such as supervisors and handoffs, see multi-agent architecture patterns. This post is about the libraries.
The loop every framework wraps#
+-------------------+
user --> | conversation | <-------------------+
+-------------------+ |
| |
v |
+-------------------+ tool call +-----------+
| model | ------------> | run tool |
+-------------------+ +-----------+
|
| final answer
v
output
What a framework adds around this box:
state + checkpoints (LangGraph, MS Agent Framework workflows)
roles + tasks (CrewAI)
handoffs + guardrails (OpenAI Agents SDK)
built-in file/shell tools, hooks, permissions (Claude Agent SDK)
typed outputs + test models (Pydantic AI)
retrieval + document tools (LlamaIndex)
code-as-action (smolagents, LlamaIndex CodeActAgent)
Keep this picture in mind when you read a framework's docs. Ask what it does with state between turns, how it stops the loop, how you test it without paying for tokens, and how you see what happened after a run fails.
Versions on 22 November 2026#
All numbers come from each package's PyPI JSON page on 22 November 2026. Several of these ship every few days, so check again before you pin.
| Package | Version | Released | Python |
|---|---|---|---|
| langgraph | 1.2.24 | 2026-11-20 | >=3.10 |
| crewai | 1.15.44 | 2026-11-19 | >=3.10, <3.14 |
| openai-agents | 0.25.0 | 2026-11-18 | >=3.10 |
| claude-agent-sdk | 0.2.187 | 2026-11-20 | >=3.10 |
| google-adk | 2.15.0 | 2026-11-20 | >=3.11 |
| pydantic-ai | 2.71.0 | 2026-11-19 | >=3.11 |
| llama-index-core | 0.14.26 | 2026-11-13 | >=3.11, <4.0 |
| agent-framework (Microsoft) | 1.26.0 | 2026-11-12 | >=3.11 |
| smolagents | 1.26.0 | 2026-05-29 | >=3.10 |
Two details in that table affect real projects. CrewAI's metadata excludes Python 3.14 and later, so a fresh machine with a new default interpreter needs a pinned older Python for it. And smolagents has not had a release in about six months, while every other package on the list shipped this month.
The nine frameworks#
LangGraph#
LangGraph models an agent as a state graph. You define a typed state, nodes that return partial updates to it, and edges (some conditional) between nodes. Reducers decide how updates merge, so a list field can append instead of overwrite. A checkpointer saves state after each step, which gives you resumable threads, human approval through interrupts, and time travel for debugging. The overview docs describe it as a "low-level orchestration framework and runtime", and that is accurate: it does not hide the loop from you.
Pick it when the control flow matters: retries with a cap, an approval step before an email goes out, a long job that must survive a restart. Skip it for a single agent with three tools and no branching, where the graph is boilerplate. The LangGraph explained from scratch post builds one graph step by step, including checkpoints and interrupts.
CrewAI#
CrewAI has two layers. Crews are teams of agents, each with a role, goal and backstory, assigned tasks that run sequentially or under a manager agent. Flows are event-driven workflows with explicit state that call crews as units of work. The introduction page calls Flows "the backbone" and Crews "the units of work within your Flow".
It is the fastest route from an idea to a demo when the job is text in, text out: research, summarise, review. Role prompts are easy to read and easy for non-engineers to edit. Skip it when you need tight control over each model call or exact token accounting, because the role and task prompts the framework builds sit between you and the model. The multi-agent web scraper with CrewAI shows a sensible split: plain Python does the fetching, agents only summarise and fact-check.
OpenAI Agents SDK#
The OpenAI Agents SDK is the production successor to the Swarm experiment. Its core is a short list of primitives: agents (a model with instructions and tools), handoffs and agents-as-tools for delegation, guardrails for validating input and output, and sessions for conversation history. Tracing is built in. The models page documents non-OpenAI models through LiteLLM and any-llm adapters.
Pick it when you want a small API with handoffs and tracing and you mostly run on OpenAI models. Note the version: 0.25.0 is still pre-1.0, so expect breaking changes between minor releases and pin exactly. Skip it if you need durable, resumable workflows with explicit branching; that is graph territory.
Claude Agent SDK#
The Claude Agent SDK exposes the agent runtime behind Claude Code as a library. You get the agent loop plus built-in tools for reading and editing files, running shell commands and searching, along with hooks, permission modes, subagents and MCP servers. The Python package README says the Claude Code CLI is bundled with the package, and query() returns an async iterator of messages.
Pick it when the agent's work is on a filesystem or a codebase: triage a repo, edit configs, run tests, write reports from local files. You do not write the file tools yourself, and they have already been hardened against a lot of edge cases. Skip it when you need to swap model vendors freely or when your agent has no use for files and a shell; then the bundled runtime is weight you carry for nothing.
Google ADK#
The Agent Development Kit offers LLM agents plus workflow agents (sequential, parallel and loop) and, since ADK 2.0, graph workflows. It has SDKs for Python, TypeScript, Go, Java and Kotlin. Its model docs list Gemini first and also cover Claude, OpenAI, Ollama, vLLM and LiteLLM. It ships a local web UI for inspecting runs and has a deployment path to Google Cloud's agent runtime.
Pick it when you deploy on Google Cloud, use Gemini, or need the same agent design across several languages. Skip it if your team is on another cloud and has no reason to adopt Google's runtime and tooling.
Pydantic AI#
Pydantic AI treats an agent like a FastAPI endpoint: typed dependencies injected into tools, typed structured output validated by Pydantic, and tool schemas generated from function signatures. Its testing page documents TestModel and FunctionModel, which replace the LLM in unit tests. Usage limits stop runaway loops. Pydantic Evals grades outputs and tool-call trajectories, and the newer Pydantic AI Harness package adds memory, guardrails and sub-agents as composable capabilities.
Pick it when you care about types, tests and validated output, which covers most backend work. It is the easiest framework here to test offline, as the code below shows. Skip it when your main need is a visual multi-agent orchestration story; its graph library exists but is not the centre of the product.
LlamaIndex agents#
LlamaIndex started as a RAG library and its agent layer sits on its event-driven Workflows engine. In llama-index-core 0.14.26 the agent classes are FunctionAgent, ReActAgent, CodeActAgent and AgentWorkflow for multi-agent handoffs (from llama_index/core/agent/workflow/__init__.py in the wheel). The agents guide covers state, streaming, human-in-the-loop and durable workflows.
Pick it when retrieval is most of the job: an agent over contracts, manuals or a knowledge base, where the loaders, parsers, indexes and query engines save weeks. Skip it if you have no documents to retrieve, because you would be pulling in a large dependency tree for a thin agent loop.
Microsoft Agent Framework#
Microsoft Agent Framework (MAF) is the successor to both AutoGen and Semantic Kernel, built by the same teams. The overview says it combines AutoGen's agent abstractions with Semantic Kernel's session state, type safety, middleware and telemetry, and adds graph-based workflows. The Semantic Kernel repo now opens with a notice that MAF has reached 1.0 with stable APIs. The AutoGen repo is archived: Microsoft states it provides no bug fixes or security fixes and points users to MAF and a migration guide.
This is the biggest change since most "top frameworks" lists were written. If a tutorial tells you to start with AutoGen's AssistantAgent and UserProxyAgent, it is out of date; autogen-agentchat last shipped 0.7.5 on 30 September 2025. Pick MAF when you are on Azure, need .NET and Python side by side, or are migrating from AutoGen or Semantic Kernel. Skip it for a quick Python prototype with no Microsoft stack around it.
smolagents#
smolagents from Hugging Face keeps its core logic to about a thousand lines. Its main idea is the CodeAgent: instead of emitting JSON tool calls, the model writes Python that calls tools, so loops, conditionals and nested calls happen in one step. The docs offer sandboxed execution options, and the library works with Hub models, local models and API providers.
Pick it for research, for learning how an agent loop works, or when code-as-action fits your task. Skip it for production systems that need durable state and long-term support, given the six-month release gap noted above and the security work any model-written code execution requires.
Comparison table#
| Framework | Core abstraction | Model lock-in | Durable state | Offline test model | Best fit |
|---|---|---|---|---|---|
| LangGraph | State graph, nodes, edges | None | Checkpointers, threads | Any callable node | Branching, approvals, long jobs |
| CrewAI | Crews of role agents, Flows | None (LiteLLM or native) | Flow state | Not covered here | Fast text-workflow prototypes |
| OpenAI Agents SDK | Agents, handoffs, guardrails | OpenAI-first | Sessions | Custom Model class |
Handoff-style assistants on OpenAI |
| Claude Agent SDK | Claude Code runtime as a library | Claude | Sessions | Not offline | Agents working on files and code |
| Google ADK | LLM agents + workflow agents | Gemini-first | Sessions, graph workflows | Not covered here | Google Cloud deployments |
| Pydantic AI | Typed agent, DI, validated output | None | Via add-on packages and durable integrations | TestModel, FunctionModel |
Typed backend services |
| LlamaIndex | Workflow agents over indexes | None | Workflow context | Mock LLM classes | Retrieval-heavy agents |
| MS Agent Framework | Agents + graph workflows | None, Azure-first | Session state | Not covered here | Azure and .NET shops |
| smolagents | Code-writing agent | None | Minimal | Any callable model | Research, code-as-action |
"Not covered here" means I did not verify it for this post, not that it is missing.
A decision guide#
Work through these in order and stop at the first yes.
- Can a single function with one LLM call do it? Then write the function. MAF's own overview says the same: if you can write a function to handle the task, do that instead of using an agent.
- Is the agent's job mostly reading and editing files or running commands? Claude Agent SDK.
- Is retrieval over your documents most of the work? LlamaIndex.
- Do you need explicit branching, retries with a cap, human approval, or resume after a crash? LangGraph, or MAF workflows if you are on Azure.
- Do you want typed outputs and unit tests that run without network access? Pydantic AI.
- Are you committed to one vendor's cloud? OpenAI Agents SDK, Google ADK or MAF to match.
- Do you need a working multi-agent text pipeline by tomorrow? CrewAI.
Mixing is normal. A common production shape is LangGraph or Pydantic AI for the outer workflow with a LlamaIndex query engine as one tool inside it.
One task, three ways#
The task: "What does SKU A12 cost after 15% off?" The agent has two tools, lookup_price and apply_discount, and must call them in order. No API key is used anywhere. The model is a scripted function behind a small interface: it takes the tool results so far and returns either a tool call or an answer. In a real system that function is a chat-completions call with tool schemas, and nothing else changes.
Tested with Python 3.15.2, langgraph==1.2.24 and pydantic-ai-slim==2.71.0 in a venv.
# shared.py
PRICES = {"A12": 2400.0, "B7": 999.0}
def lookup_price(sku: str) -> float:
"""Return the list price in rupees for a SKU."""
if sku not in PRICES:
raise KeyError(f"unknown sku {sku}")
return PRICES[sku]
def apply_discount(price: float, pct: float) -> float:
"""Return price after a percentage discount, rounded to 2 places."""
return round(price * (1 - pct / 100), 2)
def fake_model(question: str, tool_results: list[tuple[str, object]]) -> dict:
"""Stand-in for an LLM call. A real model reads the conversation and
returns either a tool call or a final answer; this one follows a script.
Swap this function for a real chat-completions call with tool schemas."""
done = dict(tool_results)
if "lookup_price" not in done:
return {"tool": "lookup_price", "args": {"sku": "A12"}}
if "apply_discount" not in done:
return {"tool": "apply_discount",
"args": {"price": done["lookup_price"], "pct": 15}}
return {"answer": f"A12 costs Rs {done['apply_discount']} after 15% off."}
Plain Python#
# plain.py
from shared import lookup_price, apply_discount, fake_model
TOOLS = {"lookup_price": lookup_price, "apply_discount": apply_discount}
def run(question: str, max_steps: int = 5) -> str:
results: list[tuple[str, object]] = []
for step in range(1, max_steps + 1):
decision = fake_model(question, results)
if "answer" in decision:
return decision["answer"]
name, args = decision["tool"], decision["args"]
out = TOOLS[name](**args)
print(f"step {step}: {name}({args}) -> {out}")
results.append((name, out))
raise RuntimeError("step budget exhausted")
print(run("What does A12 cost after 15% off?"))
step 1: lookup_price({'sku': 'A12'}) -> 2400.0
step 2: apply_discount({'price': 2400.0, 'pct': 15}) -> 2040.0
A12 costs Rs 2040.0 after 15% off.
Twenty lines, and 2400 x 0.85 = 2040 checks out. What is missing is everything you would add next: tool schemas for the real model, persistence, tracing, retries.
LangGraph#
# lg.py
import operator
from typing import Annotated, TypedDict
from langgraph.graph import StateGraph, START, END
from shared import lookup_price, apply_discount, fake_model
TOOLS = {"lookup_price": lookup_price, "apply_discount": apply_discount}
class State(TypedDict):
question: str
results: Annotated[list, operator.add] # reducer: append, never overwrite
decision: dict
def model_node(state: State) -> dict:
return {"decision": fake_model(state["question"], state["results"])}
def tool_node(state: State) -> dict:
d = state["decision"]
out = TOOLS[d["tool"]](**d["args"])
print(f"tool: {d['tool']}({d['args']}) -> {out}")
return {"results": [(d["tool"], out)]}
def route(state: State) -> str:
return END if "answer" in state["decision"] else "tools"
g = StateGraph(State)
g.add_node("model", model_node)
g.add_node("tools", tool_node)
g.add_edge(START, "model")
g.add_conditional_edges("model", route, ["tools", END])
g.add_edge("tools", "model")
app = g.compile()
final = app.invoke({"question": "What does A12 cost after 15% off?", "results": []},
{"recursion_limit": 10})
print(final["decision"]["answer"])
print("tool results kept in state:", len(final["results"]))
tool: lookup_price({'sku': 'A12'}) -> 2400.0
tool: apply_discount({'price': 2400.0, 'pct': 15}) -> 2040.0
A12 costs Rs 2040.0 after 15% off.
tool results kept in state: 2
The code is longer and the answer is identical. What you bought is structure: the loop is now data (two nodes, one conditional edge), so you can add a checkpointer to compile(), put an interrupt before tools, or insert a validation node without touching the others. In a real app you would use LangGraph's prebuilt tool node and a chat model with bound tools; I kept the stub so the three versions stay comparable.
Pydantic AI#
FunctionModel replaces the LLM with your own function, which receives the framework's real message history and the tool definitions it would send to a model.
# pai.py
from pydantic_ai import Agent
from pydantic_ai.messages import (ModelMessage, ModelResponse, TextPart,
ToolCallPart, ToolReturnPart)
from pydantic_ai.models.function import AgentInfo, FunctionModel
from shared import lookup_price, apply_discount, fake_model
def scripted(messages: list[ModelMessage], info: AgentInfo) -> ModelResponse:
# Rebuild (tool_name, result) pairs from the framework's message history.
results = [(p.tool_name, p.content) for m in messages for p in m.parts
if isinstance(p, ToolReturnPart)]
if not results: # first call: show what the framework sends the model
for t in info.function_tools:
print("schema:", t.name, t.parameters_json_schema["properties"])
d = fake_model("", results)
if "answer" in d:
return ModelResponse(parts=[TextPart(d["answer"])])
return ModelResponse(parts=[ToolCallPart(d["tool"], d["args"])])
agent = Agent(FunctionModel(scripted), tools=[lookup_price, apply_discount])
result = agent.run_sync("What does A12 cost after 15% off?")
print(result.output)
for m in result.all_messages():
for p in m.parts:
print(f" {type(p).__name__:15} {getattr(p, 'tool_name', '') or ''}"
f" {getattr(p, 'args', '') or getattr(p, 'content', '')}")
schema: lookup_price {'sku': {'type': 'string'}}
schema: apply_discount {'price': {'type': 'number'}, 'pct': {'type': 'number'}}
A12 costs Rs 2040.0 after 15% off.
UserPromptPart What does A12 cost after 15% off?
ToolCallPart lookup_price {'sku': 'A12'}
ToolReturnPart lookup_price 2400.0
ToolCallPart apply_discount {'price': 2400.0, 'pct': 15}
ToolReturnPart apply_discount 2040.0
TextPart A12 costs Rs 2040.0 after 15% off.
The JSON schemas came from the type hints with no extra code, and the full message trace is available for assertions in a test. To go live, replace FunctionModel(scripted) with a model name string such as an OpenAI or Anthropic model id. One surprise in 2.71.0: the first run printed a multi-line banner suggesting Logfire setup. Setting PYDANTIC_AI_NO_BANNER=1 turns it off, which you want in CI logs.
Test: a model that never stops#
The most expensive agent bug is a loop that keeps calling tools. Each runner should cap it. This script gives all three a model that always asks for lookup_price again.
# loops.py
from langgraph.errors import GraphRecursionError
from langgraph.graph import StateGraph, START, END
from typing import TypedDict
from pydantic_ai import Agent
from pydantic_ai.exceptions import UsageLimitExceeded
from pydantic_ai.messages import ModelResponse, ToolCallPart
from pydantic_ai.models.function import FunctionModel
from pydantic_ai.usage import UsageLimits
from shared import lookup_price
def stuck_model(*_): # always asks for the same tool again
return {"tool": "lookup_price", "args": {"sku": "A12"}}
# 1. plain loop with a step budget
try:
for step in range(5):
lookup_price(**stuck_model()["args"])
raise RuntimeError("plain: step budget of 5 exhausted")
except RuntimeError as e:
print(e)
# 2. LangGraph recursion_limit
class S(TypedDict):
n: int
g = StateGraph(S)
g.add_node("model", lambda s: {"n": s["n"] + 1})
g.add_node("tools", lambda s: {"n": s["n"]})
g.add_edge(START, "model")
g.add_conditional_edges("model", lambda s: "tools", ["tools", END])
g.add_edge("tools", "model")
try:
g.compile().invoke({"n": 0}, {"recursion_limit": 6})
except GraphRecursionError as e:
print("langgraph:", type(e).__name__, str(e).splitlines()[0])
# 3. Pydantic AI usage limits
agent = Agent(FunctionModel(lambda m, i: ModelResponse(
parts=[ToolCallPart("lookup_price", {"sku": "A12"})])), tools=[lookup_price])
try:
agent.run_sync("price?", usage_limits=UsageLimits(request_limit=3))
except UsageLimitExceeded as e:
print("pydantic-ai:", type(e).__name__, e)
plain: step budget of 5 exhausted
langgraph: GraphRecursionError Recursion limit of 6 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.
pydantic-ai: UsageLimitExceeded The next request would exceed the request_limit of 3. Consider raising the limit, or see the docs on usage limits for budget-aware patterns: https://pydantic.dev/docs/ai/core-concepts/agent/#usage-limits
All three stop, each with its own exception type, so your caller needs to catch the right one. LangGraph counts graph steps, not model calls: with a model node and a tool node, a limit of 6 allows about three model calls. Pydantic AI counts model requests directly, which maps better to cost. Put a test like this in CI for whatever framework you choose, and set the limit on purpose instead of relying on the default.
What I ran and what I did not#
I ran plain Python, LangGraph 1.2.24 and Pydantic AI 2.71.0, and the outputs above are copied from those runs. I did not run CrewAI, the OpenAI Agents SDK, the Claude Agent SDK, Google ADK, LlamaIndex, Microsoft Agent Framework or smolagents for this post. Their descriptions come from their official docs and package metadata, linked in each section. The Claude Agent SDK in particular has no offline mode, since it drives Claude Code against the API. For an end-to-end CrewAI run, see the web scraper post.
Before you settle on a framework, run your own version of this test. Build the same two-tool task in your top two candidates with a fake model, then write one test that asserts the tool-call sequence and one that checks the loop cap. If a framework makes either test hard to write, that will cost you more than any feature on its homepage.
Sources#
- PyPI JSON metadata for langgraph, crewai, openai-agents, claude-agent-sdk, google-adk, pydantic-ai, llama-index-core, agent-framework, smolagents, autogen-agentchat (checked 22 November 2026)
- LangGraph overview and Graph API
- CrewAI introduction
- OpenAI Agents SDK docs and models page
- Claude Agent SDK overview, Python reference and GitHub README
- Google ADK docs
- Pydantic AI docs, testing and FunctionModel
- LlamaIndex agents guide
- Microsoft Agent Framework overview, AutoGen migration guide, AutoGen repo (archived), Semantic Kernel repo
- smolagents docs