Agent Frameworks
LangChain, LlamaIndex, CrewAI, Claude Agent SDK
Prerequisites
- agents-reasoning
You could build an AI agent from scratch — write the loop, handle tool calls, manage memory, deal with errors. Or you could use a framework that handles all that boilerplate and let you focus on what your agent actually does. The question is not whether to use a framework. It is which one. And right now, there are too many to choose from.
LangChain gives you everything: chains, agents, tools, memory, RAG. LlamaIndex is built around data — indexing, retrieval, and knowledge-heavy applications. CrewAI and AutoGen let you define teams of specialized agents that collaborate. Claude Agent SDK and Vercel AI SDK are lightweight and API-native, keeping you close to the metal. Each framework solves a different problem, and picking the wrong one can mean fighting against the abstraction instead of building your application.
This lesson is not about learning every framework in depth. It is about understanding what each framework is good at, when to use it, and when to avoid it. You will see a framework comparison tool, code examples, and a decision helper that recommends the right tool for your use case. By the end, you will know how to pick the framework that gets out of your way and lets you ship.
Why frameworks exist
Every agent needs the same basic components: a loop that alternates between reasoning and action, tool management to define and execute functions, memory to track conversation history and state, error handling to recover from failures, and output parsing to extract structured data from LLM responses. Writing all of this from scratch for every agent is wasteful. Frameworks exist to abstract away the boilerplate so you can focus on your specific use case.
The problem is that different frameworks make different tradeoffs. Some frameworks (like LangChain) give you maximum flexibility at the cost of complexity. Others (like Claude Agent SDK) keep things minimal but require you to write more code yourself. Some are built around specific patterns (LlamaIndex for RAG, CrewAI for multi-agent). There is no universal best choice — the right framework depends on what you are building, how much control you need, and whether you are prototyping or shipping to production.
From Raw API to Framework
The framework landscape is crowded and evolving fast. New frameworks appear every few months, and established ones go through breaking changes. This lesson focuses on five major categories: LangChain (general-purpose Swiss Army knife), LlamaIndex (data-first RAG), CrewAI/AutoGen (multi-agent collaboration), and Claude/Vercel/lightweight SDKs (minimal abstraction). These cover the majority of use cases, and understanding them will help you evaluate new frameworks as they emerge.
The framework landscape
Each framework was designed to solve a specific problem, and understanding that problem is the key to picking the right tool. Here is a tour of the major frameworks, what they are optimized for, and when you should (or should not) use them.
LangChain — The Swiss Army Knife
LangChain is the most popular agent framework. It gives you everything: pre-built chains (sequences of LLM calls), agents (ReAct loops with tool access), hundreds of tool integrations, memory modules, RAG pipelines, and support for every major LLM provider. The ecosystem is massive — if you need to connect to a database, search engine, API, or file format, LangChain probably has a pre-built connector.
- • General-purpose agent development
- • Prototyping with many tools and data sources
- • Teams that want batteries-included solutions
- • Projects that need to swap LLM providers
- • High complexity — many abstractions to learn
- • Overkill for simple tasks
- • Frequent breaking changes between versions
- • Performance overhead from abstraction layers
LangChain is the default choice for most teams because of its huge ecosystem and community. But that ecosystem comes at a cost: the API is complex, the documentation is sprawling, and major versions introduce breaking changes. If you are building a simple agent with 2-3 tools, you are probably better off with a lighter framework.
Framework comparison tool
This interactive tool lets you compare the five major agent frameworks side by side. Click a framework card to see code examples, pros/cons, and best-for scenarios. Use the Decision Helper to answer three questions and get a recommendation. The comparison table at the bottom shows which features each framework supports.
LangChain
General-purpose agents, chains, RAG
LlamaIndex
Data ingestion, indexing, RAG
CrewAI
Multi-agent collaboration, role-based teams
AutoGen
Conversational multi-agent systems
Claude Agent SDK
Production Claude-native agents
Decision Helper
| Feature | LangChain | LlamaIndex | CrewAI | AutoGen | Claude Agent SDK |
|---|---|---|---|---|---|
| Tool Calling | ✓ | ✓ | ✓ | ✓ | ✓ |
| RAG Support | ✓ | ✓ | – | – | – |
| Multi-Agent | ✓ | – | ✓ | ✓ | – |
| Streaming | ✓ | ✓ | – | – | ✓ |
| Memory/State | ✓ | ✓ | ✓ | ✓ | – |
| Code Execution | – | – | – | ✓ | – |
Key Takeaways
- Frameworks exist to handle boilerplate (loops, tools, memory, parsing) so you can focus on your use case. But different frameworks make different tradeoffs: LangChain gives you maximum flexibility, LlamaIndex is optimized for RAG, CrewAI/AutoGen focus on multi-agent, and Claude Agent SDK keeps things minimal.
- LangChain is the Swiss Army knife — huge ecosystem, pre-built chains, support for every LLM provider. Best for general-purpose agent development and prototyping. Cons: high complexity, frequent breaking changes, overkill for simple tasks.
- LlamaIndex is data-first. Built around indexing, retrieval, and RAG with 100+ data connectors and advanced chunking strategies. Best for document Q&A and knowledge-heavy applications. Cons: less focused on multi-agent, steeper learning curve for non-RAG use cases.
- CrewAI and AutoGen are multi-agent frameworks. Define teams of specialized agents (researcher, writer, reviewer) that collaborate. Best for tasks that decompose into roles and need agent coordination. Cons: coordination is hard, smaller ecosystem, debugging is difficult.
- Claude Agent SDK (and lightweight SDKs like Vercel AI SDK) give you minimal abstraction and full control. You write the agent loop yourself. Best for production apps with simple agents where you want stability and no framework churn. Cons: fewer batteries included, more code to write.
Common Misconceptions
- "The best framework is the one everyone uses." -- Not necessarily. LangChain is the most popular, but that does not mean it is the best for your use case. If you are building document Q&A, LlamaIndex is better. If you want minimal dependencies, Claude Agent SDK is better. Popularity is a signal, not a verdict. Pick the framework that solves your specific problem, not the one with the most GitHub stars.