Library
7 min read

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 answer

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.

python
# 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.

ts
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#

FrameworkLanguagesWho owns the loopWhat it addsBest for
No framework (provider SDK)AnyYouNothing, which is the pointSmall agents, full control
Anthropic tool runnerPython, TypeScript and moreThe SDKLoop, tool schemas from types, hooks per turnCustom tool agents on Claude
LangGraphPython, TypeScriptYou, as a graphState, checkpoints, interrupts, streaming, multi-agent graphsCustom control flow, approvals, long runs
OpenAI Agents SDKPython, TypeScriptThe SDKHandoffs between agents, guardrails, tracingMulti-agent apps with handoffs
Vercel AI SDKTypeScriptThe SDKOne API over many providers, streaming UI helpersTypeScript and Next.js products
Claude Agent SDKPython, TypeScriptThe SDKBuilt in file, shell and search tools, sub agents, permissions, sessionsCoding and filesystem agents
CrewAIPythonThe frameworkRole based crews of agents, flows, config filesMulti-agent role setups
Pydantic AIPythonThe SDKType safe tools and outputs, dependency injectionPython teams who want strict types
MastraTypeScriptThe frameworkAgents, workflows, memory, evals in one TS toolkitFull 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.

ChoiceWhat you gainWhat you payPick it when
Provider SDK, no frameworkNothing 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 SDKA 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.
Which would you pick?
A Next.js app adding a chat assistant with three tools, and the team may change model provider
An insurance claims agent that waits days for an adjuster's approval mid-run
An internal bot that fixes failing CI builds in your monorepo
One extraction step with two tools in a Python service
Frameworks change faster than your product

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#

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?

Worth memorising
  • 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.
Say this in 60 seconds

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.