Guide · Agent frameworks
How to choose an AI agent framework: archetypes, not leaderboards
“Best agent framework” is the wrong search — frameworks differ by shape, not quality, and the right one depends on what you’re building and who’s building it. This guide walks the decision the way a senior engineer would: whether you need a framework at all, then five archetypes and the criteria that actually separate them. No rankings for hire — just the trade-offs.
Choosing an agent framework is hard for the opposite reason most technical choices are hard: not too little information, but too much of the wrong kind. Every framework has a slick quickstart, a five-line hello-world agent, and a star count that gets quoted as if it were a benchmark. None of that predicts what matters — what it’s like to debug a run that went sideways, how much of the framework’s worldview you have to adopt, and what leaves with you if you ever walk away. The frameworks in our agent-frameworks category aren’t better and worse versions of the same thing; they’re different answers to different questions, and the leaderboard framing hides that.
One scope note before the archetypes: this guide is about the choice. Once you’ve chosen, the build itself — memory, safe execution, orchestration, governance — is its own decision tree, and it lives in our autonomous-agent stack guide. Here we settle one question well: which scaffolding, if any, should sit between your code and the model.
The core decision: do you need a framework at all?
Start with the question the framework landscape would rather you skip. An agent, mechanically, is a loop: call the model, execute the tool it picked, append the result, repeat until done. Modern model APIs handle tool calling natively, and the provider SDKs — the OpenAI Agents SDK, Anthropic’s SDKs (not in our index; they’re the standard external options) — make that loop maybe a hundred lines of code you fully understand. For a single agent with a handful of tools, that is a legitimate, often superior, answer: no dependency churn, no abstraction between you and the prompt, nothing to fight when behavior gets weird.
A framework earns its keep when the loop stops being the hard part. Multi-agent coordination, durable state that survives restarts, streaming through several layers, retries and human-in-the-loop checkpoints, a team that needs shared conventions instead of five bespoke loops — that’s the workload frameworks exist for. The honest test: write the plain loop first, even as a throwaway. If it’s straining, you’ll know exactly which missing piece you’re shopping for, and you’ll evaluate frameworks on that piece instead of on their quickstarts.
If you do need one, the market sorts into five archetypes. Identify yours first; only then compare names within it — cross-archetype comparisons are how teams end up benchmarking a visual canvas against a typed library and learning nothing.
The five archetypes
For each: what it optimizes for, the in-index options, and the one thing that quietly costs you.
1 · Code-first orchestration
The general-purpose center of the market: libraries for wiring models, tools, retrievers, and state into arbitrary applications. LangChain (142k stars) is the incumbent — the largest ecosystem and the most integrations of any framework, which genuinely pays off in a sprawling app that touches many services, at the price of heavier abstraction; much of the serious agent work in its ecosystem now happens in LangGraph, its lower-level graph runtime (not separately in our index). Agno (41k) is the performance-minded alternative — a full-stack take that bundles the framework with a runtime and management layer, closer to “build and operate agents” than “import a library.” Choose this archetype when your agent is one part of a larger application and integration breadth is the constraint.
— the ecosystem that attracts you is powered by abstraction layers you’ll eventually have to see through — budget time to learn what the framework actually sends to the model, or your first subtle production bug will cost you a week.
2 · Multi-agent, role-based
Frameworks whose native unit is the team: agents with roles, goals, and handoffs. CrewAI (56k stars) is the most approachable — you declare a crew and its tasks, and the framework runs the collaboration. AutoGen (60k) is Microsoft’s research-born take on conversation-driven multi-agent systems, with Agent Framework (12k) as its production successor — more on that split in the FAQ. Around them: hive (11k) positions as a production-minded multi-agent harness, IntentKit runs a collaborative agent team as a self-hosted cluster, and SuperAGI (18k) is a dev-first survivor of the 2023 autonomous-agent wave that shaped this whole archetype. Choose it when the work genuinely decomposes into roles — research, draft, review — with checkable intermediate outputs.
— multi-agent is a capability you graduate into, not a starting point — every added agent multiplies token spend and failure modes, and most workloads sold as “a crew” are one agent with better tools.
3 · Lightweight and typed
The reaction to heavyweight orchestration: small, explicit libraries that treat an agent as typed code rather than a configured artifact. Pydantic AI (19k stars), from the team behind Python’s de facto validation layer, is the flagship — schema-validated inputs and outputs, dependency injection, and very little magic between you and the model call. Upsonic (8k) works the same territory. This archetype suits teams that felt the abstraction cost of archetype one firsthand, and production systems where “I can read the whole execution path” is worth more than a plugin catalog. It composes naturally with the write-the-loop-yourself baseline — you get structure without surrendering control.
— fewer batteries is the point, but it means you’ll wire retries, memory, and orchestration yourself — pick this archetype for control, not because it looks like less to learn.
4 · TypeScript-native
Python got the head start, but if your product is a web app and your team ships TypeScript, running agents in the same language and runtime is a real advantage — shared types end to end, no Python sidecar to operate. eliza (19k stars), from the elizaOS project, is the established option: a framework for long-running, persona-driven agents with a deep plugin system. ruflo (65k) is the newer TypeScript-native orchestration framework, growing unusually fast since its 2025 debut. The major provider SDKs also ship first-class TypeScript, so the no-framework baseline from the core decision applies here too. Full trade-off in the FAQ below.
— choose TypeScript because your product and team are TypeScript — not to escape Python. The agent ecosystem’s tooling for eval, retrieval, and reference implementations still lands Python-first, and you’ll feel that gap at the edges.
5 · Visual platform builders
Dify (150k stars) and n8n (197k) get compared to everything above, and the comparison is a category error: they’re platforms where flows live on a visual canvas, not libraries you import. That’s exactly right when non-engineers need to own and edit the automations, or when the job is connecting many SaaS tools with some LLM judgment in the middle — and exactly wrong when an engineering team needs agent logic in version control, code review, and tests. If the canvas is what you actually want, you’ve left framework territory: our workflow-agent stack guide owns that decision, and the workflow-agents category has the full field — evaluate them there, against each other, not against code frameworks.
— a visual platform is a product commitment, not a library choice — there’s no partial adoption and no clean eject, because migrating off a canvas means rebuilding, not refactoring.
The criteria that actually separate them
Within an archetype, the candidates’ feature lists converge fast. These five criteria are what still differ — and they’re roughly in order of how much pain they cause when you get them wrong.
- Abstraction cost. Every abstraction that saves boilerplate in week one charges interest in month three, when you need to know exactly what was sent to the model and the framework is between you and the answer. The test is simple: open the source of the core agent loop and see whether you can follow it. If you can’t, you’re not adopting a tool, you’re adopting a belief system.
- Debuggability. Agents fail probabilistically, so your real interface with a framework is its failure view: can you see the exact prompts, tool calls, and intermediate state of a bad run, and replay it? A framework with first-class tracing beats a “more powerful” one without it, because you’ll spend far more hours diagnosing runs than writing them.
- Ecosystem and momentum. In a field moving this fast, maintainer activity and release cadence matter more than the current feature list — a stalled framework is a liability regardless of stars. But weigh the part of the ecosystem you’ll use: a thousand integrations you don’t need are marketing, and the three you do need are the requirement.
- Migration path. Ask what leaves with you before you commit. Prompts and typed tool definitions port to any framework; orchestration graphs, crew configs, and framework-specific state do not. The frameworks that let your business logic live in plain functions are quietly the safest bet, whatever else differs.
- Language. Framework choice is downstream of language choice, and language choice belongs to your team, not to the agent ecosystem. The debugging-and-iteration loop is where agent projects live or die, and it runs fastest in the language your team ships every day.
The mistakes that sink framework choices
- Choosing by GitHub stars. Stars measure age and marketing reach, not fit. The most-starred framework was optimized for a different builder with a different problem — and the count tells you nothing about what it’s like to debug at 2 a.m.
- Starting with multi-agent. Most jobs are one agent with good tools. Roles, crews, and handoffs multiply failure modes and token spend before they add capability — earn your way to a second agent by proving one agent can’t do it.
- Skipping the no-framework baseline. If you’ve never written the hundred-line loop yourself, you can’t tell which of a framework’s abstractions pay rent and which just add distance between you and the model.
- Ignoring the debugging story. Decide how you’ll inspect a failed run — traces, replays, the exact prompt that was sent — before you commit. A framework without a real observability story turns every production bug into archaeology.
- Confusing frameworks with platforms. A code library and a hosted visual canvas are different commitments with different exits. Comparing Dify to Pydantic AI is comparing a product decision to an architecture decision — settle which one you’re making first.
- Bending your architecture to the framework. The moment you restructure your domain logic to satisfy a framework’s worldview, the dependency has inverted. Keep tools and business logic in plain functions the framework calls — not the other way around.
Which should you pick?
- → no framework, or Pydantic AI for typed structure without the weight.
- → LangChain — its ecosystem is the moat — with Agno as the performance-minded alternative.
- (research → draft → review) → CrewAI first for approachability; hive if production multi-agent operation is the emphasis.
- → Agent Framework for new builds; keep an existing AutoGen system where it is.
- → eliza for persona-driven, long-running agents, or ruflo for orchestration.
- → Dify or n8n — and treat it as the platform decision it is, not a framework pick.
Frequently asked
- Do I need an agent framework at all?
- For a single agent with a handful of tools: honestly, no. Modern model APIs do tool calling natively, and the core loop — call the model, execute the tool it picked, append the result, repeat — is on the order of a hundred lines. Provider SDKs like the OpenAI Agents SDK and Anthropic’s SDKs (not in our index; they’re the standard external options) cover this well. Frameworks earn their keep when you hit multi-agent coordination, durable state across sessions, human-in-the-loop checkpoints, or a team that needs shared conventions. Write the plain loop once even if you then adopt a framework — it’s the baseline that tells you what you’re paying for.
- LangChain vs CrewAI — which should I use?
- They answer different questions. LangChain is general-purpose orchestration with the largest ecosystem of integrations — the safe pick when your app touches many providers, retrievers, and services, at the cost of heavier abstraction. CrewAI is an opinionated multi-agent framework: you define agents with roles, goals, and tasks, and it runs the collaboration. If your mental model of the problem is “a team with roles,” CrewAI gets you there faster; if it’s “a pipeline or graph of steps,” LangChain’s way of thinking fits better. Prototype your hardest flow in both — the one that fights you less is your answer, and no comparison table can make that call for you.
- Python or TypeScript for AI agents?
- Python still has the deeper agent ecosystem — more frameworks, more eval and retrieval tooling, and most reference implementations land there first. But TypeScript is where product and web teams live, it now has credible native frameworks (eliza, ruflo), and the major provider SDKs ship first-class TypeScript. The honest tiebreaker: choose the language your team ships every day. A familiar language with a decent framework beats an unfamiliar language with the “best” one, because the hard part of agents is debugging and iteration speed, not library features.
- Will my framework choice lock me in?
- Less than you fear at the model layer, more than you’d like at the orchestration layer. Nearly every serious framework is model-agnostic, so swapping providers is cheap. What doesn’t port is the orchestration itself: graph definitions, crew configurations, state management, and framework-specific callbacks are rewrites. The insurance is architectural — keep prompts as data, tools as plain functions with typed signatures, and business logic outside the framework’s classes. Do that and a migration is weeks of mechanical work instead of a quarter of untangling.
- What about Microsoft AutoGen and Agent Framework?
- AutoGen is Microsoft’s research-born multi-agent framework and popularized conversation-driven agent collaboration. In late 2025 Microsoft folded AutoGen and Semantic Kernel (not separately in our index) into a production successor, Agent Framework, with first-class Python and .NET support. The practical read: an existing AutoGen system keeps working and doesn’t need a panic migration, but new builds on the Microsoft stack should start on Agent Framework — that’s where the engineering gravity is going. Outside the Microsoft ecosystem, neither is an obvious default over the alternatives.
Primary sources
The official documentation for the frameworks this guide discusses most:
- LangChain — official Python documentation.
- CrewAI — official docs for the role-based-crews framework.
- AutoGen — official docs for Microsoft’s multi-agent framework.
- Pydantic AI — official docs for the type-safe framework.
More stack guides
RAG
How to build a RAG knowledge assistant
Platform or compose-it-yourself, then the seven layers — ingestion, chunking, vector store, retrieval, orchestration, memory, and eval.
Voice
How to build a voice AI agent
Latency is the tyrant. Platform vs compose, then telephony, speech-to-text, the LLM, text-to-speech, turn-taking, and testing.
Coding
How to build a coding agent
Adopt an agent or build your own harness, then the layers — the agent loop, code context, safe execution, the model, memory, and review.
Browser
How to build a browser-automation agent
Perception is the hard part, not clicking. DOM vs vision vs VLA, then the runtime, the driver, the model, planning, and reliability.
Autonomous
How to build an autonomous agent
Autonomy is a control problem, not a capability problem. Adopt, build, or hand-roll — then framework, tools, memory, execution, orchestration, and governance.
MCP
How to build an MCP server
The protocol is trivial; tool design is the craft. Wrap, build, or aggregate — then SDK and transport, tool design, resources, reliability, and distribution.
Self-hosted
The self-hosted agent stack
Run agents on your own infrastructure. What you're actually protecting, the platform, the model question, safe execution, data, and boring ops.
Workflow
How to build AI workflow automation
Most “agents” should be workflows with LLM steps. Triggers, the engine, the LLM step, approval gates, reliability — and when to graduate to an agent loop.