# Framework Comparison & Decision Guide

Choosing the right agent framework for your use case.

---

## Quick Decision Matrix

| If you need... | Choose |
|---|---|
| **Production-grade, stateful, complex control flow** | **LangGraph** |
| **Multi-agent conversations, Microsoft ecosystem** | **AutoGen** |
| **Role-based crews, process-driven, quick start** | **CrewAI** |
| **Type-safe, structured outputs, Pydantic-native** | **PydanticAI** |
| **OpenAI ecosystem, handoffs, guardrails, desktop control** | **OpenAI Agents SDK** |
| **LlamaIndex integration, RAG + agents** | **LlamaIndex Agents** |
| **Microsoft enterprise, semantic skills, planners** | **Semantic Kernel** |
| **Experimental, research, fringe ideas** | **Fringe: MetaGPT, CAMEL, SuperAGI** |
| **Minimal, custom, no framework** | **Build your own (Core Abstractions)** |

---

## Detailed Comparison

| Dimension | LangGraph | AutoGen | CrewAI | PydanticAI | OpenAI Agents SDK | LlamaIndex Agents |
|---|---|---|---|---|---|---|
| **Core Abstraction** | Stateful Graph | Conversation | Role-based Crew | Structured Agent | Handoffs + Tools | Query Engine + Agent |
| **Control Flow** | DAG, cycles, conditional | Conversation turns | Sequential/Hierarchical | Function calling | Handoffs + Tools | Workflow + Agent |
| **State Management** | ✅ Built-in checkpointing | ❌ Manual | ❌ Manual | ⚠️ Via deps | ✅ Threads | ⚠️ Via memory |
| **Human-in-Loop** | ✅ `interrupt()` native | ✅ UserProxyAgent | ✅ Human tools | ✅ Validators | ✅ Guardrails | ⚠️ Limited |
| **Streaming** | ✅ Native | ❌ | ❌ | ✅ Native | ✅ Native | ✅ Native |
| **Multi-Agent** | ✅ Subgraphs, send() | ✅ GroupChat | ✅ Crews | ⚠️ Via deps | ✅ Handoffs | ✅ Multi-agent |
| **Observability** | ✅ LangSmith native | ✅ AgentOps | ✅ Built-in | ⚠️ Manual | ✅ Tracing native | ✅ LlamaTrace |
| **Type Safety** | ⚠️ TypedDict | ⚠️ TypedDict | ❌ | ✅ Pydantic v2 | ✅ Pydantic | ✅ Pydantic |
| **Deployment** | LangGraph Platform, Docker | Docker, Azure | Docker, Cloud | Any (FastAPI) | OpenAI Platform | LlamaCloud, Docker |
| **Learning Curve** | Medium | Medium-High | Low | Low | Low | Medium |
| **License** | MIT (core), Commercial (Platform) | MIT | MIT | MIT | MIT | MIT (core), Commercial (Cloud) |

---

## By Use Case

### Production Web Services
| Priority | Framework | Why |
|---|---|---|
| **Reliability, debugging, audit** | LangGraph | Checkpointing, time-travel, LangSmith |
| **Type safety, validation** | PydanticAI | Pydantic v2, structured outputs |
| **OpenAI integration** | OpenAI Agents SDK | Native Responses API, guardrails |

### Multi-Agent Systems
| Pattern | Framework | Why |
|---|---|---|
| **Conversational, collaborative** | AutoGen | GroupChat, nested chats |
| **Role-based, process-driven** | CrewAI | Roles, tasks, crews, processes |
| **Hierarchical, graph-based** | LangGraph | Subgraphs, `send()` to agents |
| **Handoff-based** | OpenAI Agents SDK | Native handoffs, agents-as-tools |

### RAG + Agents
| Need | Framework |
|---|---|
| **RAG-first, agent-second** | LlamaIndex Agents |
| **Agent-first, RAG as tool** | LangGraph / PydanticAI |
| **Multi-agent RAG** | AutoGen (retriever agent + writer agent) |

### Rapid Prototyping
| Speed | Framework |
|---|---|
| **Fastest to first agent** | CrewAI / OpenAI Agents SDK |
| **Fastest to production** | PydanticAI / OpenAI Agents SDK |
| **Most flexible** | LangGraph |

### Research / Experimentation
| Focus | Framework |
|---|---|
| **Novel architectures** | Build custom (Core Abstractions) |
| **Multi-agent emergence** | AutoGen / CAMEL / MetaGPT |
| **Cognitive architectures** | Custom + LangGraph control flow |

---

## Migration Paths

| From | To | Effort | Notes |
|---|---|---|---|
| **LangChain Agents** | LangGraph | Low | Direct migration path |
| **AutoGen 0.2** | AutoGen 0.4 | Medium | Breaking changes |
| **CrewAI** | LangGraph | Medium | Rewrite control flow as graph |
| **Custom** | LangGraph | Low-Medium | Wrap as nodes |
| **Any** | PydanticAI | Medium | Rewrite as structured agents |
| **Any** | OpenAI Agents SDK | Medium | Rewrite tools, use handoffs |

---

## Framework Ecosystem

### LangGraph Ecosystem
```
LangGraph Core (MIT)
├── LangGraph Platform (Commercial)  ← Hosted, scaling, auth
├── LangSmith (Commercial)           ← Observability, eval, datasets
├── LangServe (MIT)                  ← API deployment
├── LangChain (MIT)                  ← Tools, integrations
└── Community extensions             ← Templates, patterns
```

### AutoGen Ecosystem
```
AutoGen Core (MIT)
├── AutoGen Studio (MIT)             ← No-code UI
├── Magentic-One (MIT)               ← Generalist multi-agent
├── AgentEval (MIT)                  ← Evaluation
├── AutoGen Bench (MIT)              ← Benchmarks
└── Extensions                       ← Teams, Teachable, etc.
```

### CrewAI Ecosystem
```
CrewAI Core (MIT)
├── CrewAI Enterprise (Commercial)   ← Hosted, RBAC, audit
├── CrewAI Flows (MIT)               ← Structured processes
├── CrewAI Templates (MIT)           ← Pre-built crews
└── Integrations                     ← Tools, LLMs
```

---

## Decision Checklist

Before choosing, answer:

- [ ] **State persistence needed?** → LangGraph, OpenAI Agents SDK
- [ ] **Multi-agent conversations?** → AutoGen, CrewAI
- [ ] **Type-safe outputs critical?** → PydanticAI, OpenAI Agents SDK
- [ ] **RAG is primary, agent secondary?** → LlamaIndex Agents
- [ ] **Microsoft/enterprise stack?** → AutoGen, Semantic Kernel
- [ ] **OpenAI ecosystem lock-in OK?** → OpenAI Agents SDK
- [ ] **Need hosted platform?** → LangGraph Platform, CrewAI Enterprise, LlamaCloud
- [ ] **Team knows Pydantic/FastAPI?** → PydanticAI, LangGraph
- [ ] **Team knows LangChain?** → LangGraph (smooth transition)
- [ ] **Rapid prototype, then maybe rewrite?** → CrewAI → LangGraph

---

## Anti-Patterns

| Anti-Pattern | Fix |
|---|---|
| **Framework hopping** | Pick one, go deep; migrate only when pain exceeds cost |
| **Over-engineering simple tasks** | Use raw LLM + tools for simple; frameworks for complex |
| **Ignoring state** | Every production agent needs checkpointing |
| **No observability** | Instrument from day one (LangSmith, AgentOps, custom) |
| **Framework as crutch** | Understand Core Abstractions first |

---

## Related Notes

- [[Frameworks/LangGraph.md]] — Deep dive
- [[Frameworks/AutoGen.md]] — Deep dive
- [[Frameworks/CrewAI.md]] — Deep dive
- [[Frameworks/PydanticAI.md]] — Deep dive
- [[Frameworks/OpenAI-Agents-SDK.md]] — Deep dive
- [[Frameworks/LlamaIndex-Agents.md]] — Deep dive
- [[Frameworks/Semantic-Kernel.md]] — Deep dive
- [[Frameworks/Fringe-Frameworks.md]] — Experimental
- [[Frameworks/AgentKit.md]] — LangChain's runtime
- [[Architectures/Control-Flow.md]] — Control flow patterns
- [[StateManagement/Checkpointing.md]] — State persistence
- [[Production/Observability.md]] — Observability integration

---

*Sources: Framework documentation, GitHub repos, benchmark papers (AgentBench, SWE-bench), production case studies, framework Discord communities, migration guides, licensing pages.*