Agent frameworks compared
There are more agent frameworks than anyone can try, and new ones every month. The good news: underneath, they all run the same loop from What an agent is. They differ in three questions, and once you can ask those questions, choosing one stops being a matter of hype.
Who owns the loop? You, a library, or a hosted service.
What comes built in? Nothing but the loop, or persistence, multi-agent handoffs, built in file and shell tools, tracing and deployment.
How tied are you to one model provider?
This chapter writes the same small agent in five ways, then lays the wider field out in one table.
Your team writes TypeScript, needs one support agent with three tools, and wants to switch model providers later. What would you look for in a framework, and what would you avoid?
One agent, five ways#
The task: a support agent with a single tool, get_order_status, answering "Where is order 44821?".
Switch between the tabs and notice how much is the same.
# The loop by hand, with the Anthropic Python SDK. Everything is visible.
import anthropic
client = anthropic.Anthropic()
tools = [{
"name": "get_order_status",
"description": "Look up the delivery status and ETA of one order by its id.",
"input_schema": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"],
},
}]
messages = [{"role": "user", "content": "Where is order 44821?"}]
for _ in range(10): # a step budget, enforced by your code
response = client.messages.create(
model="claude-opus-5-5", max_tokens=16000, tools=tools, messages=messages
)
messages.append({"role": "assistant", "content": response.content})
if response.stop_reason != "tool_use":
break
results = [
{"type": "tool_result", "tool_use_id": block.id,
"content": orders_api.status(block.input["order_id"])}
for block in response.content if block.type == "tool_use"
]
messages.append({"role": "user", "content": results})In every tab the same four things appear: a model, a tool with a name, a description and a schema, the loop (written, configured or hidden), and the answer at the end. The frameworks differ in what they add around that core, not in the core.
A different kind of thing: agents with a built in toolbox#
The SDKs above give you a loop and expect you to supply every tool. A newer category hands you a complete agent with tools already wired: read and edit files, run shell commands, search, manage its own context, spawn sub agents. The Claude Agent SDK is Claude Code packaged as a library; OpenAI's Codex has a similar SDK. You describe the task and the permissions, not the loop.
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "test_checkout fails after the coupon change. Find out why and fix it.",
options: {
allowedTools: ["Read", "Edit", "Glob", "Grep", "Bash"],
permissionMode: "acceptEdits",
},
})) {
if (message.type === "result") console.log(`Done: ${message.subtype}`);
}That is the whole program. It is the right choice when the agent's job looks like an engineer's job (working in a repository, a filesystem, a terminal) and the wrong one for a narrow support bot that should only ever call three of your APIs.
Where they differ#
| Framework | Languages | Who owns the loop | What it adds | Best for |
|---|---|---|---|---|
| No framework (provider SDK) | Any | You | Nothing, which is the point | Small agents, full control |
| Anthropic tool runner | Python, TypeScript and more | The SDK | Loop, tool schemas from types, hooks per turn | Custom tool agents on Claude |
| LangGraph | Python, TypeScript | You, as a graph | State, checkpoints, interrupts, streaming, multi-agent graphs | Custom control flow, approvals, long runs |
| OpenAI Agents SDK | Python, TypeScript | The SDK | Handoffs between agents, guardrails, tracing | Multi-agent apps with handoffs |
| Vercel AI SDK | TypeScript | The SDK | One API over many providers, streaming UI helpers | TypeScript and Next.js products |
| Claude Agent SDK | Python, TypeScript | The SDK | Built in file, shell and search tools, sub agents, permissions, sessions | Coding and filesystem agents |
| CrewAI | Python | The framework | Role based crews of agents, flows, config files | Multi-agent role setups |
| Pydantic AI | Python | The SDK | Type safe tools and outputs, dependency injection | Python teams who want strict types |
| Mastra | TypeScript | The framework | Agents, workflows, memory, evals in one TS toolkit | Full stack TypeScript teams |
Hosted options sit one level higher: the major model providers now offer managed agent services that run the loop and a sandbox for you, which trades control for not running any infrastructure.
| Choice | What you gain | What you pay | Pick it when |
|---|---|---|---|
| Provider SDK, no framework | Nothing hidden, no dependency churn, easy to debug. | You write persistence, retries, streaming and approvals yourself. | One or two agents with simple loops. More teams than you would think. |
| Orchestration framework (LangGraph and similar) | Durable state, interrupts and complex flows without building them. | Concepts to learn, and an abstraction between you and the model. | Long running or branching agents, human approval, several agents. |
| Multi provider SDK (Vercel AI SDK and similar) | Switch models by changing a string. | The lowest common denominator, provider specific features may lag. | Products that must stay portable across model providers. |
| Batteries included agent SDK | A full agent with tools, context management and permissions on day one. | Broad powers to sandbox carefully, and less control over the loop. | Agents that work like engineers: code, files, terminals. |
Agent frameworks have rewritten their APIs repeatedly, and several popular ones have been merged, renamed or retired. Keep your tools, prompts and evals as plain code you own, and keep the framework a thin layer around them, so switching later is a day of work, not a rewrite.
Checkpoint#
1. What do every one of the five agent examples have in common?
2. Why choose LangGraph over a hidden loop for a claims agent that waits days for approval?
3. When is a batteries included agent SDK the wrong choice?
- Every framework runs the same loop. Ask who owns it, what is built in, how tied you are.
- No framework is a fine choice for small agents.
- Orchestration frameworks earn their cost with durable state and interrupts.
- Keep tools, prompts and evals as your own code. Frameworks churn.
All agent frameworks wrap the same loop, so I compare them on three questions: who owns the loop, what comes built in, and how tied I am to one model provider. A provider SDK with no framework, or its tool runner, is enough for small agents and hides nothing. LangGraph makes the loop an explicit graph with checkpoints and interrupts, which suits branching, long running and approval heavy agents. The OpenAI Agents SDK centres on handoffs between agents, and the Vercel AI SDK gives TypeScript teams one API across providers. Batteries included SDKs like the Claude Agent SDK hand you an agent with file, shell and search tools for engineering style work. Whatever I pick, I keep tools, prompts and evals as plain code I own, because frameworks change quickly.