Open-Source AI Agent Frameworks
Once you've built a few agents by hand, the same plumbing keeps reappearing: a loop that calls the model, runs the tool it asked for, feeds the result back, and stops when the job is done. Agent frameworks package that plumbing — plus state, memory, and multi-agent coordination — so you write less glue. This page is a durable, provider-neutral map of the main open-source options, what they actually give you, and how to choose. Almost all of them are model-agnostic: they work with Claude, GPT, Gemini, and local open-weight models.
- Know what an agent framework gives you over a hand-rolled loop — and what it doesn't
- Recognize the three archetypes: stateful graphs, role-based crews, and minimal loops
- Use a repeatable procedure to choose one — trading complexity for control
- Remember that these are mostly model-agnostic — the framework rarely locks you to one provider
What an agent framework actually gives you
Strip away the branding and a framework is offering you some subset of four things:
- Orchestration — the control loop. Sequential steps, branches, retries, loops-until-done, and (increasingly) durable execution that survives a crash and resumes where it stopped.
- Tools — a standard way to declare a function the model can call, validate its arguments, run it, and return the result. The same describe→call→execute→return loop you already know from tool use.
- Memory & state — somewhere to keep conversation history, scratchpad facts, and retrieved documents across turns, so the agent isn't amnesiac between steps.
- Multi-agent — patterns for several specialized agents that hand work to each other: a supervisor delegating to workers, or peers collaborating on a task. (Conceptually the same idea as Claude Code's subagents.)
A framework is worth it when you'd otherwise hand-write and maintain all four. It's not worth it when your task is "call the model, run one or two tools, return an answer" — there, the framework is overhead you'll spend time fighting.
The three archetypes
Frameworks differ less than their marketing suggests. There are really three shapes, and most projects are a variation on one:
- Stateful graph / workflow. You model the agent as an explicit graph of nodes and edges (or steps and transitions). Maximum control, inspectable state, good for long-running and human-in-the-loop flows. More to learn up front. → LangGraph, LlamaIndex Workflows.
- Role-based crew. You describe agents by role ("researcher", "writer", "reviewer") and let them collaborate or run a process. Fast to express a multi-agent team; you trade some fine-grained control for the high-level abstraction. → CrewAI, and the conversational multi-agent style of AutoGen.
- Minimal loop / few abstractions. A thin layer over the model's native tool-calling, with handoffs between a few agents and not much else. Easy to read end-to-end, easy to drop. → OpenAI Agents SDK (the production successor to the experimental Swarm), and the plain loop you write yourself.
- Start with the simplest thing that works — often a plain tool-calling loop beats a heavy framework.
A quick tour (verify positioning before you commit)
These are the open projects worth knowing. Named only because each one's real repo was verified; everything volatile lives behind the VerifyNote above.
- LangGraph — a low-level orchestration framework for stateful, long-running agents modeled as graphs; durable execution and human-in-the-loop are first-class. Usable standalone or with the broader LangChain ecosystem. Model-agnostic.
- LlamaIndex — started as a data/RAG framework (connectors, indices, retrieval) and now also ships an event-driven Workflows layer for agents. Strong when your agent is fundamentally retrieval over your documents.
- Microsoft AutoGen — a framework for conversational multi-agent systems. As of mid-2026 it is in maintenance mode; Microsoft directs new projects to a unified successor (Microsoft Agent Framework, merging AutoGen + Semantic Kernel). Check current status before starting.
- CrewAI — a role-based framework: define agents by role and goal, organize them into Crews (autonomous collaboration) or Flows (event-driven control). Fast path to a multi-agent team.
- OpenAI Agents SDK — a deliberately lightweight, few-abstractions framework for multi-agent workflows with handoffs. Despite the name it is provider-agnostic (its docs note support for 100+ LLMs), and it is the production-ready successor to the experimental Swarm.
- The plain agent loop — no framework at all: your own
whileloop around the model's native tool-calling. The right default for simple agents, and the thing every framework above is ultimately wrapping.
How to choose a framework
- One sentence on what the agent does, plus the non-negotiables: latency, cost ceiling, data privacy, whether runs must survive a crash, and whether a human must approve steps.
- If it's one agent calling one or two tools, write a plain loop. Many production agents never need more. Adopt a framework only when you'd otherwise re-implement orchestration, memory, AND multi-agent yourself.
- Long-running / human-in-the-loop / inspectable state → a stateful graph (LangGraph, LlamaIndex Workflows). A team of specialists → a role-based crew (CrewAI). A few agents handing off, kept simple → a minimal loop (OpenAI Agents SDK, or your own).
- Confirm the repo is actively maintained (not in maintenance mode) and that it cleanly supports the model you actually use — Claude, GPT, Gemini, or a local model. Most are provider-neutral; verify, don't assume.
- Build the single hardest step — the tricky tool, the handoff, the resume-after-failure — in two candidates. The abstraction that makes that step readable is your winner.
- Keep your tools and prompts as plain functions and strings, so the framework wraps your logic rather than owning it. Switching frameworks should mean rewiring orchestration, not rewriting everything.
The thing every framework wraps
Before reaching for any library, it helps to see the loop they're all built on. This is the entire idea — model decides, you execute, repeat until done:
# Provider-neutral agent loop — the core every framework wraps.
# `model_call` and `run_tool` are yours; swap in Claude, GPT, Gemini, or a local model.
def agent_loop(task, tools, max_steps=10):
messages = [{"role": "user", "content": task}]
for _ in range(max_steps):
# 1. Ask the model what to do next (it sees the tool schemas).
response = model_call(messages, tools=tools)
# 2. No tool requested → the model is done. Return its answer.
if not response.tool_calls:
return response.text
# 3. Run each requested tool and feed results back in.
messages.append(response.as_message())
for call in response.tool_calls:
result = run_tool(call.name, call.arguments)
messages.append({
"role": "tool",
"tool_call_id": call.id,
"content": result,
})
return "Stopped: hit max_steps without finishing."
If you can read this, you understand what every framework on this page is doing under the hood. Graphs add explicit state and branching; crews add roles and delegation; minimal SDKs add tidy handoffs — but the heartbeat is always this loop.
Minimal agent system prompt (pairs with the loop above)
You are a task-completing agent with access to tools.
Loop:
1. Think briefly about the next single step toward the goal.
2. If a tool would help, call exactly ONE tool with valid arguments.
3. When you have enough to answer, stop calling tools and give the final answer.
Rules:
- Prefer the fewest tool calls that get the job done.
- If a tool fails, read the error and adjust — do not repeat the same call.
- Never invent tool results; use only what tools actually returned.
- If the goal is impossible with the available tools, say so and stop.
Goal: {one-sentence task}A note on hype
No framework here is "the best" — that question is malformed. The graph frameworks win on control and durability; the crew frameworks win on expressing a team quickly; the minimal ones win on readability and low lock-in; and a plain loop wins more often than framework READMEs admit. The right choice is the smallest tool that makes your hardest step clear. As with picking a model, let your own task — not a star count — decide. The same discipline you'd apply with evals applies here: prototype, measure on real cases, keep an exit ramp.
Check yourself
0/3- An agent framework packages orchestration, tools, memory, and multi-agent coordination — adopt one only when you'd otherwise build all four yourself.
- Three archetypes cover the field: stateful graphs (control/durability), role-based crews (fast teams), and minimal loops (readability, low lock-in).
- Almost all of these are model-agnostic — they run on Claude, GPT, Gemini, and local models; verify per project rather than assuming.
- No framework is universally 'best'; pick the smallest tool that makes YOUR hardest step clear, and keep an exit ramp.
- The plain tool-calling loop is the honest default — and it's exactly what every framework wraps.
- Maintenance status changes (e.g. AutoGen → a successor); confirm a project is actively maintained at its own repo before committing.
Sources & further reading
- LangGraph — GitHub — low-level orchestration framework for stateful, long-running agents.
- LangGraph overview — LangChain docs — concepts, durable execution, and human-in-the-loop.
- LangChain — GitHub — the broader ecosystem LangGraph integrates with.
- LlamaIndex — GitHub — data/RAG framework with an event-driven Workflows layer for agents.
- LlamaIndex docs — RAG, query engines, agents, and Workflows.
- Microsoft AutoGen — GitHub — conversational multi-agent framework (check maintenance status).
- Microsoft Agent Framework — GitHub — the unified successor (AutoGen + Semantic Kernel) for building and orchestrating agents.
- CrewAI — GitHub — role-based multi-agent framework with Crews and Flows.
- CrewAI docs — agents, tasks, crews, flows, and tools.
- OpenAI Agents SDK — GitHub — lightweight, provider-agnostic multi-agent framework with handoffs.
- OpenAI Agents SDK docs — the minimal-abstractions agent model.
- OpenAI Swarm — GitHub — the experimental predecessor the Agents SDK replaces (educational, now superseded).
Next
- The provider-neutral way to pick a model → Choosing a Model
- The loop these frameworks wrap → Tool Use
- Multi-agent the Claude Code way → Subagents
- How to hand tasks between agents built on different frameworks → A2A: The Agent-to-Agent Protocol
- How to actually compare candidates → Evals