Guide

How to Choose an Agent Framework

The agent framework landscape has fragmented fast. This guide maps common requirements to specific frameworks so you can narrow down candidates before reading documentation or running benchmarks.

Five questions to narrow your choice

1

What is your primary language?

Most frameworks support Python. For TypeScript: LangChain, LangGraph, LlamaIndex, OpenAI Agents, Vercel AI SDK, Mastra, A2A Protocol. For C#/.NET: Semantic Kernel, AutoGen.

2

Do you need multiple agents working together?

Yes — consider CrewAI (role-based), AutoGen (conversation-based), LangGraph (graph-based), or Google ADK. No — start with LangChain, OpenAI Agents SDK, or PydanticAI.

3

Is retrieval (RAG) your core feature?

Yes — LlamaIndex or Haystack. Both are built around ingestion and retrieval pipelines with strong evaluation utilities.

4

Are you locked to a specific LLM provider?

OpenAI: OpenAI Agents SDK or Swarm. Anthropic: Claude Code SDK. Google: Google ADK. Any provider: LangChain, PydanticAI, LlamaIndex, CrewAI.

5

How much abstraction do you want?

Low abstraction: PydanticAI, smolagents, Instructor, OpenAI Swarm, Vercel AI SDK. Medium: CrewAI, OpenAI Agents SDK, Mastra. High: LangChain, LangGraph, Semantic Kernel.

If you need X, use Y

Use-case to framework mappings based on features, community adoption, and design philosophy.

If you need

General-purpose agents with tool calling

Primary

LangChain

Why / Alternatives

Broadest ecosystem, most integrations, extensive documentation. Good default if you are unsure.

If you need

Multi-agent collaboration with role definitions

Primary

CrewAI

Why / Alternatives

Role-based agents with natural delegation semantics. Easy to understand and extend for team-structured tasks.

If you need

Stateful graph-based orchestration

Primary

LangGraph

Why / Alternatives

Directed graphs with conditional edges and checkpointing. Best when you need precise control over agent state transitions.

If you need

RAG pipelines and document retrieval

Primary

LlamaIndex

Why / Alternatives

Purpose-built for ingestion, indexing, and retrieval. Advanced RAG patterns, query engines, and evaluation utilities.

If you need

Enterprise .NET / C# integration

Why / Alternatives

First-class C#, Python, and Java support. Designed for enterprise integration with plugins, planners, and Azure OpenAI.

If you need

Minimal abstraction, type-safe agents

Primary

PydanticAI

Why / Alternatives

Pydantic-native structured output with dependency injection. Ideal if you want control without heavy abstractions.

If you need

Code-executing agents

Primary

smolagents

Why / Alternatives

Agents write and execute Python code rather than JSON tool calls. Effective for tasks that benefit from programmatic reasoning.

If you need

Web browsing and computer use

Why / Alternatives

Purpose-built for autonomous web navigation with vision and DOM interaction modes.

If you need

Long-term memory and persistent state

Why / Alternatives

Virtual context management for maintaining state across long conversations. Self-editing memory blocks.

If you need

Official OpenAI model integration

Why / Alternatives

Official SDK with native handoffs, guardrails, and tracing. Lightweight and opinionated — best if you are committed to OpenAI.

If you need

Google Gemini / Cloud deployment

Primary

Google ADK

Why / Alternatives

First-class Gemini integration with session management and Cloud Run deployment. Evaluation tools included.

If you need

Anthropic Claude, agentic workflows

Why / Alternatives

Programmatic access to Claude with computer use, extended thinking, and MCP integration. Best for Claude-native workflows.

If you need

Full-stack TypeScript agents

Primary

Mastra

Why / Alternatives

TypeScript-native with built-in workflows, RAG, evals, and integrations. Stays in the TS ecosystem end to end without Python dependencies.

If you need

React/Next.js streaming AI UI

Why / Alternatives

Purpose-built for React and Next.js with streaming UI hooks, generative UI, and edge runtime support. Unified provider interface for any LLM.

If you need

Prompt engineering and optimization

Primary

DSPy

Why / Alternatives

Programmatic prompt optimization with compile-time tuning. Replaces manual prompt engineering with modular, optimizable signatures.

General guidance

Start with LangChain if you are unsure. It has the largest community, most integrations, and most Stack Overflow answers. You can always migrate specific components to a more focused framework later.

GitHub stars are a lagging indicator. Newer frameworks like PydanticAI and smolagents have lower star counts but are actively maintained with strong design principles. Check commit frequency and issue response times alongside stars.

Test installation before committing. Several frameworks have heavy dependency trees. Run pip install --dry-run and check for conflicts with your existing stack.

Observability matters at scale. LangChain (LangSmith), LangGraph (LangSmith), Agno (built-in monitoring), and OpenAI Agents SDK (built-in tracing) have first-party observability. Others require third-party tools like Langfuse or Weights and Biases.