LangChain vs CrewAI vs LlamaIndex vs AutoGen vs Pydantic AI vs OpenAI Agents SDK vs Mastra vs Letta: How to Choose
All 8 agent frameworks in our index compared side by side — what each is actually for, live GitHub star counts, and a decision framework for picking the right one for what you’re building.
By The Agents Index Editorial, Research desk · 2026-07-20
Eight agent frameworks make up the entire "Frameworks" category in our index: LangChain, CrewAI, LlamaIndex, Microsoft AutoGen, the OpenAI Agents SDK, Pydantic AI, Mastra and Letta. All eight are open-source and free at the core — our own pricing census already found that every framework in the index is free or freemium, the only category where that's unanimous. So the choice between them is never about budget. It's about which job you're actually doing: retrieval over your own documents, standing up a multi-agent crew fast, wiring a bespoke production system with deep control, shipping a straightforward agent this week, getting validated, type-safe output out of the model, building natively in the JS/TypeScript stack instead of Python, or building an agent that has to genuinely remember across sessions instead of starting fresh every call. Each of the eight was built to be the best answer to one of those jobs — and the honest verdict on each, pulled from its own researched listing, names which job it is not built for just as clearly as the one it is.
The eight, at a glance
GitHub star counts below were pulled live from each project's public repository between 20 and 24 July 2026 — a rough proxy for community size and momentum, not a quality score.
| Framework | Primary job | GitHub stars | License | Language | Paid layer |
|---|---|---|---|---|---|
| LangChain | Bespoke production agents, largest integration ecosystem | 142,168 | MIT | Python, JS/TS | LangSmith (observability) |
| Microsoft AutoGen | Agent-to-agent conversation patterns (maintenance mode) | 59,846 | MIT (code) | Python, .NET | None (self-hosted) |
| CrewAI | Fast, role-based multi-agent "crews" | 55,845 | MIT | Python | Enterprise (custom) |
| LlamaIndex | Retrieval-augmented generation / document Q&A | 50,962 | MIT | Python, TS | LlamaCloud (parsing) |
| OpenAI Agents SDK | Fastest path to a straightforward production agent | 28,041 | MIT | Python, JS/TS | None (self-hosted) |
| Mastra | TypeScript-native agents, durable workflows & memory, unified | 26,497 | Apache 2.0 | TypeScript/JS | Mastra Cloud (from $250/mo) |
| Letta | Stateful, memory-first agents with versioned context | 23,933 | Apache 2.0 | Python, TS SDKs | Letta Cloud (Free/Pro/API/Teams, from $20/mo) |
| Pydantic AI | Type-safe, validated structured output | 18,675 | MIT | Python | Logfire (observability) |
Star count tracks age and marketing surface area as much as fit for your project — LangChain and AutoGen are both multi-year-old projects that came out of the earliest wave of the space, while Pydantic AI, the OpenAI Agents SDK, Mastra and Letta are newer entrants building on lessons the older two already learned in public. A smaller star count is not a red flag by itself; check the "watch out for" column below instead.
The decision: what are you actually building?
Every one of these frameworks has a listing on this site with a full researched verdict, a named persona it's not for, and genuine sourced cons — not marketing copy. Reading all eight side by side, the honest decision tree looks like this:
- Your app lives or dies on getting the right context into the model (document Q&A, enterprise search, RAG over messy PDFs) → LlamaIndex. It's the reference RAG implementation, with 300-plus data connectors and hybrid/recursive retrieval built in. Watch out for: it's retrieval-first, not agent-first — a real-time conversational or heavily agentic app is a worse fit, and the strongest document parsing (LlamaParse) is the paid LlamaCloud, not the free core.
- You're building something bespoke and need the largest integration surface plus real stateful, multi-step control → LangChain (with LangGraph). Nothing else matches its ecosystem of model, vector-store and tool integrations, and LangGraph gives genuine graph-based control — branching, loops, human-in-the-loop, multi-agent coordination. Watch out for: the abstractions have churned across major versions, so older tutorials can actively mislead, and it's overkill for a single prompt-and-response wrapper.
- You want to stand up a working multi-agent system — a team of specialists handing off tasks — as fast as possible → CrewAI. Its role-based "crew" abstraction is unusually readable for how much coordination it buys, and the community momentum is real. Watch out for: the crew model alone is hard to constrain tightly — deterministic control needs its newer Flows layer, and it's younger and less battle-tested than lower-level frameworks for complex, long-running production control.
- You want the shortest path from a spec to a working production agent — support triage, a tool-using assistant — with tracing and guardrails included → OpenAI Agents SDK. Four primitives (agents, handoffs, guardrails, sessions) instead of a graph engine, with built-in tracing that would otherwise take weeks to build; a beta "sandbox agents" mode also gives an agent its own persistent file/shell workspace. Watch out for: durable state is limited to manual, approval-scoped snapshots (no automatic step-by-step checkpointing), handoffs are linear chains rather than a graph, and it's young (v0.x) so APIs can still shift.
- You're building in the JS/TypeScript stack — a Next.js app, a Node service — and don't want to stand up a separate Python service just for the agent layer → Mastra. It's the only framework in this category built TypeScript-first from the ground up, unifying agents, durable typed workflows, memory and observability in one Apache-2.0 package, with 90+ model providers behind one interface and built-in Vercel/Netlify/Cloudflare deployers. Watch out for: no Python path at all, a much younger ecosystem than LangChain's (26.5K GitHub stars vs. 142K+), and its deepest enterprise controls (RBAC, SSO, IAM) sit behind a separate source-available Enterprise license rather than the open core.
- Malformed model output breaking your app in production is the problem you're actually trying to solve → Pydantic AI. Every response is validated against your own Pydantic models at the boundary, with a type-safe dependency-injection system and unusually pleasant, low-boilerplate ergonomics. Watch out for: fewer pre-built integrations than LangChain (you build more of the glue yourself), and while its 2.0 release added real checkpointed durability via Temporal/DBOS/Prefect/Restate integrations, you still have to operate that orchestrator yourself, and LangGraph's native graph-branching still goes deeper.
- Your agent has to genuinely remember and improve across long-running sessions, not reset to a blank slate on every call → Letta. It's the only framework here built stateful-first — memory, tools and configuration persist as a durable server-side object, versioned with git-based Context Repositories, and a "sleep-time compute" feature lets an agent keep reorganizing its own memory between requests. Watch out for: a much smaller community than the incumbents (23.9K GitHub stars vs. LangChain's 142K+), a single smaller seed round backing it versus rivals' later-stage raises, and a product surface split across two separately-adopted repos (the core framework and the newer Letta Code CLI harness).
- You're learning the "agents talking to agents" pattern, or maintaining an existing AutoGen codebase → Microsoft AutoGen, with eyes open. It pioneered conversational multi-agent orchestration and is still a clean, well-documented, genuinely free way to learn the pattern. But Microsoft has put it into maintenance mode — bug and security fixes only (no tagged release since September 2025), with the README itself pointing new users to the Microsoft Agent Framework, which reached a production-ready 1.0 GA release in April 2026, while the original authors maintain a separate, genuinely active community fork (AG2) that controls the old PyPI packages. For a new, long-lived production build, evaluate the Microsoft Agent Framework or AG2 before starting fresh on AutoGen itself — a three-way split in an ecosystem you'll have to maintain for years is a real, structural risk, not a style preference.
Mastra: TypeScript-native, not a Python port with JS bindings
Every other framework on this list started life as a Python library and later added a JavaScript/TypeScript SDK as a secondary target. Mastra reverses that: founded in San Francisco in 2024 by Sam Bhagwat (co-founder of Gatsby) as a Y Combinator company, it was built TypeScript-first from the ground up, designed to drop straight into an existing Next.js or Node app instead of standing up a separate Python service. It unifies five things developers otherwise assemble from separate packages — typed agents, durable typed workflows (retries, branching), memory, observability (evals, metrics, traces) and a server layer — in one Apache 2.0-licensed core that's free to self-host anywhere, with model routing across 90+ providers behind one standard interface. It backs that up with real commercial traction: a $22M Series A led by Spark Capital (mid-2026, $35M total raised, with Y Combinator and Gradient Ventures among the seed backers) and named production customers including Replit, Sanity, MongoDB, Brex and Marsh. The honest tradeoff is scope and age, not capability: it's TypeScript-only with no Python path at all, its GitHub community (26.5K stars) is a fraction of LangChain's multi-year head start (142K+), and its deepest enterprise controls (RBAC, SSO, IAM, audit logs) sit behind a separate source-available Enterprise license rather than the free Apache-2.0 core.
Letta: stateful, memory-first agents, not a stateless call graph
Every other framework on this list — LangChain, CrewAI, LlamaIndex, AutoGen, the OpenAI Agents SDK, Pydantic AI and Mastra — is fundamentally a stateless call graph: an agent's context is rebuilt from a prompt on every request, and any memory beyond that is something you bolt on yourself with a vector store or a database. Letta inverts that premise. It grew directly out of MemGPT, the UC Berkeley Sky Computing Lab research project that pioneered virtual context management for LLMs, and is built by Sarah Wooders and Charles Packer — the same researchers behind that original paper. An agent's memory, tools and configuration persist as a durable server-side object across sessions, versioned with git-based "Context Repositories" that can be branched, diffed and rolled back like code, and a "sleep-time compute" feature lets an agent keep reasoning and reorganizing its own memory during idle periods. The Apache 2.0-licensed core (letta-ai/letta) is free and self-hostable; a newer CLI/agent-harness layer, "Letta Code," adds a managed Letta Cloud option with a genuine free tier and $20/month Pro/API/Teams plans. It's backed by a $10M seed led by Felicis (with angels including Google DeepMind's Jeff Dean and Hugging Face's Clem Delangue) and runs in production at Bilt, 11x, Kognitos and Hunt Club. The honest tradeoff is scale, not capability: a single, smaller seed round versus the later-stage rounds backing several rivals here, a GitHub community (23.9K+ stars) a fraction of LangChain's 142K+, and a product surface split across two separately-adopted repos (the core framework and the newer Letta Code harness).
Where they overlap, and where they don't compete at all
These eight aren't eight competitors for the same job — most pairs solve different problems and get combined in production rather than chosen between. The clearest example in our own index: LlamaIndex's own FAQ states plainly that "many production stacks use both together," pairing LlamaIndex-for-retrieval with LangGraph-for-orchestration — a pattern independently corroborated across the 2026 comparison articles we found when researching our LangChain vs LlamaIndex page. The two frameworks compete head-on only at the edges (LangChain's own retrieval features vs. LlamaIndex's growing agent Workflows); the dominant real-world pattern is complementary, not rival.
CrewAI and LangGraph are a closer head-to-head — both are genuine multi-agent orchestration choices, and our CrewAI vs LangChain page covers that pairing directly: CrewAI trades some of LangGraph's fine-grained control for a faster, more readable path to a working crew. Pydantic AI and the OpenAI Agents SDK are the two newest, most minimal Python entrants, and they don't really compete with each other either — Pydantic AI's centre of gravity is validated structured output from Python type hints, while the Agents SDK's is OpenAI's own primitives (handoffs, guardrails, sessions) for triage-style multi-agent routing. AutoGen is the odd one out: it isn't really competing for new adoption at all right now, given Microsoft's own guidance toward its successor. Mastra doesn't compete head-on with any of the other six either — the language choice (TypeScript vs. Python) usually settles the shortlist before a feature comparison starts, so a Python team weighing LangChain against Pydantic AI was never going to consider Mastra anyway, and vice versa. Letta stands apart from all seven on a different axis entirely: it's the only one that's stateful by design, so the real choice isn't Letta-vs-LangChain on features, it's whether persistent memory is the actual requirement — if it is, none of the other seven's stateless architecture solves that problem no matter how it's configured.
One thing all eight get right
Every framework's core library is free and open-source — you pay your model provider, not the framework vendor, for the actual agent runs. Where they differ is the optional paid layer bolted on top: LangChain's LangSmith (observability, $39/seat/month past a 5,000-trace free tier), LlamaIndex's LlamaCloud (managed document parsing, from $50/month), Pydantic AI's Logfire (observability, free tier plus usage-based paid plans), Mastra Cloud (hosted Studio, observability and deployment, free Starter tier then $250/month Teams), and Letta Cloud (a managed layer for the newer Letta Code product, with a genuine free tier then $20/month Pro/API/Teams plans). CrewAI's only paid offering is a custom-priced Enterprise deployment platform; AutoGen and the OpenAI Agents SDK currently have no first-party paid tier at all. None of the eight requires paying anything to use the framework itself — the paid layers are all optional production tooling, never a gate on trying the framework.
FAQ
Which AI agent framework should I learn first?
If you don't yet know what you're building, start with LangChain — it has the largest ecosystem, the most tutorials and documentation, and its LangGraph layer covers the widest range of use cases, so skills transfer well even if you switch frameworks later. If you already know your job is retrieval/RAG specifically, start with LlamaIndex instead. If you're building specifically in TypeScript or Next.js and don't want to touch Python at all, start with Mastra instead of any of the Python-first options. If your agent needs to genuinely remember across sessions rather than reset each call, start with Letta instead of any of the stateless options.
Can I use more than one of these frameworks together?
Yes, and it's common — LlamaIndex-for-retrieval paired with LangGraph-for-orchestration is a well-documented production pattern (see LlamaIndex's own FAQ). They're libraries you import, not platforms that lock you in, so combining the retrieval strength of one with the orchestration strength of another is a normal architecture, not a hack.
Is Microsoft AutoGen safe to build on today?
For learning the multi-agent conversation pattern or maintaining existing AutoGen code, yes. For a brand-new, long-lived production system, Microsoft's own README steers new users to the Microsoft Agent Framework instead, which reached a production-ready 1.0 GA release in April 2026 — AutoGen itself receives bug and security fixes only (no tagged release since September 2025), and the ecosystem has split three ways (AutoGen, the genuinely active community AG2 fork, and the now-GA Microsoft Agent Framework). Evaluate the successor first.
Do any of these frameworks lock me into one LLM provider?
No — all eight are model-agnostic in practice. LangChain, CrewAI (via LiteLLM), LlamaIndex, AutoGen, Pydantic AI, Mastra (90+ providers behind one routing interface) and Letta (bring your own API keys) all support essentially any major provider. The OpenAI Agents SDK is OpenAI-branded and optimised for OpenAI's own models, but is genuinely provider-agnostic too, supporting 100-plus other LLMs through LiteLLM and the Chat Completions API.
Which framework has the most integrations?
LangChain, by a wide margin — its own listing describes it as having "unmatched integrations" across models, vector stores and tools, and that breadth is the single biggest reason teams reach for it over a narrower framework even when they don't need LangGraph's control layer specifically.
How is Mastra different from the other seven frameworks here?
It's the only one built TypeScript-first rather than as a Python library with a JS/TS SDK bolted on. That makes it a natural fit for a team already building in Next.js or Node that wants agents, durable workflows and memory without standing up a separate Python service — but it also means no Python path at all, unlike LangChain, LlamaIndex, AutoGen, the OpenAI Agents SDK, Pydantic AI and Letta, which all ship first-party Python support.
How is Letta different from the other seven frameworks here?
It's the only one built stateful-first. LangChain, CrewAI, LlamaIndex, AutoGen, the OpenAI Agents SDK, Pydantic AI and Mastra all rebuild an agent's context from a prompt on every call; Letta agents persist as a durable server-side object with git-versioned memory across sessions. That makes it the right pick when an agent genuinely needs to remember and improve over time, not when the task is a bounded, stateless workflow.
Every framework above carries its own full researched listing — pricing tiers, sourced pros and cons, and a committed verdict on who it's for and who it isn't. Start with the frameworks category, or go deeper on a specific pairing with our CrewAI vs LangChain and LangChain vs LlamaIndex comparisons.