An agent framework is the scaffolding that turns an LLM API call into something that plans, calls tools, and recovers from its own mistakes. Without one, you hand-roll the loop, the state, the retries, and the memory yourself. These five frameworks are all free and open source — and they solve the problem in genuinely different ways.
What a framework actually does for you
At minimum, an agent needs four things: a loop that decides what to do next, tool definitions it can call, memory of what happened so far, and a way to handle failures. A raw API call gives you none of that. A framework gives you the loop, the tool plumbing, persistence, and usually hooks for human approval before risky actions.
The frameworks below are all free to use and self-host. Your real bill is LLM tokens plus compute, which we will cover honestly at the end.
The five frameworks, compared
| Framework | License | Language | Mental model | Learning curve | Best for |
|---|---|---|---|---|---|
| LangGraph | MIT | Python, JS | Graph of nodes and edges | Steep | Stateful, auditable production agents |
| CrewAI | MIT | Python | Role-based crews | Low | Fast multi-agent prototypes with clear roles |
| smolagents | Apache 2.0 | Python | Code-as-action | Very low | Quick prototypes, Hugging Face users |
| AutoGen → Microsoft Agent Framework | MIT | Python, .NET | Conversational agents | Medium | Microsoft/Azure stacks, research agents |
| Pydantic AI | MIT | Python | Typed agents | Low | Type-safe agents with validated output |
1. LangGraph — the production-grade choice
LangGraph, from the LangChain team, models an agent as an explicit state machine: nodes do the work, edges decide what happens next, and a typed state schema flows between them. That explicitness is what makes it the default for production.
Its real advantage is durable execution. Checkpoints can persist state to Redis or Postgres, so an agent survives crashes and can be replayed or inspected step by step. It also has first-class human-in-the-loop support — interrupt() pauses execution until a person approves, which is exactly what you want before an agent sends an email or deletes data.
The trade-off is a steep learning curve: you think in graphs, reducers, and state schemas, not in plain function calls. Observability tooling (LangSmith) starts around $39 per seat per month if you want it, but the framework itself is free. Install with pip install langgraph. Pick LangGraph when the agent must be debuggable, resumable, and auditable — finance, legal, and long-running workflows.
2. CrewAI — the fastest route to a multi-agent team
CrewAI takes the opposite approach: instead of graphs, you define agents by role, goal, and backstory, then hand them tasks. A typical crew has a researcher, a writer, and an editor working in sequence, or a manager delegating hierarchically.
This role-based mental model maps cleanly onto how teams already work, which is why CrewAI has the fastest scaffold time of the five. Setup is a single install — pip install crewai — and a working crew is dozens of lines, not hundreds. The MIT-licensed core is free; the paid tiers only matter if you want their hosted cloud.
The cost of simplicity is control: complex branching logic and fine-grained state management are harder to express than in LangGraph. Pick CrewAI when you need a convincing multi-agent demo fast — research pipelines, content teams, and planning agents are its home turf.
3. smolagents — the minimalist's agent
Hugging Face's smolagents keeps the entire core under roughly 1,000 lines of readable code, which you can audit in an afternoon. Its signature idea is code-as-action: instead of emitting JSON tool calls that a parser interprets, the agent writes actual Python and runs it. Tools are plain functions decorated with @tool.
Model support is flexible: run on the Hugging Face Inference API or point it at a local Ollama server for zero token cost. That combination — tiny core plus local models — makes it the cheapest way to experiment. Install with pip install smolagents.
One serious rule: always run code agents inside a sandbox in production (E2B, Docker, or Modal). An agent that writes and executes Python can do damage if it goes off the rails, and smolagents assumes you handle that boundary. Pick smolagents for weekend prototypes and research agents where speed matters more than orchestration depth.
4. AutoGen and the Microsoft Agent Framework — the enterprise conversational route
Microsoft's AutoGen popularized conversational multi-agent systems: agents debate in group chats, write code, hand it to an execution agent, catch failures, and fix them autonomously. It is strong for exploratory research and code-heavy workflows, and it is the only option here with serious .NET support alongside Python.
Important 2026 caveat: AutoGen itself is feature-frozen and transitioning to the Microsoft Agent Framework (MAF 1.0). If you are starting a new project on the Microsoft stack, target the Agent Framework directly; existing AutoGen projects still run fine but the future investment is in MAF.
Pick this route when your stack is Azure and .NET, or when your agents need conversational negotiation patterns — research assistants that argue with each other before answering.
5. Pydantic AI — type safety for Python agents
Built by the team behind Pydantic, this framework treats agent outputs like API contracts. You define Pydantic models for what the agent must return, and validation failures feed back into the agent so it corrects itself instead of silently emitting garbage JSON.
That makes it the right pick whenever an agent's output feeds another system: structured data extraction, form filling, or agents that hand results to deterministic code. Install with pip install pydantic-ai. It is free, open source, and has the lowest conceptual overhead of any option here once you know Pydantic — which most Python developers already do.
The honest cost math
Every framework on this list costs $0 in license fees. Your actual spending is two things: LLM tokens and the compute running the agent loop. The token part surprises people: an agent that plans, acts, and re-plans can easily burn 5–20 times the tokens of a single chat call for the same answer.
Three levers keep bills sane. First, use small models for routing and tool calls and reserve large models for the reasoning steps that need them. Second, cap the loop — set a maximum step count so a confused agent cannot spend money forever. Third, prototype against a local model with Ollama before pointing any agent at a paid API. None of this is framework-specific; it applies to all five.
How to pick in five minutes
Match the framework to the shape of the job, not to popularity:
- Auditable, resumable, long-running workflows → LangGraph. Checkpointing and human-in-the-loop are built in.
- A multi-agent demo by Friday with clear roles → CrewAI. Role, goal, task — done.
- Fastest prototype, Hugging Face models, local-first → smolagents. Tiny core, code-as-action, sandbox it.
- Azure/.NET stack or conversational research agents → Microsoft Agent Framework (AutoGen's successor).
- Agent output must validate against strict schemas → Pydantic AI. Type safety as the feedback loop.
Start with the cheapest option that fits, and only move to a heavier framework when you feel the pain it solves. Most agents never need more than one of these.

