LangGraph vs CrewAI vs the Claude Agent SDK: One Support Job, Three Short Files, Control Against Speed of Setup
Three frameworks get the same refund question and give the same reply. LangGraph needs 25 lines of graph and runs the five steps you drew (7 saved checkpoints), CrewAI needs 11 lines of roles and tasks, and the Claude Agent SDK needs 5 lines of options and picks its own 2 turns.
What you will learn
- Build the same researcher-writer-reviewer job in LangGraph, CrewAI and the Claude Agent SDK
- Explain who decides the steps in each framework: you, the roles, or the agent loop
- Compare state, pause and resume, human approval and model choice across the three
- Pick a framework for a project with three questions
Before you start
- LangGraph Nodes, Edges and State
- Supervisor and Worker Agents in LangGraph
There are many ways to build an agent team. Rather than compare feature lists, we give three popular frameworks the same small job in three short Python files and run each one: LangGraph (from the LangChain team), CrewAI and the Claude Agent SDK (from Anthropic). With LangGraph you draw the team. With CrewAI you describe it. With the Agent SDK you hand it the job.
Every file runs on scripted test doubles, so no key is needed. The project is S01L09_ThreeWays.
The one job
To compare fairly, every file starts from job.py:
QUESTION = "I was charged twice. Can I get a refund?"
FACT = "Double charges are refunded in 3 to 5 days."
REPLY = "Sorry about that. The double charge is refunded in 3 to 5 days."
The team has three roles. The researcher finds the fact, the writer turns it into a reply, and the reviewer decides when it is good enough to send.
Three cars, one trip
All three get you there; the difference is how much you steer. LangGraph is the manual gearbox: you choose every step. CrewAI is the automatic: you set the destination and the roles, and it shifts the gears. The Claude Agent SDK is the self-driving car: it comes with a ready agent loop and built-in tools, and you sit in the co-pilot seat.
LangGraph: you draw the path
The shared state has four slots: question, facts, draft and verdict. Each worker is a plain function that fills one slot. get_model returns a FakeListChatModel with five scripted replies; with a key you return a real chat model there and nothing else changes.
from typing import TypedDict
from langchain_core.language_models.fake_chat_models import FakeListChatModel
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph
from job import FACT, QUESTION, REPLY
class TeamState(TypedDict, total=False):
question: str
facts: str
draft: str
verdict: str
def build_graph(model):
def researcher(state: TeamState) -> dict:
prompt = "Find the facts for: " + state["question"]
return {"facts": model.invoke(prompt).content}
def writer(state: TeamState) -> dict:
prompt = f"Use {state['facts']} to reply to: {state['question']}"
return {"draft": model.invoke(prompt).content}
def reviewer(state: TeamState) -> dict:
prompt = "Say ok or redo: " + state["draft"]
return {"verdict": model.invoke(prompt).content.strip().lower()}
def route(state: TeamState) -> str:
return END if state["verdict"] == "ok" else "writer"
builder = StateGraph(TeamState)
builder.add_node("researcher", researcher)
builder.add_node("writer", writer)
builder.add_node("reviewer", reviewer)
builder.add_edge(START, "researcher")
builder.add_edge("researcher", "writer")
builder.add_edge("writer", "reviewer")
builder.add_conditional_edges("reviewer", route, ["writer", END])
return builder.compile(checkpointer=InMemorySaver())
Plain edges go start, researcher, writer, reviewer. The conditional edge on the reviewer is the fork: "ok" ends the run, anything else goes back to the writer. That loop is something you draw on purpose. Compiling with a checkpointer saves the state after every step, so a run can pause and resume later.
researcher: {'facts': 'Double charges are refunded in 3 to 5 days.'}
writer: {'draft': 'You will get your money back.'}
reviewer: {'verdict': 'redo'}
writer: {'draft': 'Sorry about that. The double charge is refunded in 3 to 5 days.'}
reviewer: {'verdict': 'ok'}
saved checkpoints: 7
Five steps in exactly the order we drew. The first draft was vague, the reviewer said redo, and the second draft said sorry and gave the 3 to 5 days. Seven saved checkpoints means seven points where the run could pause, wait for a person and resume.
CrewAI: you describe the team
Here you don't draw steps. An agent has a role, a goal and a backstory, written as plain words the model reads. A task has a description, the expected output and the agent who does it.
from crewai import Agent, Crew, Process, Task
from job import FACT, QUESTION, REPLY
from test_doubles import TestLLM
def build_crew(llm):
researcher = Agent(role="Researcher", goal="Find the facts",
backstory="You know the help center.", llm=llm)
writer = Agent(role="Writer", goal="Draft a clear reply",
backstory="You write short, kind replies.", llm=llm)
research = Task(description="Find the facts for: {question}",
expected_output="One fact", agent=researcher)
write = Task(description="Reply to: {question}",
expected_output="A short reply", agent=writer)
return Crew(agents=[researcher, writer], tasks=[research, write],
process=Process.sequential)
Process.sequential runs the tasks one after the other. The other option is hierarchical, where a manager agent hands out the work. A test LLM plays back two scripted replies:
Researcher: Double charges are refunded in 3 to 5 days.
Writer: Sorry about that. The double charge is refunded in 3 to 5 days.
final: Sorry about that. The double charge is refunded in 3 to 5 days.
Task one's output rides along into task two, so the writer already has the fact, and final is the output of the last task. We never said what runs after what beyond the order of the tasks, and there is no reviewer loop here. That's less code, and less steering.
Claude Agent SDK: you hand it the job
The Agent SDK is the Claude Code agent loop, packaged as a library. No graph and no roles, just options: a system prompt, the allowed tools and a turn limit.
import anyio
from claude_agent_sdk import (AssistantMessage, ClaudeAgentOptions, ResultMessage,
TextBlock, ToolUseBlock, query)
from job import QUESTION, REPLY
from test_doubles import TestTransport
OPTIONS = ClaudeAgentOptions(
system_prompt="You are a support agent. Use the help center.",
allowed_tools=["Read", "Grep"],
max_turns=4,
)
async def main(transport):
prompt = "Answer the customer: " + QUESTION
async for msg in query(prompt=prompt, options=OPTIONS, transport=transport):
if isinstance(msg, AssistantMessage):
for block in msg.content:
if isinstance(block, ToolUseBlock):
print(" tool:", block.name, block.input)
elif isinstance(block, TextBlock):
print(" reply:", block.text)
elif isinstance(msg, ResultMessage):
print(" turns:", msg.num_turns)
Read and Grep mean this agent may only read and search files. Claude Code has more built-in tools (Write, Edit, Bash, web fetch) that you switch on by name, and the SDK also supports MCP servers, subagents and hooks. A test transport plays back a scripted run; with a key you pass None and the SDK starts Claude Code.
tool: Read {'file_path': 'help_center.md'}
reply: Sorry about that. The double charge is refunded in 3 to 5 days.
turns: 2
We wrote no steps. The agent decided to read help_center.md in turn one and wrote the reply in turn two, inside the limit of four turns.
Side by side
| LangGraph | CrewAI | Claude Agent SDK | |
|---|---|---|---|
| Setup code here | 25 lines (build_graph) | 11 lines (build_crew) | 5 lines (options) |
| Control over steps | every step | by roles | the agent decides |
| State, pause, resume | checkpoints | state with Flows | sessions |
| Human approval | interrupts | human input on a task | hooks and permissions |
| Models | any model | many providers | Claude |
| Fastest to start | slowest | fast | fastest |
| Best for | complex workflows | role-based teams | coding and file agents |
How to choose
- Do you need exact control of every step, and approvals? Pick LangGraph.
- Is the work a team of roles doing tasks in order? Pick CrewAI.
- Is it a coding, file or research agent on Claude, with built-in tools? Pick the Claude Agent SDK.
For the Support Copilot this course builds, the pick is LangGraph. A supervisor chooses which agent answers, and we want to draw that path. No refund goes out until a person approves, and LangGraph can pause right there (see human-in-the-loop and checkpointing). A conversation can stop and resume from the same checkpoint, and LangSmith tracing shows every step. For another project, CrewAI or the SDK might be the right answer. Pick the tool for the job, not the most popular one.
Common mistakes
- Choosing by popularity. Start from the three questions: control, roles, or a ready loop with tools.
- Expecting a review loop for free. The CrewAI crew here runs two tasks in order and stops; a redo loop is something you have to design.
- Giving the SDK every tool.
allowed_toolsis your safety boundary. This agent only reads and searches. - Comparing frameworks on different jobs. Keep one job file and one expected reply, like
job.py, so the difference you see comes from the framework.
Try it yourself
Add a reviewer agent and a third task to the CrewAI crew, then switch it to Process.hierarchical and compare the output with the LangGraph run. Which one makes it easier to send the draft back for a second pass?
Related course on Udemy
The Python Architect Masterclass: Full Stack to AI Engineer
Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)Related posts
Context Engineering for a Long-Running Agent: Clear, Compact, Take Notes, Prove It
A support agent forgets the customer's name, order and contact choice after twenty turns and fails 0 of 4 checks. Measure the window, clear old tool output, compact old turns and keep a notes file, and the same chat passes 4 of 4 with 470 tokens instead of 2,945.
What LangChain Is For, and When to Skip It: Five Standard Parts, One Pipe, and a Decision Table
LangChain is a box of standard parts (models, prompts, retrievers, tools, parsers) that snap together with a pipe. The same refund question through the plain Anthropic SDK (1 import, 13 lines) and a chain (3 imports, 14 lines) gives the same answer word for word. It pays off when the bot grows; for one call, the SDK is simpler, with 16 packages instead of 38.
Why Chains Break: No Branch, No Retry, No Pause, and the Same Refund Assistant as a LangGraph Graph
A refund assistant built three ways. The chain runs classify, retrieve, reply once: it answers an opening-hours question with the billing line, misses the 30-day window, and sends a $150 refund with approved False. Plain if/while fixes it but hides the flow; a LangGraph StateGraph puts the branch, the retry loop and the approval stop in the arrows.
LangGraph Nodes, Edges and State: Build Your First Graph, Route With a Conditional Edge, and Read the Run Three Ways
Two small graphs. A refund skeleton: SupportState, a classify node, a route function on a conditional edge, and an Annotated log that appends instead of overwriting. A help desk: classify and answer call a scripted test model, spam goes straight to END after one model call instead of two, and the same run read with invoke, stream values and stream updates.
