The best AI agent framework for most beginners is CrewAI. If you need full control over every step, pick LangGraph. You can start every tool on this list for $0. You only pay for the AI model calls, and for hosting later.
Below you get 10 frameworks in order, their real costs, code you can copy, and a simple way to choose. You will also learn when you do not need a framework at all.
Quick answer
- Best for beginners: CrewAI. You describe agents as team roles, and it runs them.
- Most control, best for long tasks: LangGraph. You draw the steps as a graph and it saves progress.
- Simplest if you use OpenAI models: OpenAI Agents SDK. Three building blocks and little else.
- Best for JavaScript and TypeScript: Mastra.
- Best for clean, type-safe Python code: PydanticAI.
What is an AI agent framework?
An AI agent is a program that uses an AI model to decide what to do next. It can search the web, read a file, call an API, or ask another agent for help. It keeps going until the task is done.
An agent framework is a code library that handles the boring parts for you. It keeps the chat history, calls the tools, passes work between agents, and shows you what happened. You still write the goal and the rules.
Do you even need a framework?
Maybe not. For a simple job, plain code is often the better choice. A framework adds layers between your code and the model. Those layers can hide the exact text that goes to the model, and that makes bugs hard to find.
Here is a simple rule:
Skip the framework if
Your agent uses one or two tools in a straight line. A short script and the model’s API can do this in an afternoon.
Use a framework if
You have several agents, need memory, need to pause for a human, or need to resume after a crash.
Learn both
Build one tiny agent by hand first. You will understand every framework faster after that.
How we chose these frameworks
Every tool below is judged on five things:
- Ease of start: how fast a beginner gets a working agent.
- Control: how much you can steer each step.
- Real cost: what you pay besides the model calls.
- Health: license, recent updates and community size.
- Model choice: can you use models from more than one company?
Last updated: September 21, 2026. Star counts and prices change, so check the official site before you pay for anything.
Comparison table
| Framework | Best for | Languages | License | GitHub stars |
|---|---|---|---|---|
| CrewAI | Beginners, team-style agents | Python | MIT | 58.8K |
| LangGraph | Control, long and safe workflows | Python, JavaScript | MIT | 42.1K |
| OpenAI Agents SDK | Simple agents with OpenAI models | Python | MIT | 29.6K |
| Microsoft Agent Framework | Microsoft and .NET teams | Python, .NET | MIT | 13.7K |
| Google ADK | Google Cloud, many languages | Python, TypeScript, Go, Java, Kotlin | Apache 2.0 | 21.6K |
| PydanticAI | Type-safe Python code | Python | MIT | 20.1K |
| smolagents | Learning and small agents | Python | Apache 2.0 | 29.4K |
| LlamaIndex | Agents that read your documents | Python | MIT | 52.3K |
| Mastra | Web apps in TypeScript | TypeScript | Apache 2.0 (self-hosted) | 28.2K |
| Claude Agent SDK | Coding-style agents | Python, TypeScript | Anthropic terms | 8.1K (Python repo) |
The 10 best AI agent frameworks
CrewAI
Best for beginners- Best forFirst multi-agent project
- LanguagePython
- Cost to start$0 (MIT license)
CrewAI treats your agents like a small team. You give each agent a role, a goal and a short backstory. Then you give the team tasks, and CrewAI runs them. A researcher can find facts, and a writer can turn them into a report.
The open-source code is free. CrewAI also sells a cloud platform. Its free Basic plan has a visual editor and a limit of 50 workflow runs per month. The Enterprise plan is custom priced and adds things like single sign-on and private hosting.
The main risk is cost, not code. Agents can loop and burn tokens. The max iteration setting does not always stop a loop, so also set a spending limit on your model account from day one.
Pros
- Very fast to learn
- Easy to read role-based code
- Large community (58.8K stars)
Cons
- Agents can loop and waste tokens
- Less control than a graph tool
- Cloud free plan is only 50 runs a month
LangGraph
Best for control- Best forLong, careful workflows
- LanguagePython, JavaScript
- Cost to start$0 (MIT license)
LangGraph makes you draw your agent as a graph. Each step is a node. Lines between nodes say what happens next. The system saves the state as it goes, so it can pause for a human to approve something and then continue. It can also restart after a crash.
It reached version 1.0 in October 2025. It suits work that must not fail halfway, like approvals or long research jobs. That control has a price: you write more code than in CrewAI, and you need to think in graphs.
The library is free. To host and watch agents, you can use LangSmith, from the same company. The Developer plan is $0 for one seat and includes 5,000 base traces a month. The Plus plan is $39 per seat per month and includes 10,000 base traces and one small serverless deployment.
Pros
- Saves progress and can resume
- Human approval built in
- Works with many model providers
Cons
- Steeper learning curve
- More code for simple jobs
- Paid tools add up for teams
OpenAI Agents SDK
Simplest to start- Best forSimple agents, OpenAI models
- LanguagePython
- Cost to start$0 code, you pay OpenAI for model calls
This SDK is small on purpose. It has three core ideas: agents (a model with instructions and tools), handoffs (one agent passes work to another) and guardrails (checks on inputs and outputs). It also has sessions for memory, tracing, MCP tool support and a way for humans to step in.
It works best with OpenAI models. You can use other providers through adapters such as LiteLLM. Some built-in tools may work only with OpenAI models, so test before you plan around them.
Pros
- Very little code to learn
- Guardrails and tracing included
- Backed by OpenAI
Cons
- Tied closely to OpenAI
- Less help for long, crash-proof jobs
- You still design memory and state
Microsoft Agent Framework
Best for Microsoft teams- Best forPython and .NET teams
- LanguagePython, .NET
- Cost to start$0 (MIT license)
Microsoft Agent Framework is the newer home for Microsoft’s agent work. It supports graph-style workflows, checkpoints, streaming and OpenTelemetry for tracking. You can also set up agents in YAML files. Install it with pip install agent-framework for Python.
It matters for another reason. AutoGen, the older Microsoft project, is now in maintenance mode and gets no new features. New users should start with Microsoft Agent Framework, and there are migration guides from AutoGen and Semantic Kernel.
Pros
- Strong choice for .NET developers
- Checkpoints and tracking built in
- Clear path from AutoGen
Cons
- Smaller community (13.7K stars)
- Fewer beginner tutorials
Google Agent Development Kit (ADK)
Most languages- Best forGoogle Cloud users
- LanguagePython, TypeScript, Go, Java, Kotlin
- Cost to start$0 (Apache 2.0)
ADK supports more languages than any other tool here. Version 2.0 adds graph-based workflows, so you can mix fixed steps with AI decisions. It works with Gemini and with other models. You can run it in a container anywhere, or deploy it to Google Cloud services such as Cloud Run and GKE.
Install it with pip install google-adk for Python. It is a good pick if your team already uses Google Cloud or writes Java or Go.
Pros
- Five languages
- Built-in evaluation and deploy tools
- Works with non-Google models
Cons
- Easiest path is Google Cloud
- Newer, so fewer community examples
PydanticAI
Best for clean Python- Best forDevelopers who like typed code
- LanguagePython
- Cost to start$0 (MIT license)
PydanticAI is made by the team behind Pydantic, the tool many Python developers use to check data. Its idea is simple: the agent’s inputs, tools and outputs are all typed and validated. That catches many mistakes before they reach a user.
You can switch models by changing a text string, and it supports most major providers, including OpenAI, Anthropic, Google, Mistral and Ollama. For long jobs it connects to Temporal, DBOS and Prefect. Their paid tracking product is called Logfire, but it is optional.
Pros
- Typed inputs and outputs
- Easy model switching
- Native OpenTelemetry
Cons
- Python only
- Best if you already know type hints
smolagents
Best for learning- Best forLearning how agents work
- LanguagePython
- Cost to start$0 (Apache 2.0)
smolagents is a Hugging Face library. The main agent logic fits in about one thousand lines of code, so you can read it. Its special idea is the CodeAgent: instead of picking from a list of tools, the agent writes small pieces of Python code to do its actions.
Code that an AI writes can be risky. Run it in a sandbox such as Modal, Blaxel, E2B or Docker. It works with hosted models, models through LiteLLM, and local models. It has fewer production features than the bigger tools, so use it for learning and prototypes first.
Pros
- Tiny and easy to read
- Works with local and hosted models
- Uses MCP and LangChain tools
Cons
- Fewer production features
- Code agents need a sandbox
LlamaIndex
Best for your own documents- Best forAgents that read files and data
- LanguagePython
- Cost to start$0 (MIT license)
LlamaIndex started as a tool to connect AI models to your own data, such as PDFs, databases and notes. That is called RAG. It now also has agent tools, but data is still its strongest side.
The framework is free. The paid part is LlamaCloud, which parses and indexes documents. Its free plan includes 10,000 credits. The Starter plan is $50 per month with 40,000 credits, and Pro is $500 per month with 400,000 credits. 1,000 credits equal $1.25.
Pros
- Best fit for document search
- Large community (52.3K stars)
- Free framework
Cons
- Multi-agent teamwork is not its main strength
- Cloud credits can add up
Mastra
Best for TypeScript- Best forJavaScript and TypeScript developers
- LanguageTypeScript
- Cost to start$0 self-hosted
Most agent tools are Python first. Mastra is built for web developers who work in TypeScript. It gives you agents, workflows and memory, and you can host it anywhere.
The self-hosted version is free under Apache 2.0. Its cloud platform has a free Starter plan with 100,000 observability events and 24 CPU hours. The Teams plan is $250 per month. Extra costs include $0.10 per GB of data leaving the platform and $100 per project for a persistent server that runs all day.
Pros
- Made for the JavaScript world
- Free self-hosting
- Free cloud starter plan
Cons
- Smaller Python-style tutorial base
- Cloud costs rise with usage
Claude Agent SDK
Best for coding-style agents- Best forAgents that use files and commands
- LanguagePython, TypeScript
- Cost to startYou pay for Claude API use
The Claude Agent SDK gives you the same agent loop and tools that power Claude Code, as a library. Built-in tools can read, write and edit files, run commands and search the web. It also has hooks, subagents, MCP support, permissions and sessions.
You sign in with an API key. Anthropic does not allow third-party products to offer claude.ai logins through this SDK. It is built around Claude models, so it is not the tool for mixing many providers.
Pros
- Strong built-in file and command tools
- Subagents and permissions included
- Works with MCP tools
Cons
- Made for Claude models
- Usage costs depend on your API bill
What about LangChain and AutoGen?
You may see both names in older guides, so here is where they stand today.
LangChain
Still the biggest project here, with about 146.8K GitHub stars and an MIT license. It connects to many models and tools. It can feel heavy for simple agents, so beginners often start with something smaller. LangGraph is the part of the family built for agents.
AutoGen
AutoGen is in maintenance mode and community managed. It gets no new features. For new projects, use Microsoft Agent Framework, or another tool from this list.
Your first agent in three frameworks
Seeing the code helps you feel the difference. Each example does one small task. Install the package, set your model API key in your environment, then run the file. Check the official docs if a version has changed.
CrewAI
Python: role-based agent
from crewai import Agent, Task, Crew
researcher = Agent(
role="Researcher",
goal="Find clear facts about {topic}",
backstory="You check facts carefully.",
)
task = Task(
description="Research {topic} and list 3 facts.",
expected_output="Three short facts",
agent=researcher,
)
crew = Crew(agents=[researcher], tasks=[task])
print(crew.kickoff(inputs={"topic": "solar power"}))
OpenAI Agents SDK
Python: three lines of setup
from agents import Agent, Runner agent = Agent(name="Helper", instructions="Answer in one short sentence.") result = Runner.run_sync(agent, "What is an AI agent?") print(result.final_output)
smolagents
Python: an agent that writes code (from the official docs)
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
model = InferenceClientModel()
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
print(agent.run("What is the current weather in Paris?"))
Tip
Run your first agent with a cheap model and a small task. Watch the token use before you give it more tools.
From beginner to advanced: a simple path
Week 1: build one agent by hand
Write a script that calls a model and one tool. No framework. You will see what a framework does for you.
Week 2: try one easy framework
Rebuild the same agent in CrewAI, the OpenAI Agents SDK or smolagents. Compare how much code you wrote.
Month 2: add memory, tools and limits
Add a tool that reads a file, add a cap on steps and cost, and log what the agent does.
Month 3 and after: add control
Move to LangGraph, PydanticAI or Microsoft Agent Framework when you need saved state, human approval, tests and tracing.
Which AI agent framework should you pick?
| If you… | Pick |
|---|---|
| Are new and want a working team of agents fast | CrewAI |
| Need to pause for a human, or resume after a crash | LangGraph |
| Already use OpenAI and want the least code | OpenAI Agents SDK |
| Work in a .NET or Microsoft company | Microsoft Agent Framework |
| Deploy on Google Cloud, or write Java, Go or Kotlin | Google ADK |
| Want type-safe code and easy model switching | PydanticAI |
| Want to learn how agents work inside | smolagents |
| Need agents to search your own documents | LlamaIndex |
| Build web apps in TypeScript | Mastra |
| Want an agent that edits files and runs commands | Claude Agent SDK |
Best pick for students and learners
Start with smolagents or CrewAI. Both are free and short. With smolagents you can read the whole agent loop. With CrewAI you get a useful demo fast. Use a small, cheap model so mistakes cost cents.
Best pick for business teams
For work that must be safe and repeatable, look at LangGraph, Microsoft Agent Framework or Google ADK. They give you saved state, human approval, and tracking. Pick the one that matches the cloud and language your team already uses. For agents that answer questions about company files, add LlamaIndex.
What AI agents really cost
The frameworks are free. The bills come from three places: model calls, hosting, and the tracking tools around them.
| Tool | Free option | Paid option |
|---|---|---|
| CrewAI cloud | Basic: 50 workflow runs a month | Enterprise: custom price |
| LangSmith (for LangGraph) | Developer: $0, 1 seat, 5,000 base traces | Plus: $39 per seat per month, 10,000 base traces |
| LlamaCloud | 10,000 credits | Starter $50 per month, Pro $500 per month |
| Mastra cloud | Starter: free, 100,000 events | Teams: $250 per month |
| OpenAI, Claude, Gemini and others | Depends on the model | You pay per token used |
Watch out for loops
An agent that keeps retrying can spend real money. Loops can happen in any framework, and a max iteration setting does not always stop them. Set a limit on steps in your code and a spending limit on your model account.
Common mistakes to avoid
- Starting with the most complex tool. Begin with a simple one. You can move later.
- Giving an agent too many tools. More tools mean more wrong choices. Start with two or three.
- Skipping step limits. Always cap loops and retries.
- Trusting the output blindly. Add a check, especially before an agent sends an email or changes data.
- Locking into one model. Test with a cheaper model and keep your code easy to switch.
What to expect once you start building
These are the lessons that save the most time and money.
- Many “agents” are really fixed workflows with an AI step. That is fine. Fixed steps are cheaper and easier to test. Give the model freedom only where the task needs it.
- Turn on tracing early. Layers hide the exact text sent to the model. When an answer looks wrong, you need to see that text.
- Keep the first version small. One agent, two tools, one clear goal. Add more only after it works.
- Frameworks change fast. Pin your package versions, and read the release notes before you update.
Learn the basics first, use a framework when the job grows, and always keep a way to see every step.
Our pick
For most beginners, start with CrewAI, or with smolagents if you want to learn what happens inside. When your agent needs saved progress, human approval or strict control, move to LangGraph. Use the OpenAI Agents SDK if you already live in OpenAI, Mastra for TypeScript, and Microsoft Agent Framework or Google ADK if your company runs on those clouds. Whatever you choose, set step and cost limits on day one.
Frequently asked questions
What is the best AI agent framework for beginners?
CrewAI is the easiest start for most people, because you describe agents as team roles. smolagents is a great second choice if you want to learn how agents work.
Is LangGraph better than CrewAI?
They fit different jobs. LangGraph gives more control and can save and resume work, but takes more effort. CrewAI is faster to learn but has less control.
Do I need LangChain to build an AI agent?
No. Many tools here, such as CrewAI, the OpenAI Agents SDK and smolagents, work without it. LangGraph comes from the same company but you can use it on its own.
Is AutoGen still maintained?
AutoGen is in maintenance mode and community managed, with no new features. New users should start with Microsoft Agent Framework.
Are AI agent frameworks free?
The code is free for the tools in this list, though the Claude Agent SDK runs under Anthropic’s terms. You still pay for model calls, and you may pay for cloud hosting and tracking tools.
Can I use these with models that are not from OpenAI?
Yes for most of them. LangGraph, PydanticAI, smolagents, CrewAI and Google ADK support many providers. The OpenAI Agents SDK works with other models through adapters. The Claude Agent SDK is built around Claude models.