Skip to the content.

LangChain Alternatives: AI Agent Frameworks Compared, with the Same Agent Built in 15 Frameworks

An honest, hands-on comparison of AI agent frameworks and SDKs in Python and TypeScript. The same small task, an order-support agent with two tools, is implemented in LangChain/LangGraph, the OpenAI Agents SDK, the Claude Agent SDK, CrewAI, PydanticAI, Google ADK, Microsoft Agent Framework, smolagents, LlamaIndex, Agno, Strands Agents, DSPy, the Vercel AI SDK, Mastra, and plain Python with no framework. You can read the code side by side, see how much each framework adds, and pick the right one for your project. It is for developers choosing an agent framework, teams looking for LangChain alternatives, and anyone wondering whether they need a framework at all.

Last reviewed: December 2026. Versions are listed in the comparison table. Independent comparison, not affiliated with any of the projects.

Table of Contents

TL;DR: best picks

If you want… Pick Why
The least code and strong typing in Python PydanticAI 9 lines for our task; validated structured outputs; durable execution integrations
The widest integration catalog, or graphs with checkpoints and human-in-the-loop LangChain v1 + LangGraph create_agent for the common case, LangGraph when you need explicit state and control flow
Multi-agent handoffs with built-in tracing, on OpenAI models OpenAI Agents SDK Small API (agents, tools, handoffs, guardrails) with tracing out of the box
A coding or file-system agent with Claude Claude Agent SDK The Claude Code harness as a library: built-in file, shell and web tools, permissions, hooks, subagents
TypeScript web apps with streaming UIs Vercel AI SDK Thin, typed, provider-agnostic; best-in-class streaming
A full TypeScript agent platform Mastra Agents, workflows, memory, evals and a local studio
Azure / .NET shops Microsoft Agent Framework Successor to AutoGen and Semantic Kernel; Python and .NET
Gemini and Google Cloud Google ADK Dev UI, sessions, deployment paths into Google Cloud
AWS and Bedrock Strands Agents Minimal model-driven loop; Bedrock by default
Agents over your documents and data LlamaIndex Data connectors and RAG plus agent workflows
Role-based multi-agent “crews” CrewAI Agents with roles and goals, plus event-driven Flows
Agents that write code as their actions, with open models smolagents Tiny library, code agents, Hugging Face Hub integration
Prompts you optimize against a metric DSPy Programs, not prompts; optimizers tune them
Full control and no dependency Plain Python 40 lines; you own the loop

There is no single best agent framework. For a single agent with a few tools, every option here works; the differences show up in state management, multi-agent patterns, observability, deployment and which model provider you use.

The task

Every implementation solves exactly this, using shared code in shared/support.py (and shared/support.ts for TypeScript):

Small on purpose: it exercises tool schemas from functions, a multi-step tool loop, a side-effecting tool and a final text answer, which is the core of most agents.

The comparison table

Lines = non-blank, non-comment lines in the example, excluding the shared import header.

Framework Lang Package (version, Dec 2026) License Lines Native default model Multi-agent Durable state / checkpoints Human-in-the-loop Tracing MCP
Plain Python Py anthropic MIT 40 any you build it you build it you build it you build it via SDK helpers
LangChain / LangGraph Py, TS langchain 1.5, langgraph 1.2 MIT 10 any (provider packages) yes (graphs, subagents) yes (checkpointers) yes (interrupts, middleware) LangSmith (separate product) yes (adapters)
OpenAI Agents SDK Py, TS openai-agents 0.26 MIT 12 OpenAI yes (handoffs, agents as tools) sessions yes built in (OpenAI dashboard) yes
Claude Agent SDK Py, TS claude-agent-sdk 0.2 MIT repo; use under Anthropic terms 22 Claude only subagents sessions (resume, fork) permissions and hooks via hooks / OpenTelemetry yes (core mechanism)
CrewAI Py crewai 1.15 MIT 20 OpenAI yes (crews) Flows with state yes integrations yes
PydanticAI Py pydantic-ai 2.77 MIT 9 any yes (delegation, graphs) yes (Temporal, DBOS, Prefect and others) yes (tool approval) Logfire / OpenTelemetry yes
Google ADK Py (also Java, Go) google-adk 2.15 Apache-2.0 21 Gemini yes (workflows, sub-agents) session and memory services yes Dev UI, Cloud Trace yes
Microsoft Agent Framework Py, .NET agent-framework 1.26 MIT 15 Azure OpenAI / Foundry yes (sequential, concurrent, handoff, group chat) yes (checkpointing) yes (tool approval) OpenTelemetry, DevUI yes
smolagents Py smolagents 1.26 Apache-2.0 28 Hugging Face Inference managed agents no limited OpenTelemetry integrations yes
LlamaIndex Py, TS llama-index-core 0.14 MIT 14 OpenAI yes (AgentWorkflow handoffs) workflow context yes integrations yes
Agno Py agno 3.2 Apache-2.0 10 OpenAI yes (teams) yes (AgentOS) yes AgentOS yes
Strands Agents Py, TS strands-agents 1.68 Apache-2.0 11 Amazon Bedrock yes (swarm, graph, agents as tools) session managers yes OpenTelemetry yes
DSPy Py dspy 3.5 MIT 10 any (LiteLLM) compose modules no no MLflow integration via tools
Vercel AI SDK TS ai 7.0 Apache-2.0 22 any (provider packages, gateway) build it no (library) tool approval OpenTelemetry yes
Mastra TS @mastra/core 1.86 Apache-2.0 (with ee/ exceptions) 24 any yes (networks, workflows) yes (suspend/resume workflows) yes built in yes

“Yes” means the capability is documented and supported in the framework itself; check the docs for maturity of each feature. Line counts measure boilerplate for this task, not quality.

How we checked the code

Being honest about verification matters in a comparison like this:

Status Frameworks
Ran end to end against a local mock of the Anthropic Messages API (real framework code, scripted model replies, real tool execution) LangChain, OpenAI Agents SDK, PydanticAI, Microsoft Agent Framework, smolagents, LlamaIndex, Agno, Strands Agents
Constructed (imports, agent object built) but the run needs a real model because the framework uses its own text protocol DSPy
Written from official docs, not executed here (heavy installs or bundled binaries) Claude Agent SDK, CrewAI, Google ADK, Vercel AI SDK, Mastra
Unit tested offline shared task logic and the plain Python baseline (python -m unittest discover -s tests)

None of the examples were run against a live paid API for this review. If one breaks with a newer release, please open an issue or PR.

Framework by framework

Plain Python (no framework)

Code. The baseline: the Anthropic SDK and a for loop that sends tool results back until the model answers. 40 lines including tool schemas written by hand.

LangChain v1 and LangGraph

Code. create_agent(model="anthropic:...", tools=[...], system_prompt=...), then agent.invoke({"messages": [...]}).

OpenAI Agents SDK

Code. Agent(name, instructions, tools=[function_tool(f)]) and Runner.run_sync(agent, prompt).final_output.

Claude Agent SDK

Code. Custom tools are declared with @tool, bundled into an in-process MCP server with create_sdk_mcp_server, and allowed by name (mcp__support__refund_order). query() streams messages; the final ResultMessage holds the answer.

CrewAI

Code. Tools with @tool from crewai.tools; an Agent with role, goal and backstory; agent.kickoff(prompt).raw for a single agent.

PydanticAI

Code. Agent("anthropic:<model>", instructions=..., tools=[f, g]).run_sync(prompt).output: the shortest example here.

Google Agent Development Kit (ADK)

Code. Agent(name, model, instruction, tools), then an InMemoryRunner with a session and run_async, reading the final response event.

Microsoft Agent Framework

Code. Agent(client=AnthropicClient(model=...), instructions=..., tools=[f, g]), await agent.run(prompt), .text.

smolagents

Code. @tool functions need an Args: section in the docstring; ToolCallingAgent(tools, model).run(prompt).

LlamaIndex

Code. FunctionAgent(tools=[f, g], llm=Anthropic(model=...), system_prompt=...), await agent.run(user_msg=...).

Agno

Code. Agent(model=Claude(id=...), tools=[f, g], instructions=...), agent.run(prompt).content.

Strands Agents

Code. Agent(model=AnthropicModel(model_id=..., max_tokens=...), tools=[tool(f)], system_prompt=...); calling agent(prompt) runs the loop.

DSPy

Code. A Signature (inputs and outputs, with the instructions as its docstring) and dspy.ReAct(signature, tools=[f, g]).

Vercel AI SDK (TypeScript)

Code. generateText({ model, system, prompt, tools: { name: tool({ inputSchema, execute }) }, stopWhen: isStepCount(8) }).

Mastra (TypeScript)

Code. createTool({ id, description, inputSchema, execute }) and new Agent({ instructions, model: "anthropic/<model>", tools }), then agent.generate(prompt).

Do you need a framework at all?

The plain Python version is 40 lines and does the job. A framework earns its place when you need several of these:

Need Without a framework With one
Tool schemas from type hints write JSON Schema by hand automatic
Several model providers one client per provider one interface
Tracing and debugging add logging yourself built in or one integration
Long-running, resumable agents design persistence yourself checkpointers, durable execution
Human approval mid-run custom pause/resume logic interrupts, approval APIs
Multi-agent coordination your own router and handoffs handoffs, graphs, teams
Deployment, memory, scheduling build services platform features (AgentOS, ADK, Mastra…)

Rules of thumb:

Decision guide

Is your app TypeScript?
├─ yes → UI-centric web app? → Vercel AI SDK
│        full agent backend?  → Mastra
└─ no (Python)
   ├─ Tied to a cloud? Azure → Microsoft Agent Framework · Google → ADK · AWS → Strands
   ├─ Agent works on files/code with Claude? → Claude Agent SDK
   ├─ Mostly RAG over your data? → LlamaIndex
   ├─ Need explicit graphs, checkpoints, approvals? → LangGraph (via LangChain create_agent)
   ├─ Want typed, validated outputs with little code? → PydanticAI
   ├─ OpenAI models + multi-agent handoffs? → OpenAI Agents SDK
   ├─ Team-of-specialists metaphor? → CrewAI
   ├─ Open models, code-writing agents? → smolagents
   ├─ Want to optimize prompts against a metric? → DSPy
   └─ Just one agent with a few tools? → plain SDK

Status notes: what changed recently

Project Status in December 2026
LangChain / LangGraph 1.0 released October 2025; create_agent replaces create_react_agent; legacy APIs in langchain-classic
AutoGen Maintenance mode (bug fixes and security only); Microsoft recommends Microsoft Agent Framework for new projects
Semantic Kernel Its agent capabilities continue in Microsoft Agent Framework (migration guides available)
OpenAI Swarm Experimental project, replaced by the OpenAI Agents SDK
Vercel AI SDK Version 7; multi-step loops via stopWhen (the old maxSteps option is gone)
Google ADK Version 2.x adds workflow primitives
Strands Agents Python SDK repository moved under strands-agents/harness-sdk

Switching models and providers

Framework Claude (as in the examples) OpenAI Local (Ollama or any OpenAI-compatible server)
Plain Python Anthropic SDK OpenAI SDK OpenAI SDK with base_url
LangChain "anthropic:<model>" "openai:<model>" langchain-ollama or OpenAI-compatible base URL
OpenAI Agents SDK litellm/anthropic/<model> native litellm/ollama/<model> or an OpenAI-compatible client
PydanticAI "anthropic:<model>" "openai:<model>" OpenAI-compatible provider with a base URL
CrewAI LLM(model="anthropic/<model>") default LLM(model="ollama/<model>")
Google ADK AnthropicLlm(model=...) via LiteLLM via LiteLLM
Microsoft Agent Framework AnthropicClient OpenAI client package Ollama package / OpenAI-compatible client
smolagents LiteLLMModel("anthropic/<model>") OpenAIModel LiteLLMModel("ollama_chat/<model>")
LlamaIndex llama-index-llms-anthropic llama-index-llms-openai llama-index-llms-ollama
Agno agno.models.anthropic.Claude agno.models.openai agno.models.ollama
Strands AnthropicModel OpenAIModel Ollama or OpenAI-compatible model providers
DSPy dspy.LM("anthropic/<model>") dspy.LM("openai/<model>") dspy.LM("ollama_chat/<model>")
Vercel AI SDK @ai-sdk/anthropic @ai-sdk/openai OpenAI-compatible provider package
Mastra "anthropic/<model>" "openai/<model>" OpenAI-compatible or community providers

Check each framework’s model docs for exact class names in your version; several are provider packages installed separately.

Gotchas we hit

  1. Forced tool use and newer models. Some recent Claude models reject tool_choice values that force a tool call. smolagents’ ToolCallingAgent forces tool use, so through LiteLLM it raised UnsupportedParamsError until we set litellm.drop_params = True. If a framework fails with a tool_choice error, look for a setting that uses auto.
  2. Sampling parameters. Several newer models only accept default sampling settings; frameworks that send temperature, top_p or top_k by default can get HTTP 400 errors. In our mock runs none of the tested frameworks sent them by default, but check your configuration if you set them.
  3. Tracing to a vendor by default. The OpenAI Agents SDK exports traces to OpenAI unless disabled; Agno sends telemetry unless AGNO_TELEMETRY=false. Decide deliberately.
  4. Default providers. Quickstarts assume OpenAI (several), Gemini (ADK), Bedrock (Strands), Azure (Microsoft) or Hugging Face (smolagents). Pass a model explicitly to avoid surprise credential errors.
  5. Docstrings are schemas. Most frameworks build tool descriptions from docstrings and type hints; smolagents also requires an Args: section. Vague docstrings produce vague tool use.
  6. Stop conditions. The Vercel AI SDK stops after one step unless you set stopWhen; most Python frameworks loop until the model stops calling tools, with their own maximum.

Run the examples

git clone https://github.com/Ralpberry-Labs/langchain-alternatives
cd langchain-alternatives
export ANTHROPIC_API_KEY=sk-ant-...

# any Python framework
cd frameworks/pydantic-ai
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python agent.py

# TypeScript frameworks
cd frameworks/vercel-ai-sdk && npm install && npm start

Offline tests (no API key):

python -m unittest discover -s tests -v

They test the shared task, run the plain Python baseline against a fake client, and check that every example parses and uses the shared prompt.

FAQ

What is the best alternative to LangChain? It depends on what you used LangChain for. For simple agents, PydanticAI or a plain SDK; for TypeScript, the Vercel AI SDK; for RAG, LlamaIndex; for cloud-native agents, the framework from your cloud provider. LangChain v1 itself is also much simpler than older versions.

Is LangChain still worth learning in 2026? Yes if you need its integrations or LangGraph’s stateful workflows. The v1 API (create_agent plus middleware) is smaller and more stable than the pre-1.0 chains most old tutorials show.

What is the difference between LangChain and LangGraph? LangGraph is the low-level runtime for stateful graphs (nodes, edges, checkpoints, interrupts). LangChain v1’s create_agent is a high-level agent built on LangGraph.

Which framework is best for multi-agent systems? LangGraph, Microsoft Agent Framework, Google ADK, CrewAI and the OpenAI Agents SDK all have first-class multi-agent patterns. Start with one agent; add more only when a single agent’s context or tool list becomes a problem.

Which framework has the least overhead? For our task: PydanticAI (9 lines), LangChain, Agno and DSPy (10 each), and Strands (11). Fewer lines is not the same as better; look at the features you need.

Do these frameworks support MCP (Model Context Protocol)? Almost all of them do now, either natively or through adapters; the Claude Agent SDK uses MCP as its mechanism for custom tools.

Can I use local models with agent frameworks? Yes, through Ollama, vLLM or other OpenAI-compatible servers. Tool calling quality varies a lot across local models; test the full loop.

Is AutoGen dead? It is in maintenance mode. Microsoft directs new projects to Microsoft Agent Framework, which merges ideas from AutoGen and Semantic Kernel.

Should I use an agent framework or a workflow? If the steps are known in advance, write a workflow (fixed code calling the model). Use an agent loop when the model must decide which steps to take.

Where to go next

Contributing

PRs are welcome: new frameworks (implement the same task using shared/support.py, add a requirements.txt or package.json), fixes for API changes, and verification reports (which version you ran, with which model, and the output). Keep each example minimal and idiomatic for its framework, using the approach the framework’s own docs recommend. Claims in the tables should link to documentation.

If this comparison saved you a week of prototypes, a star helps others find it.

More free resources

Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.