Skip to content

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.

The universal agent loop. Anthropic frames autonomous agents as LLMs using tools based on environmental feedback in a loop; the Claude Agent SDK names the same cycle gather context, take action, verify work, repeat. Frameworks add durability, state, orchestration, and observability around this loop - they do not invent it.

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

"LLMs and tools orchestrated through predefined code paths." Predictable, testable, cheaper.

Agents

"LLMs dynamically direct their own processes and tool usage." Flexible, but they cost latency and money and can compound errors step over step.

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.
agent_loop.py - the whole agent, no dependencies beyond the provider SDK.

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

You want maximum control and minimal dependencies; you need to see and tune every prompt; the task is a single autonomous agent, not a team. A hand-rolled loop is fine until you need durability (resume after a crash), human-in-the-loop pauses, or checkpointing - which is exactly the gap frameworks like LangGraph fill. Rolling your own before then is a feature, not a shortcut.

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.

FrameworkShape / mental modelFirst-class primitivesReach for it when
No frameworkRaw LLM + loopYour own while loopMax control, minimal deps, see every prompt
LangGraphGraph / state machineStateGraph, nodes, edges, checkpointersDurability, HITL, retries, resumable runs
LangChain 1.0Prebuilt agent on LangGraphcreate_agent, integrationsFast start, huge model/tool catalog
LlamaIndexData/RAG + event workflowsindexes, @step, AgentWorkflowKnowledge-heavy, retrieval-centric agents
CrewAIRoles / crewAgent(role,goal), Crew, ProcessTeams you reason about like an org chart
MS Agent FrameworkConversation + graph workflowsAIAgent, workflows, middlewareEnterprise .NET/Python, Azure, ex-AutoGen/SK
OpenAI Agents SDKHandoffs + guardrailsAgent, Runner, handoff()Few primitives, model-decided delegation
Claude Agent SDKProgrammable harnessagent loop, subagents, hooks, Skills"Give the model a computer"; Anthropic models
Google ADKAgent tree + workflow agentsLlmAgent, Sequential/Parallel/Loop, A2AGoogle Cloud / Gemini / Vertex; A2A interop
Pydantic AITyped agent + DIAgent[Deps,Out], @agent.toolType-safe outputs inside a real Python service
smolagentsCode as actionCodeAgent, tools-as-functions, sandboxMinimal, hackable, code-as-action experiments
The same field, one row per option. Vertical lanes are the first-class shape; the last column is the decision heuristic in miniature.

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]

  1. 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]
  2. Is one LLM call (maybe with tools) enough? A single augmented LLM. No framework needed.
  3. 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.
  4. 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.
  5. Multiple specialists must coordinate? Multi-agent - handoffs (OpenAI), crews (CrewAI), sub-agents (ADK), or graph edges (LangGraph).

The load-bearing rule

Invest in the tools and the loop, not the framework. The harness dominates behavior more than your model choice or your framework choice. Whatever you pick, understand the code underneath it - so you can debug prompts and drop down a layer when the abstraction fights you. And the two interop standards cut lock-in either way: MCP for tools, A2A for cross-agent calls.

Traps to sidestep

Framework-first thinking

Reaching for a multi-agent framework before checking whether a workflow, or a function, suffices. The number-one anti-pattern; frameworks "obscure the underlying prompts," making debugging harder.[2]

Autonomy where determinism was wanted

Agents trade latency and cost for flexibility and compound errors step over step. For well-defined tasks a workflow is strictly better. Also: every loop needs an explicit stop condition, or it burns tokens forever.

Multi-agent for its own sake

N agents means N times cost and latency plus a coordination surface (who owns state? who stops the loop?). One well-tooled agent often beats a crew.

Version churn and lock-in

AutoGen and Semantic Kernel are maintenance-mode - build new work on MS Agent Framework.[19] And never run smolagents' model-written code unsandboxed - prompt-injected code is RCE (the lethal trifecta).[16]

Check yourself

Match each framework to its first-class shape.

drop here

agent as a stateful graph of nodes

drop here

agents defined by role, goal, backstory

drop here

the model writes code as its action

drop here

model-decided handoffs plus guardrails

drop here

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 Agents

The 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. 1.Simon Willison, I think agent may finally have a meaning
  2. 2.Anthropic, Building Effective Agents
  3. 3.OpenAI Agents SDK documentation
  4. 4.OpenAI Agents SDK, Handoffs
  5. 5.OpenAI Agents SDK, Guardrails
  6. 6.LangGraph overview, LangChain docs
  7. 7.CrewAI, Agents
  8. 8.Microsoft Agent Framework overview
  9. 9.Anthropic, Building agents with the Claude Agent SDK
  10. 10.Claude Agent SDK overview
  11. 11.Google Agent Development Kit (ADK)
  12. 12.Pydantic AI, Agent
  13. 13.Hugging Face, smolagents
  14. 14.Wang et al., Executable Code Actions Elicit Better LLM Agents (CodeAct)
  15. 15.LlamaIndex, Workflows
  16. 16.Simon Willison, The lethal trifecta for AI agents
  17. 17.Hamel Husain, AI Evals course
  18. 18.DataCamp, CrewAI vs LangGraph vs AutoGen
  19. 19.Microsoft, Migrate Semantic Kernel and AutoGen projects to Microsoft Agent Framework