AI agent frameworks compared: LangGraph, CrewAI, SDKs and how to pick

AI agent frameworks compared: LangGraph, CrewAI, SDKs and how to pick

AI agent frameworks are libraries that give you the agent loop, tool calling, state, memory and multi-agent orchestration so you don't write them from scratch. This comparison covers LangGraph, CrewAI, the OpenAI Agents SDK, the Claude Agent SDK, Microsoft Agent Framework (the successor to AutoGen) and Mastra, then gives you a short decision guide.

In shortTL;DR
  • Pick LangGraph when you need explicit, durable control flow with human approval steps in Python or TypeScript.
  • Pick CrewAI for role-based teams of agents in Python, with Flows for structure.
  • Pick the OpenAI Agents SDK or Pydantic AI for a light, code-first loop with few abstractions.
  • Pick the Claude Agent SDK when the agent needs to work on files and run commands like Claude Code does.
  • AutoGen is archived; new Microsoft-stack projects should start on Microsoft Agent Framework. TypeScript teams should look at Mastra.

What are AI agent frameworks?

AI agent frameworks are libraries that handle the repetitive parts of building an agent: running the loop of model calls and tool calls, describing tools to the model, keeping state and memory, coordinating several agents, and tracing what happened. You bring the model, the tools and the instructions; the framework runs the agent.

Every agent, whatever the framework, does the same thing underneath: send the conversation and a list of tools to a model, run any tool it asks for, append the result, and repeat until the model stops asking. If that loop is new to you, read what AI agents are first. The frameworks differ in what they add on top:

  • Control flow. Free-running loop, explicit graph, or a mix.
  • State and durability. Whether a long run survives a crash and can pause for human approval.
  • Multi-agent patterns. Handoffs, crews of role-based agents, orchestrator and workers.
  • Built-in tools. Most give you a way to define tools; a few ship real ones (file editing, shell, web search).
  • Language and model support. Python, TypeScript, .NET, Go, and whether you are tied to one provider.
  • Observability. Tracing, evals and a hosted platform, often the commercial part.

Do you need an AI agent framework at all?

You need a framework less often than the market suggests. Anthropic's Building effective agents recommends starting with direct API calls, since many agent patterns take only a few lines of code, and warns that frameworks can add layers of abstraction that hide the prompts and responses you need to debug.

Microsoft's own Agent Framework overview puts it more bluntly: "If you can write a function to handle the task, do that instead of using an AI agent."

A framework starts to pay off when you need one or more of these:

  1. Runs that last minutes or hours and must survive restarts.
  2. Human approval in the middle of a run, then resuming where it stopped.
  3. Several agents with different roles, tools or models.
  4. Tracing and evaluation across many runs in production.
  5. Swapping model providers without rewriting your code.

If none apply, a plain loop with the official SDK of your model provider is shorter, easier to debug and has no extra dependency. Our tutorial on building an AI agent in Python shows one end to end.

AI agent frameworks at a glance

This table summarizes the main options as of October 2026. All are open source at their core; several sell a hosted platform for deployment and observability on top.

FrameworkLanguagesCore ideaBest forWatch out for
LangGraphPython, TypeScriptAgents as stateful graphsComplex, long-running workflows with approvalsSteeper learning curve, verbose for simple agents
CrewAIPythonCrews of role-based agents inside FlowsMulti-agent teams that mirror human rolesRole-play abstractions can hide what the model sees
OpenAI Agents SDKPython, TypeScriptFew primitives: agents, handoffs, guardrails, sessions, tracingLightweight agents, especially on OpenAI modelsBest features tuned for OpenAI's platform
Claude Agent SDKPython, TypeScriptClaude Code's loop and tools as a libraryAgents that read, edit and run code or filesClaude models only; needs API key authentication
Microsoft Agent FrameworkPython, .NET, Go (preview)Agents plus graph workflows, successor to AutoGen and Semantic KernelEnterprise and Azure teamsGo version still in preview
MastraTypeScriptAgents, graph workflows, memory, RAG, evalsTypeScript and Next.js teamsSome enterprise features under a separate license
Google ADKPython, TypeScript, Go, Java, KotlinOpen-source agent toolkit with Gemini integrationGoogle Cloud teams, multi-language shopsSmoothest path assumes Google Cloud
Pydantic AIPythonTyped agent loop, model a string swap awayPython teams who want type safety and structured outputFewer built-in multi-agent patterns

The sections below go through each in more detail.

Which orchestration framework fits: LangGraph or CrewAI?

LangGraph and CrewAI are two of the best-known orchestration-first frameworks. LangGraph models an agent as an explicit graph; CrewAI models it as a team of role-based agents inside a structured flow.

LangGraph: explicit graphs and durable state

LangGraph is the right pick when you want precise control over an agent's steps and need runs that survive failures and pause for people. The LangGraph docs call it "a low-level orchestration framework and runtime" for agents.

You model the agent as a graph: nodes are steps (a model call, a tool call, a plain function), edges decide what runs next, and a shared state object flows through. You can mix "hand-coded, deterministic logic with LLM-driven decision-making in a single graph."

Strengths:

  • Durable execution. Agents "persist through failures and can run for extended periods, resuming from where they left off."
  • Human in the loop. You can inspect and change the agent's state at any point, which is how you build approval steps.
  • Memory. Short-term working memory within a run and long-term memory across sessions.
  • Two languages. Python, and TypeScript via @langchain/langgraph.

Trade-offs: LangGraph is low level on purpose, so a simple tool-using chatbot takes more code than in lighter SDKs. It works without LangChain, but most examples use LangChain components, and LangChain's own agent abstractions are built on top of LangGraph. Tracing, evaluation and hosted deployment come from LangSmith, a separate commercial platform.

Choose LangGraph for approval workflows, long research pipelines, or support flows where certain steps must always happen in a fixed order.

CrewAI: teams of role-based agents

CrewAI is built around the idea of a crew: several agents, each with a role, a goal and tools, collaborating on tasks. Its documentation describes two layers, and recommends using both:

  • Flows "manage state and control execution." They define the process.
  • Crews are teams of agents that do the open-ended work a Flow step hands to them.

A typical setup is a Flow that fetches data, hands analysis to a crew of a researcher, an analyst and a writer, then validates the result in code. CrewAI is a standalone Python framework with its own primitives, released under the MIT license. A paid platform (CrewAI AMP) adds managed deployment, observability and governance.

Strengths: fast to prototype multi-agent ideas, readable configuration, a large community and many examples. Trade-offs: role-based prompting adds tokens and can make it harder to see what each model call actually contains, and multi-agent setups multiply cost. Check whether one agent with good tools would do the job first; our guide to multi-agent systems covers when splitting helps and when it hurts.

Which vendor agent SDK fits: OpenAI or Claude?

The OpenAI Agents SDK and the Claude Agent SDK are thin libraries from the model vendors themselves. The OpenAI SDK gives you a minimal loop with handoffs and guardrails; the Claude SDK gives you Claude Code's loop with real file, shell and web tools built in.

OpenAI Agents SDK: few abstractions, built-in tracing

The OpenAI Agents SDK is a small, code-first library. Its docs say it lets you build agentic apps "in a lightweight, easy-to-use package with very few abstractions." There is a Python version and a TypeScript version.

The core primitives:

  • Agents: "LLMs equipped with instructions and tools."
  • Handoffs and agents as tools: one agent delegates to another.
  • Guardrails: input and output checks that run in parallel with the agent and can fail fast.
  • Sessions: persistent memory of the conversation within the loop.
  • Tracing: built-in visualization and debugging of runs.

A minimal agent, from the project's README:

hello_agent.py
from agents import Agent, Runneragent = Agent(name="Assistant", instructions="You are a helpful assistant")result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")print(result.final_output)

Install it with pip install openai-agents. Functions become tools with automatic schema generation, and MCP servers can supply tools too. The SDK works with non-OpenAI providers through adapters such as LiteLLM, though tracing and some features fit best with OpenAI's platform.

Choose it when you want a thin layer you can read in an afternoon, with handoffs and guardrails ready to use.

Claude Agent SDK: Claude Code as a library

The Claude Agent SDK gives you the agent loop, tools and context management that power Claude Code, as a Python or TypeScript library. The Agent SDK overview describes it as a way to "build production AI agents with Claude Code as a library."

The difference from most frameworks is that real tools come built in: reading, writing and editing files, running shell commands and searching the web. Hooks, subagents, MCP, permission controls and resumable sessions are included, and the SDK loads skills and CLAUDE.md memory from your project's .claude/ folder the same way Claude Code does.

A trimmed version of the official quickstart, an agent that finds and fixes bugs in a file:

agent.py
import asynciofrom claude_agent_sdk import query, ClaudeAgentOptionsasync def main():    async for message in query(        prompt="Review utils.py for bugs that would cause crashes. Fix any issues you find.",        options=ClaudeAgentOptions(            allowed_tools=["Read", "Edit", "Glob"],            permission_mode="acceptEdits",        ),    ):        print(message)asyncio.run(main())

Install with pip install claude-agent-sdk or npm install @anthropic-ai/claude-agent-sdk, and set ANTHROPIC_API_KEY. Amazon Bedrock, Google Cloud and Microsoft Foundry are supported as providers. Two constraints: it runs Claude models only, and Anthropic does not allow third-party products built on the SDK to offer claude.ai login or subscription rate limits, so plan on API key billing.

Choose it for coding agents, document-processing agents, research agents that write files, or anything where "give the agent a computer" is the simplest design. Our Claude Agent SDK guide covers setup and deployment in depth.

Note

If what you actually want is Claude Code itself working on your repositories around the clock, rather than a custom product, you may not need a framework. Orkio rents an always-on cloud box where Claude Code and Codex keep running after you close your laptop, using your own Claude account.

What about Microsoft Agent Framework, Mastra and the rest?

Microsoft Agent Framework (the successor to AutoGen) and Mastra cover the .NET and TypeScript worlds, while Google ADK and Pydantic AI fill other gaps.

Microsoft Agent Framework: the successor to AutoGen

Microsoft Agent Framework replaces both AutoGen and Semantic Kernel, and it is where new Microsoft-stack agent projects should start. The AutoGen repository is archived: Microsoft states it is "not providing bug fixes, security fixes, new features, or support for this project" and calls Agent Framework "the enterprise-ready successor to AutoGen."

According to the Microsoft Learn overview, the framework "combines AutoGen's simple abstractions for single- and multi-agent patterns with Semantic Kernel's enterprise-grade features" such as session state, type safety, middleware and telemetry, and adds graph-based workflows for explicit multi-agent orchestration. It covers:

  • Agents that call tools and MCP servers, with providers including Microsoft Foundry, Azure OpenAI, OpenAI, Anthropic and Ollama.
  • A built-in agent for long tasks with planning, context compaction, file access and memory for long multi-step tasks.
  • Workflows that connect agents and functions through explicit execution paths.

It ships for Python (pip install agent-framework) and .NET, with Go in public preview. Existing AutoGen code keeps running, but it receives no security fixes; Microsoft publishes a migration guide. A community fork called AG2, led by AutoGen's original creators, also continues the original design if you prefer it.

Mastra: the TypeScript option

Mastra is "a TypeScript framework for building AI agents and applications," according to its docs. It is the most complete choice if your team lives in TypeScript and Node.js.

From the Mastra README:

  • Model routing to "40+ providers through one standard interface," with models named as provider/model strings.
  • Workflows as a graph engine with .then(), .branch() and .parallel().
  • Human in the loop: agents or workflows can suspend for approval and resume later.
  • Memory, RAG, evals and observability built in, and the ability to expose agents as MCP servers.

Start a project with npm create mastra@latest. The core is Apache-2.0; code in ee/ folders falls under a separate enterprise license that requires a commercial license for production use. Mastra fits well next to a Next.js app, where the agent lives in the same codebase as the product.

Google ADK and Pydantic AI

Google Agent Development Kit (ADK) is an open-source framework "to build, debug, and deploy reliable AI agents," available in Python, TypeScript, Go, Java and Kotlin, according to the ADK site. It works with Gemini and, through adapters, many other models, including local ones. Deployment to Google Cloud takes one command, but you can containerize and run it anywhere.

Pydantic AI describes itself as "the Python AI SDK: a typed, extensible agent loop with every model a string swap away" in its documentation. Every run is validated against your output type, it supports durable execution on engines such as Temporal and DBOS, and Pydantic Evals grades outputs and tool-call trajectories. It suits Python teams who already use Pydantic and want type-checked agents.

If you want agents without writing code at all, workflow tools are a different category; see our n8n AI agent tutorial.

How do you choose an AI agent framework?

Choose by answering five questions in order. Most teams reach a clear answer by the third.

  1. Can a plain loop do it? If the agent has a handful of tools, one model and short runs, use your provider's SDK directly. Stop here.
  2. What language is the product in? TypeScript: Mastra, LangGraph.js, OpenAI Agents SDK (TypeScript), Claude Agent SDK, or Google ADK. .NET: Microsoft Agent Framework. Python: all of them.
  3. Does the agent need a computer? If it must edit files, run commands and work in a repository, the Claude Agent SDK gives you tested tools instead of writing your own file-editing and shell tools.
  4. How much control flow do you need? Fixed steps, approvals and resumable runs point to LangGraph, Microsoft Agent Framework workflows or Mastra workflows. A free-running agent with handoffs points to the OpenAI Agents SDK, Pydantic AI or CrewAI.
  5. Where will it run, and who pays? Check which hosted platform you would adopt for tracing and deployment (LangSmith, CrewAI AMP, Azure, Google Cloud) and how its pricing fits, before you commit to the open-source layer underneath.
If you needStart with
Stateful workflow with approval stepsLangGraph
A team of specialist agents, fast prototypeCrewAI
Smallest possible Python agent with guardrailsOpenAI Agents SDK or Pydantic AI
An agent that works on code and filesClaude Agent SDK
Azure and .NET integrationMicrosoft Agent Framework
Agent inside a TypeScript or Next.js productMastra
Multi-language team on Google CloudGoogle ADK

Before you commit: a practical checklist

Spend a day on a spike before choosing. Build the same small agent (two tools, one real task from your product) in your top two candidates, then check:

  • Readability. Can you see the exact prompt and tool calls sent to the model? If not, debugging will hurt.
  • Tool design. Writing clear tool names and descriptions matters more than the framework; Anthropic advises designing the agent-computer interface as carefully as a user interface. Our explainer on MCP shows how to reuse existing tool servers.
  • Failure behavior. Kill the process mid-run. Does it resume, or start over?
  • Cost per task. Count tokens per run; multi-agent and role-based setups can multiply them.
  • Model flexibility. Swap the model once to confirm it works.
  • Maintenance signal. Check release activity and the project's status page or README; AutoGen shows that popular frameworks can be retired.

Whatever you pick, keep the agent's prompts, tools and evaluation set in your own code, so moving to another framework later is a refactor rather than a rewrite.

Frequently asked questions

What is the best AI agent framework?

There is no single best one. LangGraph suits complex stateful workflows, CrewAI suits role-based multi-agent teams, the OpenAI Agents SDK and Pydantic AI suit lightweight code-first agents, the Claude Agent SDK suits agents that work on files and code, and Mastra suits TypeScript teams. Start from your language, your model provider and how much control flow you need.

Is AutoGen still maintained?

No. Microsoft has archived the AutoGen repository and says it no longer provides bug fixes, security fixes or new features. Microsoft points new users to Microsoft Agent Framework, built by the same teams, and publishes a migration guide from AutoGen.

Do I need a framework to build an AI agent?

No. An agent is a loop around model calls and tool execution, and you can write a working one with an official model SDK in under a hundred lines. Frameworks pay off when you need durable state, human approval steps, tracing, multi-agent coordination or many model providers.

Can I use Claude models with LangGraph or CrewAI?

Yes. LangGraph, CrewAI, Pydantic AI, Mastra, Google ADK and Microsoft Agent Framework all support several model providers, including Anthropic. Check each framework's provider documentation for the exact package and model name format.

What is the difference between the Claude Agent SDK and the Claude API?

The Claude API client SDK gives you raw model calls, and you write the tool loop and the tools yourself. The Claude Agent SDK packages Claude Code's agent loop, built-in tools for files, shell and web search, permissions, sessions and hooks into a Python or TypeScript library.

SOURCES

  1. Anthropic: Building effective agents
  2. LangGraph overview (LangChain docs)
  3. CrewAI documentation: Introduction
  4. OpenAI Agents SDK documentation
  5. Claude Code docs: Agent SDK overview
  6. Microsoft Learn: Microsoft Agent Framework overview
  7. Mastra on GitHub
  8. Microsoft AutoGen on GitHub (archived)
  • #ai agents
  • #frameworks
  • #langgraph
  • #crewai
  • #agent sdk
Orkio team

The team building Orkio. We write about putting AI to work: coding agents that run overnight, always-on boxes and pull requests ready by morning.

Keep reading

All posts

07:06 · YOU MERGED #128

Go to sleep. Wake up to pull requests.

Start for $19 a month
© 2026 Orkio · Hosted in Europe TürkçeStatus