Agent Frameworks Compared
Building a multi-step LLM agent in raw API calls is doable but quickly becomes a tangle of state management, error handling, and tool routing code. Agent frameworks abstract these concerns. The right framework depends on your workflow complexity, team familiarity, and whether you need single-agent or multi-agent coordination.
What Frameworks Provide
- Tool definition and dispatch (call the right function when the model asks)
- State management across multi-step reasoning loops
- Memory and conversation history management
- Observability and tracing (often via LangSmith or OpenTelemetry)
- Multi-agent coordination (assigning subtasks to specialist agents)
- Retry and error handling for failed tool calls
LangGraph
LangGraph (by LangChain) models agent workflows as directed graphs where nodes are functions and edges are conditional transitions. This gives you explicit, inspectable control flow that standard ReAct loops cannot express - loops, branches, human-in-the-loop checkpoints, and parallel execution.
Strengths
- • Explicit, inspectable state machine
- • Built-in checkpointing for long workflows
- • Strong observability via LangSmith
- • Python and JavaScript SDKs
Weaknesses
- • Steeper learning curve than CrewAI
- • Verbose boilerplate for simple use cases
- • Ties you to the LangChain ecosystem
CrewAI
CrewAI uses a "crew of agents" metaphor - you define agents (each with a role, goal, and backstory), tasks, and a process (sequential or hierarchical). A manager agent can delegate subtasks to specialist agents. The high-level API is significantly more accessible than LangGraph for teams building role-based multi-agent systems.
Best for: Workflows that map naturally to "one agent for research, one for writing, one for review" patterns. The role/goal/backstory metaphor makes prompting intuitive. Less appropriate for complex branching logic.
AutoGen (Microsoft)
AutoGen models agents as actors that communicate via messages. The ConversableAgent abstraction lets two or more agents conduct a dialogue - one asks, another answers, both iterate - until a termination condition is met. Strong for debate, critique, and code review workflows where back-and-forth dialogue produces better results.
AutoGen Studio provides a drag-and-drop interface for building agent workflows, useful for non-engineers who need to configure agent teams.
LlamaIndex Workflows
LlamaIndex's Workflows API defines agents as event-driven functions - steps receive events, do work, and emit new events. This is more explicit than the "crew of agents" metaphor and integrates natively with LlamaIndex's strong RAG and data connectors ecosystem. The best choice if your agent needs sophisticated document retrieval.
Pydantic AI
Released in late 2024, Pydantic AI integrates LLM tool calls with Pydantic type validation. You define tools as typed Python functions; the model calls them, and Pydantic validates the arguments and results. Lightweight, type-safe, and works with any model provider. Ideal for teams already using Pydantic for data validation who want minimal framework overhead.
Framework Selection Guide
| Framework | Best for | Complexity |
|---|---|---|
| LangGraph | Complex workflows with explicit control flow, loops, human-in-loop | High |
| CrewAI | Role-based multi-agent teams, quick prototyping | Low |
| AutoGen | Conversational agents, code generation, debate patterns | Medium |
| LlamaIndex | RAG-heavy agents with rich document retrieval | Medium |
| Pydantic AI | Type-safe single-agent apps, minimal dependencies | Low |
When to Skip Frameworks
For simple single-turn tool use (model calls one function, returns result), raw API tool calling is simpler than any framework. Frameworks add value for multi-step, multi-tool, or multi-agent workflows where state management becomes complex.