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
- The task
- The comparison table
- How we checked the code
- Framework by framework
- Do you need a framework at all?
- Decision guide
- Status notes: what changed recently
- Switching models and providers
- Gotchas we hit
- Run the examples
- FAQ
- Where to go next
- Contributing
- More free resources
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):
- Tools:
get_order_status(order_id)andrefund_order(order_id, reason)over a fake two-order database. Refunds are only allowed for orders that have not shipped. - System prompt: “You are a customer support agent for an outdoor gear shop. Use get_order_status to look up orders before answering. Only refund an order if it has not shipped…”
- User message: “Where is order A-1001? If it hasn’t shipped, refund it because I changed my mind.”
- Expected behavior: look up A-1001, see it has not shipped, refund it, reply in two or three sentences.
- Model:
claude-opus-5-5by default (setAGENT_MODELto change it). Claude is used everywhere so the comparison isolates the framework, not the model; each section notes the framework’s native default provider.
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.
- Choose it when: one agent, a few tools, you want zero magic, easy debugging and no dependency churn.
- You give up: automatic schemas from functions, built-in tracing, retries policy for tools, multi-agent patterns, persistence.
- Tip: most SDKs now ship a helper that runs this loop for you (for example the Anthropic SDK’s tool runner), which keeps you close to the API without a framework.
LangChain v1 and LangGraph
Code. create_agent(model="anthropic:...", tools=[...], system_prompt=...), then agent.invoke({"messages": [...]}).
- What changed: LangChain and LangGraph reached 1.0 in October 2025.
create_agentis now the standard way to build agents and runs on LangGraph; the olderlanggraph.prebuilt.create_react_agentis deprecated, and legacy chains moved tolangchain-classic. - Strengths: middleware for cross-cutting concerns (summarization, human approval, PII handling), durable execution with checkpointers, interrupts for human-in-the-loop, the largest set of integrations.
- Watch out for: several packages to learn (
langchain,langgraph, provider packages); older tutorials online use APIs that no longer exist. - Choose it when: you need explicit state graphs, long-running or resumable agents, or a specific integration that only LangChain has.
OpenAI Agents SDK
Code. Agent(name, instructions, tools=[function_tool(f)]) and Runner.run_sync(agent, prompt).final_output.
- Strengths: small set of primitives (agents, tools, handoffs, guardrails, sessions), tracing on by default, realtime and voice agents, hosted tools when using OpenAI.
- Other models: through the LiteLLM extension (
openai-agents[litellm], modellitellm/<provider>/<model>). Disable tracing (set_tracing_disabled(True)) or provide an OpenAI key for trace export when you use other providers. - Watch out for: still a 0.x version; best experience on OpenAI models.
- Choose it when: you build on OpenAI models and want multi-agent handoffs with minimal code. It is the production successor to the experimental Swarm project.
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.
- Strengths: it is the agent harness behind Claude Code: built-in tools for files, shell and web, permission modes, hooks, subagents, sessions, skills and context management.
- Watch out for: Claude models only; heavier than a chat-agent library for a two-tool bot; usage is governed by Anthropic’s terms.
- Choose it when: your agent works with files, code or a computer (coding agents, research agents, ops automation) and you use Claude.
CrewAI
Code. Tools with @tool from crewai.tools; an Agent with role, goal and backstory; agent.kickoff(prompt).raw for a single agent.
- Strengths: intuitive role-based multi-agent crews; Flows for event-driven, stateful pipelines.
- Watch out for: role and backstory prompting adds tokens and opinions; for Anthropic models set
max_tokenson theLLM. - Choose it when: your problem maps naturally to a team of specialists (researcher, writer, reviewer).
PydanticAI
Code. Agent("anthropic:<model>", instructions=..., tools=[f, g]).run_sync(prompt).output: the shortest example here.
- Strengths: type-safe dependencies and outputs (
output_type=with validation), excellent model portability, Logfire/OpenTelemetry tracing, durable execution integrations, tool approval. - Watch out for: fast release cadence (major version 2.x); pin versions.
- Choose it when: you like FastAPI-style typed Python and want structured, validated outputs.
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.
- Strengths:
adk webdev UI, API server, session/memory/artifact services, multi-agent and workflow primitives, deployment paths to Google Cloud. - Other models: Gemini by name; Claude through the Anthropic model class (
google-adk[extensions]) or LiteLLM. - Watch out for: more setup for a single run (runner, session, content objects).
- Choose it when: you use Gemini or Google Cloud, or want a ready-made dev UI.
Microsoft Agent Framework
Code. Agent(client=AnthropicClient(model=...), instructions=..., tools=[f, g]), await agent.run(prompt), .text.
- Status: generally available 1.x; it is Microsoft’s successor to both AutoGen and Semantic Kernel. AutoGen itself is in maintenance mode.
- Strengths: graph-based workflows with checkpointing and human-in-the-loop, tool approval, middleware, OpenTelemetry, a DevUI, Python and .NET.
- Watch out for: docs and samples lean toward Azure; some provider packages (including Anthropic) are pre-release.
- Choose it when: you are on Azure or .NET, or migrating from AutoGen or Semantic Kernel.
smolagents
Code. @tool functions need an Args: section in the docstring; ToolCallingAgent(tools, model).run(prompt).
- Strengths: very small;
CodeAgentlets the model write Python as its actions (with sandbox options); works well with open models via Hugging Face. - Watch out for:
ToolCallingAgentrequests forced tool use, which some newer Claude models reject; the example setslitellm.drop_params = Trueso LiteLLM downgrades it (see Gotchas). Code agents execute model-written code: sandbox them. - Choose it when: you work with open models, want code-as-action agents, or want a codebase you can read in an afternoon.
LlamaIndex
Code. FunctionAgent(tools=[f, g], llm=Anthropic(model=...), system_prompt=...), await agent.run(user_msg=...).
- Strengths: the best fit when the agent’s job is mostly data: connectors, indexes, query engines as tools;
AgentWorkflowfor multi-agent handoffs. - Watch out for: many integration packages; core still 0.x.
- Choose it when: you are building RAG-heavy or document agents.
Agno
Code. Agent(model=Claude(id=...), tools=[f, g], instructions=...), agent.run(prompt).content.
- Strengths: concise API, large toolkit catalog, teams, and AgentOS for serving, memory, approvals and scheduling.
- Watch out for: telemetry is on by default (
AGNO_TELEMETRY=falsedisables it); docs emphasize the platform. - Choose it when: you want batteries-included agents plus a runtime to deploy them.
Strands Agents
Code. Agent(model=AnthropicModel(model_id=..., max_tokens=...), tools=[tool(f)], system_prompt=...); calling agent(prompt) runs the loop.
- Strengths: model-driven loop with very little code; multi-agent patterns (swarm, graph, agents as tools); MCP; OpenTelemetry.
- Watch out for: defaults to Amazon Bedrock and expects AWS credentials unless you pass a model.
- Choose it when: you are on AWS or want a minimal SDK with production-minded features.
DSPy
Code. A Signature (inputs and outputs, with the instructions as its docstring) and dspy.ReAct(signature, tools=[f, g]).
- Strengths: treats prompts as parameters you can optimize against a metric and examples; modules compose like PyTorch layers.
- Watch out for: uses its own prompting format rather than native tool calling; not an agent runtime (no persistence or approvals).
- Choose it when: you have an evaluation metric and want to improve an LLM pipeline systematically.
Vercel AI SDK (TypeScript)
Code. generateText({ model, system, prompt, tools: { name: tool({ inputSchema, execute }) }, stopWhen: isStepCount(8) }).
- Strengths: thin and typed, provider-agnostic, excellent streaming to React and other UIs, tool approval, an agent class for reuse.
- Watch out for: without a stop condition the call ends after the first tool step; major versions move quickly (v7 renamed some helpers, for example
stepCountIstoisStepCount, keeping the old name as an alias). - Choose it when: you build web apps in TypeScript, especially with Next.js.
Mastra (TypeScript)
Code. createTool({ id, description, inputSchema, execute }) and new Agent({ instructions, model: "anthropic/<model>", tools }), then agent.generate(prompt).
- Strengths: full TypeScript platform: agents, workflows with suspend/resume, memory, evals, MCP, a local playground.
- Watch out for: heavier than the AI SDK for a single agent; some enterprise directories have a different license.
- Choose it when: you want a complete agent backend in TypeScript.
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:
- One agent, a few tools, one provider: plain SDK (or its built-in tool runner).
- Typed outputs and provider flexibility: a light library (PydanticAI, Vercel AI SDK, Strands).
- Stateful, long-running, human-in-the-loop workflows: LangGraph, Microsoft Agent Framework, Mastra workflows, or PydanticAI with a durable execution backend.
- Coding or computer-use agents: Claude Agent SDK, or study open-source coding agents.
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
- Forced tool use and newer models. Some recent Claude models reject
tool_choicevalues that force a tool call. smolagents’ToolCallingAgentforces tool use, so through LiteLLM it raisedUnsupportedParamsErroruntil we setlitellm.drop_params = True. If a framework fails with a tool_choice error, look for a setting that usesauto. - Sampling parameters. Several newer models only accept default sampling settings; frameworks that send
temperature,top_portop_kby 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. - 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. - 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.
- 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. - 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
- Building effective agents for patterns that apply in any framework
- Official docs: LangChain, OpenAI Agents SDK, Claude Agent SDK, CrewAI, PydanticAI, Google ADK, Microsoft Agent Framework, smolagents, LlamaIndex, Agno, Strands Agents, DSPy, Vercel AI SDK, Mastra
- In this collection: nano-agent (the agent loop in one file), AI app templates (chatbot, RAG and agent starters) and prompt engineering patterns (tool descriptions, stopping criteria)
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.