AI Agent Framework Comparison: LangGraph vs OpenAI Agents vs PydanticAI vs CrewAI
Part 3 of the AI Agent Tech Stack series. See also: Core Architecture · Design Patterns · Protocol Layer · Production Practices.
1. LangGraph — Stateful Graph Orchestration
LangGraph models agent workflows as stateful directed graphs.
- Cycles & Branching — not limited to DAGs
- Persistence — built-in checkpointing, pause/resume, time-travel debugging
- Human-in-the-loop — insert approval steps between nodes
- Streaming — real-time output per node
Docs: langchain-ai.github.io/langgraph · GitHub
2. OpenAI Agents SDK — Official Agent Framework
OpenAI Agents SDK is minimalist yet complete.
- Agent Loop — built-in ReAct cycle
- Handoffs — seamless delegation between agents
- Guardrails — input/output validators
- Tracing — built-in OpenTelemetry
- MCP — native integration
from agents import Agent, Runner
agent = Agent(
name="Research Assistant",
instructions="You help users research topics.",
tools=[web_search, file_reader],
handoffs=[specialist_agent],
)
result = await Runner.run(agent, "Analyze recent AI trends")
Docs: openai.github.io/openai-agents-python · GitHub
3. PydanticAI — Type-Safe Agents
PydanticAI by the Pydantic team. Core principle: type safety + structured output.
from pydantic_ai import Agent
from pydantic import BaseModel
class CityInfo(BaseModel):
name: str
country: str
population: int
agent = Agent("openai:gpt-4o", output_type=CityInfo)
result = await agent.run("Tell me about Tokyo")
print(result.output.population) # IDE autocomplete works
Docs: ai.pydantic.dev · GitHub
4. CrewAI — Role-Based Collaboration
CrewAI defines teams, not just agents.
from crewai import Agent, Task, Crew
researcher = Agent(role="Researcher", goal="Find latest AI papers", ...)
writer = Agent(role="Writer", goal="Write blog post", ...)
crew = Crew(agents=[researcher, writer], tasks=[task1, task2])
result = crew.kickoff()
Docs: docs.crewai.com · GitHub
5. AutoGen — Conversational Multi-Agent
AutoGen (Microsoft) drives multi-agent collaboration through conversation.
Docs: microsoft.github.io/autogen · GitHub
6. Google ADK — Agent Development Kit
Google ADK tightly integrates with Gemini and Google Cloud.
Docs: google.github.io/adk-docs · GitHub
Comparison Matrix
| Framework | Orchestration | Multi-Agent | MCP | Type Safety | Learning Curve | Best For |
|---|---|---|---|---|---|---|
| LangGraph | State graph | Yes | Yes | Medium | Medium-High | Complex workflows |
| OpenAI Agents | Loop + Handoff | Yes | Yes | Medium | Low | OpenAI ecosystem |
| PydanticAI | Functional | Manual | Yes | Strong | Low | Typed Python apps |
| CrewAI | Role + Task | Core | Yes | Weak | Low | Role collaboration |
| AutoGen | Conversation | Core | Yes | Weak | Medium | Conversational negotiation |
| Google ADK | Functional | Yes | Yes | Medium | Medium | Google ecosystem |
Selection Guide
| Use Case | Recommended | Reason |
|---|---|---|
| Quick prototyping | OpenAI Agents / PydanticAI | Simple API, fast setup |
| Complex multi-step workflows | LangGraph | State graph + persistence + branching |
| Multi-role team automation | CrewAI | Intuitive role definitions |
| Enterprise agent platform | Dify + LangGraph | Visual + code flexibility |
| Type safety priority | PydanticAI | Deep Python type system integration |
| No-code | Dify / Coze / FlowiseAI | Drag-and-drop visual builders |