Protocols and Frameworks
Frameworks landscape
LangGraph, CrewAI, AutoGen, SDKs
LangGraph, CrewAI, AutoGen, the OpenAI and Claude Agent SDKs, LlamaIndex, Pydantic AI, smolagents, Google ADK - a dozen frameworks that look wildly different. They are not. Strip each one down and you find the same loop underneath. What differs is which abstraction each makes first-class on top of it - and once you can name that, choosing (or skipping) a framework becomes a five-minute decision.
One loop lives under all of them
Simon Willison's now-canonical definition: "An LLM agent runs tools in a loop to achieve a goal," and "the skill is in the design of both the tools and the loop."[1] That loop is the entire substrate. Every framework in this lesson is a lens on it.
Tap a node to see what it does.
Before you compare frameworks, absorb the distinction every one of them is built to serve. Anthropic's Building Effective Agents splits agentic systems into two kinds.[2]
Workflows
Agents
The single most useful teaching point in the whole module: most production "AI systems" should be workflows, not agents. Add agency only when the flexibility is worth the tradeoff. Both are built from one primitive - the .[2]
The "no framework" option, often the right default
Because the loop is the substrate, the loop is also about twenty lines of Python. You do not need permission from a framework to write it.
# The whole thing. No dependencies beyond the provider SDK.
messages = [system_prompt, user_question]
while True:
resp = client.messages.create(model=..., tools=TOOLS, messages=messages)
if resp.stop_reason != "tool_use":
break # model emitted a final answer -> done
for call in tool_calls(resp):
messages.append(run_tool(call)) # ground truth from the environment
# You own routing, retries, guardrails, logging - and you can see every prompt.This is a legitimate, sometimes-recommended baseline, and the labs endorse it. Anthropic reports the most successful implementations they saw used "simple, composable patterns," not frameworks, and warns that frameworks "create extra layers of abstraction that can obscure the underlying prompts and responses, making them harder to debug."[2] Willison argues cross-model differences (cache control, tool-prompt format, provider-side tools) are large enough that many teams end up building their own thin abstraction anyway.[1] And Hamel Husain's evals-first stance: "great products are mostly harness plus product plus evals, not the model."[17]
When "just a loop" is the answer
Four shapes: the positioning map
Sort the field by which abstraction each framework makes first-class. Four dominant shapes emerge - , , , and - plus cross-cutting styles: handoffs (model-decided delegation within one run), typed/DI (validated structured I/O with dependencies injected), and the programmable harness (the production loop plus built-in tools, packaged for reuse).[18] The horizontal axis is how much the framework decides for you: left is raw loop and low abstraction (a hand-rolled loop, OpenAI's few primitives, smolagents' hackable core); right is opinionated and high abstraction (LangChain's prebuilt agent, CrewAI's org-chart).
What each framework makes first-class
Learn the primitives once - they are convergent - and the API surface is the only variable. The distinctive mechanic of each:
Graph, state, and data
LangGraph - graph / state. Model the agent as a StateGraph: nodes are functions that read and write a shared State; edges (including conditional ones) route control and can cycle back, which is what lets retries and iterative reasoning exist. Checkpointers persist state after every step, giving durable execution, human-in-the-loop via interrupt, and time-travel. As of v1.0, LangChain agents run on LangGraph - one runtime, two layers.[6]
LlamaIndex - data / RAG-centric. The go-to for retrieval-heavy agents: indexes, retrievers, and query engines, orchestrated by event-driven Workflows where @steps consume and emit Events, so loops, branches, and parallelism fall out. AgentWorkflow handles multi-agent handoff systems.[15]
Google ADK - agent tree. Code-first and model-agnostic. Compose LlmAgents with deterministic workflow agents (Sequential/Parallel/LoopAgent) into a tree via sub_agents. First-class A2A and Vertex AI deployment; spans Python and Java.[11]
Roles and conversation
CrewAI - roles / crew. Each Agent carries a role, goal, and backstory; Tasks bind work to agents; a Crew runs them under a Process - sequential or hierarchical (a manager delegates). You reason about it like an org chart. Correction for students: CrewAI is rebuilt from scratch, with no LangChain dependency (it can use LangChain tools, but is not a wrapper).[7]
AutoGen to MS Agent Framework - conversation. AutoGen modeled multi-agent systems as a dialogue between agents and humans (assistant and user-proxy, group chats). That lineage now lives in the Microsoft Agent Framework, which merges AutoGen's simple agents with Semantic Kernel's enterprise plumbing and adds typed graph workflows. Runs on .NET and Python; AutoGen and SK are now maintenance-mode.[8]
Minimal, typed, harness, and code-as-action
OpenAI Agents SDK - handoffs plus guardrails. Few primitives, Python-first. A lets one agent delegate to another within one run, implemented as exposing the target agent as a tool, so routing is model-decided.[4] Guardrails run in parallel and trip a "tripwire" to halt; input guardrails cover only the first agent, output only the final one.[5] The Runner owns the loop.[3]
Claude Agent SDK - the harness. Not a new abstraction - it hands you the same production harness that runs Claude Code: a tuned loop, built-in tools (file/bash/code/web), subagents (parallel work in isolated context), hooks, the Skills system, MCP, and automatic context compaction. Verification is first-class - the SDK names the loop gather context, take action, verify work, repeat.[9] "Give the model a computer." Contrast the raw Messages API, where you write the loop yourself.[10]
Pydantic AI - typed plus DI. The Agent[DepsType, OutputType] is generic, so your type-checker verifies dependencies and outputs. output_type=SomeModel forces a validated object (parse failures become retryable errors, not silent string bugs); deps_type injects DB/API clients into tools. Goal: "bring the FastAPI developer experience to GenAI."[12]
smolagents - code as action. Instead of a JSON tool call, the model writes a Python snippet that calls tools (as functions) and is executed each step. CodeAgent gets loops, conditionals, and intermediate-object handling for free - the CodeAct paper measured up to about 20% higher success across 17 LLMs versus JSON tool-calling.[14] The catch: model-written code must run in a sandbox (E2B/Docker/Modal).[13]
No framework - raw loop. The provider SDK plus your own while loop (above). Maximum control, minimal deps, every prompt visible. The right call for a single autonomous agent until you need durability, HITL, or checkpointing, then graduate to a shape that gives those for free.[2]
The comparison table
The same field, one row per option. The last column is the decision heuristic in miniature.
| Framework | Shape / mental model | First-class primitives | Reach for it when |
|---|---|---|---|
| No framework | Raw LLM + loop | Your own while loop | Max control, minimal deps, see every prompt |
| LangGraph | Graph / state machine | StateGraph, nodes, edges, checkpointers | Durability, HITL, retries, resumable runs |
| LangChain 1.0 | Prebuilt agent on LangGraph | create_agent, integrations | Fast start, huge model/tool catalog |
| LlamaIndex | Data/RAG + event workflows | indexes, @step, AgentWorkflow | Knowledge-heavy, retrieval-centric agents |
| CrewAI | Roles / crew | Agent(role,goal), Crew, Process | Teams you reason about like an org chart |
| MS Agent Framework | Conversation + graph workflows | AIAgent, workflows, middleware | Enterprise .NET/Python, Azure, ex-AutoGen/SK |
| OpenAI Agents SDK | Handoffs + guardrails | Agent, Runner, handoff() | Few primitives, model-decided delegation |
| Claude Agent SDK | Programmable harness | agent loop, subagents, hooks, Skills | "Give the model a computer"; Anthropic models |
| Google ADK | Agent tree + workflow agents | LlmAgent, Sequential/Parallel/Loop, A2A | Google Cloud / Gemini / Vertex; A2A interop |
| Pydantic AI | Typed agent + DI | Agent[Deps,Out], @agent.tool | Type-safe outputs inside a real Python service |
| smolagents | Code as action | CodeAgent, tools-as-functions, sandbox | Minimal, hackable, code-as-action experiments |
How to choose
Do not start from the framework. Start from the task and climb only as high as it forces you - every rung adds latency, cost, and failure surface.[2]
- Can a plain function / SQL query / regex do it? Do that. Microsoft's blunt heuristic: "If you can write a function to handle the task, do that instead of using an AI agent."[8]
- Is one LLM call (maybe with tools) enough? A single augmented LLM. No framework needed.
- Predictable multi-step? Build a workflow (prompt chaining / routing / parallelization). Reach for LangGraph, ADK, or LlamaIndex Workflows only if you want durability, HITL, or tracing for free.
- Open-ended, unpredictable steps? Now it is an agent. Pick by shape from the table: graph plus durability, LangGraph; typed service, Pydantic AI; RAG, LlamaIndex; code-as-action, smolagents; harness, Claude Agent SDK.
- Multiple specialists must coordinate? Multi-agent - handoffs (OpenAI), crews (CrewAI), sub-agents (ADK), or graph edges (LangGraph).
The load-bearing rule
Traps to sidestep
Framework-first thinking
Autonomy where determinism was wanted
Multi-agent for its own sake
Check yourself
Match each framework to its first-class shape.
agent as a stateful graph of nodes
agents defined by role, goal, backstory
the model writes code as its action
model-decided handoffs plus guardrails
the programmable production harness
A plain function will not do it, and one prompt is not enough. Walk the two-question test for workflow vs agent - and how you would pick a concrete framework.
Which default should most production systems land on? Try to state it, then check.
LangGraph, CrewAI, and smolagents look completely different. What are they all wrapping?
Lock it in
- One loop under all of them: an LLM calling tools until a stop condition. Frameworks add durability, state, orchestration, and observability around that loop - they do not invent it.
- Sort by shape: graph/state (LangGraph, ADK, LlamaIndex WF), role/crew (CrewAI), conversation (AutoGen to MS Agent Framework), code-as-action (smolagents), plus handoffs (OpenAI), typed/DI (Pydantic AI), and harness (Claude Agent SDK).
- "No framework" is a real default. Twenty lines you fully control; graduate only when you need checkpointing, HITL, or resumability.
- Choose from the task, not the logo: function, single call, workflow, agent, multi-agent. Most production systems should be workflows.
- Invest in tools, the loop, and evals - and prefer MCP plus A2A to dodge lock-in.
Primary source
Anthropic - Building Effective AgentsThe reference every other doc echoes. Read it first: it defines workflows vs agents, the five workflow patterns, the augmented LLM, and the case for simple code over heavy frameworks. Everything above is a map on top of it.
Sources
- 1.Simon Willison, I think agent may finally have a meaning
- 2.Anthropic, Building Effective Agents
- 3.OpenAI Agents SDK documentation
- 4.OpenAI Agents SDK, Handoffs
- 5.OpenAI Agents SDK, Guardrails
- 6.LangGraph overview, LangChain docs
- 7.CrewAI, Agents
- 8.Microsoft Agent Framework overview
- 9.Anthropic, Building agents with the Claude Agent SDK
- 10.Claude Agent SDK overview
- 11.Google Agent Development Kit (ADK)
- 12.Pydantic AI, Agent
- 13.Hugging Face, smolagents
- 14.Wang et al., Executable Code Actions Elicit Better LLM Agents (CodeAct)
- 15.LlamaIndex, Workflows
- 16.Simon Willison, The lethal trifecta for AI agents
- 17.Hamel Husain, AI Evals course
- 18.DataCamp, CrewAI vs LangGraph vs AutoGen
- 19.Microsoft, Migrate Semantic Kernel and AutoGen projects to Microsoft Agent Framework