Agent Frameworks Overview: LangChain, CrewAI, AutoGen, and Beyond
You need to build an AI agent that processes customer support tickets. You search “AI agent framework” and find LangChain, LangGraph, CrewAI, AutoGen, Semantic Kernel, Haystack, LlamaIndex, Instructor, and 20 more. Each has its own abstractions, its own way of defining tools, its own execution model. You spend 3 days evaluating frameworks instead of building the agent.
This is the framework paradox in AI engineering: the ecosystem moves so fast that frameworks become outdated before you master them, yet building from scratch means solving problems someone else has already solved. The right choice depends on your use case, team size, and how much control you need.
The landscape
graph TD
subgraph simple["Simple / Focused"]
I["Instructor
Structured extraction"]
M["Mirascope
Clean LLM abstractions"]
end
subgraph mid["Mid-Complexity"]
LC["LangChain
General purpose, composable"]
LI["LlamaIndex
RAG-focused"]
H["Haystack
Pipeline-based"]
end
subgraph advanced["Advanced / Multi-Agent"]
LG["LangGraph
Stateful agent graphs"]
AG["AutoGen
Multi-agent conversations"]
CR["CrewAI
Role-based multi-agent"]
end
style I fill:#E1F5EE,stroke:#0F6E56,color:#085041
style M fill:#E1F5EE,stroke:#0F6E56,color:#085041
style LC fill:#EEEDFE,stroke:#534AB7,color:#3C3489
style LG fill:#FAEEDA,stroke:#854F0B,color:#633806
style CR fill:#FAEEDA,stroke:#854F0B,color:#633806
Framework comparison
| Framework | Best for | Tradeoff |
|---|---|---|
| LangChain | General LLM apps, RAG, chains | Lots of abstractions, can be over-engineered for simple tasks |
| LangGraph | Stateful agents, complex workflows | Steeper learning curve, powerful for production agents |
| LlamaIndex | RAG pipelines, data ingestion | Excellent for retrieval, less suited for agentic workflows |
| CrewAI | Multi-agent role-based collaboration | Opinionated structure, good for team-of-agents patterns |
| AutoGen | Research, multi-agent conversations | Microsoft-backed, strong for conversational multi-agent |
| Instructor | Structured output extraction | Minimal, does one thing very well |
| Haystack | Production pipelines with components | Good for production-grade pipelines, less for experimentation |
| Semantic Kernel | Enterprise .NET/Python apps | Microsoft-integrated, good for Azure-heavy stacks |
| Vanilla SDK | Simple apps, full control | No abstractions to learn or fight against |
When to use a framework vs build custom
Use a framework when:
- You need proven patterns for common problems (RAG, tool use, memory)
- Your team is new to AI engineering and needs guardrails
- You want community support and documentation
- The framework’s abstractions match your use case closely
- You are building a prototype and need speed
Build custom when:
- Your use case does not fit standard patterns
- You need maximum performance and control over every API call
- The framework’s abstractions add overhead you cannot afford
- You have experienced engineers who know the underlying APIs well
- Your application is simple enough that a framework adds more complexity than it removes
The honest recommendation
For most teams: start with the raw SDK (OpenAI, Anthropic, etc.) for your first agent. Understand what happens under the hood. Then adopt a framework only when you find yourself reimplementing patterns that the framework provides. This avoids the common trap of fighting framework abstractions before understanding the underlying mechanics.
Framework-agnostic agent patterns
Regardless of framework choice, production agents need:
- Structured tool definitions - clear schemas for available actions
- Execution loop - reason → act → observe cycle with termination
- Error handling - retry logic, fallbacks, graceful degradation
- Observability - logging every step for debugging and monitoring
- Memory management - context window optimization
- Testing - unit tests for individual tools, integration tests for the loop
These patterns transfer between frameworks. The framework is a convenience, not the architecture.
FAQ
Q: Which framework should I start with as a beginner?
Start with the raw provider SDK (OpenAI Python SDK or Anthropic SDK). Build a simple tool-using agent from scratch. Once you understand the mechanics, move to LangChain for RAG applications or LangGraph for complex agents. The understanding you build with raw SDKs makes framework code intelligible rather than magical.
Q: Frameworks change rapidly. How do I avoid being locked in?
Isolate framework-specific code behind interfaces. Your business logic should not import framework types directly. Define your own tool interface, your own memory interface, and your own agent interface. The framework implements these interfaces. When you need to switch, you replace the implementation, not the architecture.
Q: Is LangChain still relevant? I hear it is over-abstracted.
LangChain v0.1 was over-abstracted. LangChain v0.2+ and LangGraph are significantly better - more composable, less magic. LangGraph specifically is excellent for production agent systems with state machines and complex workflows. The ecosystem (LangSmith for observability, LangServe for deployment) adds genuine value. Evaluate the current version, not the reputation from 2023.
Interview questions
Q: Your team needs to build a production RAG system. One engineer wants LangChain, another wants to build from scratch with the OpenAI SDK. How do you decide?
Evaluate against concrete criteria: (1) Team expertise - if the team knows the raw APIs and the use case is straightforward, custom avoids learning a framework and its quirks. (2) Feature set needed - if you need standard RAG (embed, search, generate), either works. If you need advanced patterns (multi-step retrieval, reranking, hybrid search), LangChain has these built-in vs reimplementing. (3) Timeline - prototype in 1 week favors a framework (pre-built patterns). Production system with 3-month timeline can absorb custom development. (4) Maintenance - who maintains the framework dependency? Breaking changes happen. Custom code is fully in your control. Compromise: use LlamaIndex for the RAG pipeline specifically (it excels here) and keep the rest of the application framework-free. Get the benefit where the framework adds value without global dependency.