A technical comparison of 7 frameworks for building production AI agents, with honest trade-offs and code examples
There are too many AI agent frameworks. I've spent the last few months building with most of them at LastMile AI, and here's what I've learned: the "best" framework depends entirely on what you're building and how you want to build it.
This isn't a marketing piece. It's a technical breakdown of what each framework actually does well, where it falls short, and when you should use it.
The Quick Decision Matrix
| Use Case | Framework | Why |
|---|---|---|
| MCP-native development | mcp-agent | Built for MCP from day one |
| Visual debugging | LangGraph | Studio with time-travel debugging |
| Multi-agent conversations | AG2 | Agents coordinate autonomously |
| Type safety | PydanticAI | Full Pydantic validation + A2A support |
| Rapid prototyping | CrewAI | No-code Studio interface |
| OpenAI ecosystem | OpenAI Agents SDK | Native integration, hosted MCP |
| Google Cloud / Vertex AI | Google ADK | Powers Agentspace, bidirectional streaming |
1. mcp-agent
GitHub: lastmile-ai/mcp-agent (~7.7k ⭐) | Python
A framework built specifically for Model Context Protocol. Not an adapter bolted on later—MCP is the foundation.
What It Does Well
- Full MCP implementation — Tools, resources, prompts, notifications, OAuth, sampling, elicitation, roots. The whole spec.
- Automatic durable execution — One config line switches to Temporal. No manual checkpointing, no workflow DSL to learn.
- Implements Anthropic's patterns — Every pattern from Building Effective Agents plus OpenAI's Swarm pattern, all composable.
-
Cloud deployment —
uvx mcp-agent deploy my-agentand you're running on managed infrastructure.
Code Example
from mcp_agent.app import MCPApp
from mcp_agent.agents.agent import Agent
from mcp_agent.workflows.llm.augmented_llm_openai import OpenAIAugmentedLLM
# Temporal-backed durability in one line
app = MCPApp(name="researcher", execution_engine="temporal")
async def main():
async with app.run():
agent = Agent(
name="researcher",
server_names=["brave-search", "filesystem"],
instruction="Research and compile reports"
)
async with agent:
llm = await agent.attach_llm(OpenAIAugmentedLLM)
result = await llm.generate_str("Summarize the latest AI news")
print(result)
Use When
- Building for the MCP ecosystem
- You need durable execution without infrastructure complexity
- You want Temporal reliability for long-running tasks
- You prefer writing Python over graph DSLs
Skip If
- You need visual debugging tools (use LangGraph Studio)
- You're not using MCP servers
2. LangGraph
GitHub: langchain-ai/langgraph (~21.7k ⭐) | Python, JavaScript
Graph-based orchestration with best-in-class visual debugging. LangGraph 1.0 shipped in October 2025—the first stable major release in this space.
What's New in 1.0
- Node/task caching — Cache individual node results to skip redundant computation
- Deferred nodes — Delay execution until all upstream paths complete (great for map-reduce)
- Pre/post model hooks — Add logic before/after model calls for guardrails
- LangGraph Platform GA — 1-click deployment, memory APIs, human-in-the-loop
Code Example
from langgraph.graph import StateGraph
from langgraph.checkpoint.sqlite import SqliteSaver
workflow = StateGraph(AgentState)
workflow.add_node("research", research_function)
workflow.add_node("analyze", analyze_function)
workflow.add_conditional_edges(
"research",
should_continue,
{"analyze": "analyze", "end": END}
)
# Checkpointing for durability
checkpointer = SqliteSaver.from_conn_string(":memory:")
app = workflow.compile(checkpointer=checkpointer)
Use When
- You need visual debugging of workflow execution
- Building complex branching logic
- Your team values explicit state management
- You want mature observability via LangSmith
Skip If
- Simple workflows (LangGraph is overkill)
- You prefer code over graph abstractions
3. AG2 (formerly AutoGen)
GitHub: ag2ai/ag2 (~3.8k ⭐) | Python
Conversational multi-agent framework. This is where it gets complicated: AG2 is the community-driven continuation of AutoGen 0.2, maintained by the original creators who left Microsoft. Microsoft's AutoGen 0.4 is a complete architectural rewrite heading toward Semantic Kernel integration.
Important context: If you're choosing between AG2 and Microsoft's AutoGen, know they're diverging. AG2 keeps the familiar architecture. Microsoft's version is getting a ground-up rewrite with TypeScript support, distributed agents, and deeper Azure integration.
Code Example
from autogen import ConversableAgent, LLMConfig
llm_config = LLMConfig.from_json(path="OAI_CONFIG_LIST")
coder = ConversableAgent(
name="coder",
system_message="You write Python code",
llm_config=llm_config
)
reviewer = ConversableAgent(
name="reviewer",
system_message="You review code quality"
)
result = coder.initiate_chat(reviewer, message="Build a REST API")
Use When
- Multi-agent conversations fit your problem
- You want agents to coordinate autonomously
- You need the no-code AutoGen Studio interface
Skip If
- You need deterministic workflow control
- You want Microsoft ecosystem integration (wait for AutoGen 0.4)
4. PydanticAI
GitHub: pydantic/pydantic-ai | Python
Type-safe agents with Pydantic validation. Built by the Pydantic team—the same validation layer used by OpenAI SDK, Anthropic SDK, LangChain, and basically every Python AI library.
What's New
- A2A (Agent-to-Agent) support — Not just MCP, but Google's agent interoperability protocol too
- Durable execution — Agents preserve progress across API failures and restarts
- Human-in-the-loop approval — Flag tool calls that need approval before proceeding
- Streamed structured outputs — Real-time validation as data generates
Code Example
from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio
class SearchResult(BaseModel):
title: str
url: str
relevance_score: float
server = MCPServerStdio('uv', args=['run', 'mcp-server-fetch'])
agent = Agent(
'openai:gpt-4o',
result_type=SearchResult,
toolsets=[server]
)
result = agent.run_sync('Search for AI framework comparisons')
# result.data is guaranteed to be SearchResult
Use When
- Type safety prevents production bugs in your context
- Building systems requiring schema compliance
- Your team already uses FastAPI/Pydantic
- You need both MCP and A2A protocol support
Skip If
- Type safety isn't a priority for your use case
- You need visual debugging
5. CrewAI
GitHub: crewAIInc/crewAI | Python
Orchestrates agents through Crews (autonomous) and Flows (event-driven). CrewAI has significantly improved their MCP support—it's no longer "limited."
MCP Integration (Updated)
from crewai import Agent, Task, Crew
from crewai.mcp import MCPServerStdio, MCPServerHTTP
research_agent = Agent(
role="Research Analyst",
goal="Find and analyze information",
backstory="Expert researcher with access to multiple data sources",
mcps=[
# String reference for quick setup
"https://mcp.exa.ai/mcp?api_key=your_key",
# Or structured config for full control
MCPServerStdio(
command="python",
args=["local_server.py"],
env={"API_KEY": "your_key"}
)
]
)
crew = Crew(
agents=[research_agent],
tasks=[research_task],
process=Process.sequential
)
result = crew.kickoff()
Use When
- You need both autonomous agents AND workflow control
- Rapid prototyping with CrewAI Studio
- Team includes non-technical members who need the visual builder
Skip If
- You need the deepest MCP-native architecture
6. OpenAI Agents SDK
GitHub: openai/openai-agents-python | Python, JavaScript
OpenAI's official framework, released March 2025. Lightweight and opinionated—provides just enough structure without heavyweight abstractions.
Key Features
- Hosted MCP tools — OpenAI manages the infrastructure, you just point to a URL
- Local MCP servers — Full control when you need it
- Handoffs — Agents delegate to specialized sub-agents
- Guardrails — Enforce constraints on agent behavior
- Built-in tracing — Observability out of the box
Code Example
from agents import Agent, Runner, HostedMCPTool
agent = Agent(
name="Assistant",
tools=[
HostedMCPTool(
tool_config={
"type": "mcp",
"server_label": "gitmcp",
"server_url": "https://gitmcp.io/openai/codex",
"require_approval": "never"
}
)
]
)
result = await Runner.run(agent, "What language is this repo written in?")
print(result.final_output)
Use When
- You're already in the OpenAI ecosystem
- You want hosted MCP without managing infrastructure
- You need handoffs between specialized agents
Skip If
- You need model-agnostic architecture
- You want deeper control over MCP server lifecycle
7. Google ADK (Agent Development Kit)
GitHub: google/adk-python | Python
Google's open-source framework, announced at Cloud NEXT 2025. This is the same framework powering Agentspace and Google Customer Engagement Suite.
Key Features
- Bidirectional streaming — Real-time audio and video with agents
- Model agnostic — Gemini, Vertex AI Model Garden, or any LiteLLM-supported model
- MCP Toolbox for Databases — Pre-built, production-ready tools for BigQuery, AlloyDB, Spanner, Cloud SQL
- A2A Protocol support — Google's agent interoperability standard
Code Example
from google.adk import Agent
from google.adk.tools import MCPToolset
# Connect to MCP server
mcp_tools = MCPToolset.from_server(
command="npx",
args=["-y", "@anthropic/mcp-server-youtube"]
)
agent = Agent(
name="research_agent",
model="gemini-2.0-flash",
tools=[mcp_tools],
instruction="You are a research assistant with YouTube access"
)
response = await agent.generate("Find videos about MCP protocol")
Use When
- You're building on Google Cloud / Vertex AI
- You need bidirectional audio/video streaming
- You want enterprise database integrations out of the box
Skip If
- You're not in the Google ecosystem
- You need the simplest possible setup
Feature Comparison (Updated December 2025)
| Feature | mcp-agent | LangGraph | AG2 | PydanticAI | CrewAI | OpenAI SDK | Google ADK |
|---|---|---|---|---|---|---|---|
| MCP Native | ✅ | Integration | Integration | ✅ | ✅ | ✅ Hosted | ✅ |
| A2A Support | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ✅ |
| Durability | Automatic | Configure | Manual | Automatic | Manual | Manual | Manual |
| Visual Debug | Temporal UI | ✅ Studio | Studio | Logfire | Studio | Tracing | Dev UI |
| Type Safety | Standard | Standard | Standard | ✅ Full | Standard | Standard | Standard |
| No-Code | ❌ | Studio | Studio | ❌ | ✅ Studio | ❌ | ❌ |
| Streaming | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ Bidirectional |
Why MCP Matters in 2025
Model Context Protocol launched in November 2024. Here's where we are now:
Who's adopted it:
- Anthropic — Creator, built into Claude
- OpenAI — Official adoption March 2025, hosted MCP in Agents SDK
- Google — ADK includes MCP Toolbox, full protocol support
- Microsoft — Integrated into Azure AI
- GitHub, Cursor, VS Code — MCP support shipped
- Hundreds of community MCP servers
Native vs. Adapter:
Frameworks built for MCP (mcp-agent, PydanticAI, OpenAI SDK, Google ADK) work directly with the protocol. When new MCP capabilities ship, they work immediately.
Frameworks that added MCP later use adapter layers. They work, but there's an abstraction cost.
The Practical Benefit:
Hundreds of MCP servers exist for filesystems, databases, APIs, and internal tools. Native MCP support means you use them without writing integration code.
Decision Framework
By Use Case
Building with MCP? → mcp-agent (native) or PydanticAI (native + A2A)
Need visual debugging? → LangGraph Studio
Conversational multi-agent? → AG2
Type safety critical? → PydanticAI
Rapid prototyping? → CrewAI Studio
OpenAI ecosystem? → OpenAI Agents SDK
Google Cloud? → Google ADK
By Technical Requirement
Simplest durable execution:
# mcp-agent - one line
app = MCPApp(execution_engine="temporal")
Most control over durability:
# LangGraph - explicit checkpointing
checkpointer = SqliteSaver.from_conn_string(":memory:")
app = workflow.compile(checkpointer=checkpointer)
Complex workflows:
- Graph-based → LangGraph
- Code-based → mcp-agent
- Conversational → AG2
By Team
- Small startup: mcp-agent (less boilerplate) or CrewAI (rapid iteration)
- Enterprise: LangGraph (mature observability) or Google ADK (GCP integration)
- Non-technical stakeholders: CrewAI Studio or AutoGen Studio
Production Considerations
Observability Options
| Framework | Tool | What You Get |
|---|---|---|
| LangGraph | LangSmith | Comprehensive tracing, evals |
| PydanticAI | Logfire | Real-time monitoring, MCP server included |
| mcp-agent | Temporal UI | Execution visibility, workflow debugging |
| CrewAI | Built-in | Monitoring and metrics |
| OpenAI SDK | Built-in tracing | Token usage, latency, errors |
| Google ADK | Cloud Monitoring | GCP-native observability |
What to Track
- Token usage and costs
- Latency per tool call
- Tool call success/failure rates
- Decision paths through workflows
The Bottom Line
If you're starting fresh in 2025:
MCP support matters — Less integration code, better interoperability, future-proof as the protocol evolves
Pick based on your constraints — Team size, existing stack, debugging needs, and whether you need visual tools
Don't over-engineer — If a single agent with a few MCP servers solves your problem, you don't need multi-agent orchestration
The frameworks that will win long-term are the ones building for open protocols (MCP, A2A) rather than proprietary integrations. That's where interoperability lives.
Getting Started
-
mcp-agent: docs.mcp-agent.com |
uvx mcp-agent init - LangGraph: langchain-ai.github.io/langgraph
- AG2: docs.ag2.ai
- PydanticAI: ai.pydantic.dev
- CrewAI: docs.crewai.com
- OpenAI Agents SDK: openai.github.io/openai-agents-python
- Google ADK: google.github.io/adk-docs
Building something with these frameworks? I'd love to hear what's working (or not) — find me on LinkedIn or Twitter/X.
Top comments (0)