SpendLens AILens on AI spend
← All articles
open source ai agent frameworkai agentslanggraphcrewaillm cost optimization

Top 10 Open Source AI Agent Frameworks for 2026

Explore the top 10 open source AI agent frameworks for 2026. Compare LangGraph, CrewAI, MAF, and more to build reliable, cost-effective AI agents.

By SpendLens AI19 min read

Building a demo AI agent is easy. Building one that doesn't burn cash is hard. Too many teams still choose an open source AI agent framework by reading feature lists and watching a polished demo, then discover the true cost later, after retries stack up, tool calls multiply, and nobody can explain the invoice. The practical question isn't which framework looks smartest in a notebook, it's which one helps engineering and FinOps teams ship something reliable, observable, and affordable.

The category is already moving well beyond hobbyist use. Independent 2026 rankings show LangGraph at about 33.9k GitHub stars and 34.5 million monthly downloads, while LangChain sits at 116.74k stars and CrewAI at 37.67k stars in the same ecosystem ranking, which is a strong signal that this space has real production momentum (Firecrawl's 2026 open-source agent framework ranking). Another 2026 landscape report says 57% of organizations now have AI agents in production, rising from 51% the year before, and 67% among enterprises with 10,000+ employees, which tells you this is no longer a side experiment (Firecrawl's 2026 market landscape summary).

Table of Contents

1. LangGraph by LangChain

LangGraph is usually the first serious stop for teams that want stateful, inspectable agent workflows rather than loose loops. The graph model takes more thought up front, but it pays off when you need branching, retries, memory, checkpoints, and human-in-the-loop recovery that won't collapse under production pressure. Its ecosystem matters too, because the broader LangChain family is still one of the most visible anchors in the category, and that makes hiring, examples, and troubleshooting much easier.

LangGraph

The financial upside here is less about raw token reduction and more about avoiding waste from bad orchestration. A flaky agent loop can burn time in debugging and extra model calls, while a graph-based runtime gives you a clearer path to isolate where spend is happening. If you're pairing framework choice with cost control, this is also where instrumentation starts paying for itself, because visible state transitions make it much easier to attribute spend to a step, a tool, or a workflow.

Practical rule: If your team can't explain where the agent loop spends tokens, it's too early to optimize the prompt.

LangGraph also plays well with many model providers, so engineering teams can switch models when pricing or quality changes. That flexibility matters for FinOps, because model choice is one of the fastest levers for controlling monthly spend without rewriting the whole app. For a broader cost-tracking workflow around LLM usage, the internal guidance at SpendLens AI's LLM cost analysis guide fits naturally alongside LangGraph because both push teams toward measurable workload attribution.

2. Microsoft Agent Framework MAF

Microsoft Agent Framework is the clearest sign that open-source agent stacks are moving from experimentation to enterprise operating model. Microsoft says it was created by converging Semantic Kernel and AutoGen into a single pro-code SDK, which is a meaningful design choice because it reduces framework fragmentation for teams already split across those two stacks (Microsoft release materials). Microsoft also says the framework is designed for production-grade AI agents and multi-agent workflows, with support across Python and .NET and integration with Microsoft Foundry, Azure OpenAI, OpenAI, and the GitHub Copilot SDK (GitHub repository).

Microsoft Agent Framework

The operational value is not just language support, it's the path to production. Microsoft's documentation and package instructions show a minimal install path, with pip for Python and dotnet add package for .NET, which lowers the barrier to quick prototyping before a team commits to a bigger runtime decision (InfoQ coverage of package installation). That's valuable when platform engineers want to test orchestration overhead without spending weeks on scaffolding.

The cost angle is straightforward. A team can prototype with provider SDKs they already know, keep the framework as the orchestration layer, and instrument spend before agent sprawl gets out of hand. If your organization is already on Azure or has a .NET-heavy estate, that can save weeks of refactoring and reduce the chance of building a parallel agent platform nobody wants to maintain.

Operational takeaway: Microsoft Agent Framework makes the most sense when governance, observability, and migration risk matter more than minimal abstraction.

3. CrewAI

CrewAI is a practical choice for teams that need role-based multi-agent collaboration without designing every interaction from zero. The appeal is straightforward. You assign roles such as planner, researcher, and executor, then let the crew work toward one goal. For workflows that naturally split into specialist tasks, that can cut a build that would otherwise take weeks down to something a team can prototype in a few days.

CrewAI

The trade-off is that the abstraction can hide waste. When agents disagree, hand work off too often, or repeat steps, token usage climbs fast and debugging becomes tedious. In practice, I would only use CrewAI when the workflow really benefits from delegated roles and the team is disciplined enough to trace every step. If you care about spend control, start by mapping each role to its own cost center and compare the planner's calls with the executor's. That makes it easier to see whether the “research” role is producing useful work or just adding to the bill.

Where CrewAI earns its keep

  • Fast prototyping: Teams can get a multi-agent workflow running quickly, which saves calendar time early in a project.
  • Ready-made tool ecosystem: The built-in catalog reduces glue code for web, code, and database tasks.
  • Lower coordination overhead: High-level abstractions remove a lot of boilerplate from role-based collaboration.

For cost tracking, instrument each role separately and watch where calls cluster. That gives engineering and FinOps a clear view of which agent is creating value and which one is only increasing runtime. A similar cost-first mindset shows up in SpendLens AI's endpoint monitoring guidance, which is useful when agent behavior maps to specific API-backed features.

5. LlamaIndex Agents and Workflows

LlamaIndex fits best when the agent has to operate on enterprise data, documents, and retrieval-heavy pipelines. Its agent and workflow model goes beyond a simple chat loop, and that matters when the product promise depends on reading, retrieving, transforming, and acting on large corpora. If the agent is mostly a knowledge worker, LlamaIndex is often the more practical starting point than a generic orchestration library.

The economics are strongest when time to value matters. Teams usually spend less time wiring loaders, retrievers, OCR, and evaluation tooling because the project already centers on those problems. That shortens the path from prototype to something the business can test, especially for internal search, support, or document-processing use cases.

For teams that want to track cost, the useful move is to instrument the retrieval layer, the model layer, and the workflow layer separately. That makes it easier to see whether spend is going into document ingestion, repeated retrieval calls, or the generation step itself. If your agents rely on multiple language models for different tasks, the LLM cost tracking workflow should be part of the design from the start, not an afterthought bolted on after usage spikes.

Practical strengths

  • Data-first workflows: The framework is built around retrieval and knowledge access, not just tool calling.
  • Structured orchestration: Workflows handle event-driven interactions more cleanly than ad hoc scripts.
  • Optional commercial support: Teams that want a path to managed services can keep that option open.
  • Useful cost visibility: Retrieval-heavy systems are easier to break into measurable stages, which helps both engineering and FinOps explain where tokens and runtime are going.

The trade-off is weight. The dependency footprint is heavier than minimal libraries, and some teams will feel that in setup time, upgrade friction, and local development speed. If your use case is a narrow agent embedded in a service, that overhead can be hard to justify. If your use case is document-heavy and retrieval-driven, the extra structure often pays for itself in fewer custom integrations and clearer production behavior.

A practical way to evaluate it is to compare ingestion cost against runtime cost. If most of your spend sits in retrieval, chunking, or OCR, LlamaIndex gives you more surface area to control it. If most of your spend sits in generation, the framework choice matters less than your model routing, prompt design, and cache strategy.

5. LlamaIndex Agents and Workflows

LlamaIndex is the strongest fit when the agent's job is to work over enterprise data, documents, and retrieval-heavy pipelines. Its agent and workflow story is broader than a simple chat loop, and that matters when the product promise depends on reading, retrieving, transforming, and acting on large corpora. In other words, if your agent is mostly a knowledge worker, LlamaIndex is often the more practical starting point than a generic orchestration library.

The economics are strong when you measure time to value. Teams usually spend less time wiring loaders, retrievers, OCR, and evaluation tooling because the project already leans into those problems. That can shorten the path from prototype to something the business can test, especially for internal search, support, or document-processing use cases.

Practical strengths

  • Data-first workflows: The framework is designed around retrieval and knowledge access, not just tool calling.
  • Structured orchestration: Workflows help manage event-driven interactions more cleanly than ad hoc scripts.
  • Optional commercial support: Teams that want a path to managed services can keep that option open.

The drawback is weight. The dependency footprint is heavier than minimal libraries, and some advanced tooling lives in paid or managed offerings. That means your engineering team should compare the cost of adoption against the savings from faster delivery, not assume “open source” automatically means cheap. If you're classifying where spend goes inside retrieval-heavy AI systems, SpendLens AI's LLM monitoring page is a useful companion because it focuses on workload attribution instead of generic model spend.

6. OpenAI Swarm

OpenAI Swarm fits teams that want the agent layer to stay small, readable, and easy to reason about. That matters in production, because a thin framework is easier to audit, easier to debug, and less likely to hide expensive behavior behind layers of abstraction. If you are embedding agent behavior into an existing service, Swarm keeps the integration surface narrow.

The trade-off is straightforward. Swarm gives you a limited set of coordination primitives, but it does not try to cover the full production stack, so you do not get richer lifecycle management, deeper memory, or broad governance workflows out of the box. In practice, that pushes more engineering work back onto your team, since you have to assemble the missing pieces yourself.

Practical rule: Use Swarm when you want control and low overhead. Do not pick it if you want a finished orchestration platform.

That can still be the right choice for a narrow internal workflow or a product feature with a well-defined scope. You avoid unnecessary abstraction, which keeps the codebase smaller and makes the agent easier to modify when prompts, tools, or routing logic change. The bill stays more predictable at the start because you are not paying for a heavy framework layer you may not need.

The downside shows up later if the agent becomes customer-facing and long-lived. Missing batteries turn into custom tooling, more maintenance, and more chances for hidden spend in retries, logging, and hand-built guardrails. For engineering teams, that means Swarm is best treated as a clean starting point, not a shortcut to a mature platform.

The OpenAI Swarm repository is the place to inspect the structure before you commit to it, because with Swarm the code is the product in a very direct way. For teams trying to keep initial model spend low while they prototype, SpendLens AI's cost-conscious API guide is a useful companion when you are deciding how to watch usage before it grows into a bigger operational cost.

7. Hugging Face smolagents

smolagents is what many teams wish their first agent library had been, small, direct, and easy to read. It has a very low surface area, and that makes it a strong choice for experimentation or for adding a modest agent loop to an existing app without adopting a heavyweight framework. The ToolCallingAgent and CodeAgent patterns give you enough structure to do useful work, but not so much that the framework starts dictating your architecture.

That simplicity can translate into time saved during prototyping because developers understand the flow quickly. It also helps if you're worried about lock-in, since the minimal API makes it easier to swap components later. The trade-off is that the project is still marked experimental, so APIs may change and the ecosystem is smaller than LangChain or LlamaIndex.

Best fit and caution

  • Best fit: Lightweight experimentation, proof-of-concepts, and small embedded agent flows.
  • Cost benefit: Less framework overhead means fewer moving parts to pay for in code and operations.
  • Caution: Experimental APIs can create future maintenance work if you build too much around them.

For teams that care about keeping the initial bill under control, the appeal is obvious. You can try agent behavior without committing to a sprawling runtime, then decide whether the feature deserves a deeper investment. If that early prototype graduates into production, the instrument-and-measure discipline used in SpendLens AI's spend-tracking approach becomes far more important than the framework's novelty.

8. Letta formerly MemGPT

Letta is built for stateful agents with persistent memory, which makes it a strong option when repeated context is the hidden cost driver. If the agent is supposed to remember long-running threads, user preferences, or evolving instructions, persistent memory can save tokens by reducing the need to restate old information in every prompt. That's a real financial advantage for assistants that interact over time.

The operational catch is lifecycle complexity. Stateful agents need storage, policies for memory growth, and a clear plan for how data is updated or retired. That adds overhead to infrastructure and governance, so the savings from fewer repeated prompts have to outweigh the cost of keeping the stateful layer healthy.

Practical rule: Persistent memory is valuable only when the same information would otherwise be re-sent repeatedly.

That makes Letta especially interesting for customer-facing assistants and long-lived internal copilots. The user experience improves because the agent doesn't act like a blank slate every time, and engineering avoids re-processing information the agent should already know. The official site is the best place to evaluate how its stateful model fits your architecture (Letta website).

9. OpenHands formerly OpenDevin

OpenHands is the most obviously developer-workflow-first framework in this list. It is built for coding agents that can write code, run CLI commands, and browse inside a sandboxed environment, so it fits software engineering automation much better than general-purpose chat. If the business case is dev productivity, release automation, or internal engineering copilots, it is one of the more practical choices.

The value is straightforward. It can reduce repetitive developer work, and the sandboxed execution model adds a safer boundary for CLI and file operations. The trade-off is runtime weight. OpenHands carries more operational overhead than chat-only agents, so it is usually excessive for simple Q&A or document extraction.

That overhead matters for cost tracking. If you are measuring agent spend in a real engineering workflow, focus on whether the system finishes tasks without human cleanup, because partial automation can look productive while still burning engineering time in review and reruns. For teams that want to classify and attribute usage from engineering automation, SpendLens AI's endpoint monitoring resource is relevant, since the savings depend on understanding which workflows reduce manual effort.

For FinOps teams, OpenHands is easiest to justify when the output is tied to a clear unit of work, such as a completed fix, a verified change, or a closed task. Instrument it with per-agent session logging, command execution counts, sandbox runtime, and human intervention rates so you can separate useful automation from expensive experimentation. If the team cannot show that the agent reduces rework, the compute bill will outpace the value quickly.

10. Langroid

Langroid is the choice for teams that want a lightweight, principled multi-agent model without inheriting a huge dependency stack. Its actor and message-passing approach is easy to reason about, which helps when the team wants fine control over behavior and debugging. That clarity can save developer time because the system is simpler to inspect when something goes wrong.

The downside is ecosystem size. Compared with LangGraph or LlamaIndex, Langroid has fewer prebuilt integrations and a smaller community, so you should expect to write more custom code around external services. That's fine for bespoke production systems, especially in research-heavy teams, but it does shift more integration work onto your engineers.

Where it fits

  • Bespoke production agents: Good when you want control over the logic and don't need a large abstraction layer.
  • Lower maintenance burden: Minimal dependencies reduce attack surface and simplify upgrades.
  • Research-friendly design: The actor model is helpful when agent behavior needs to stay understandable.

Langroid is not the easiest path to market, but it can be the best path to clarity. If you're building something where agent behavior needs to be explainable to engineers first and customers second, that trade-off is often worth it. The project site is the right place to confirm whether its examples match your deployment style (Langroid documentation).

Top 10 Open-Source AI Agent Frameworks, Comparison

Framework Core Focus & Features ✨ Cost & Efficiency Impact 💰 Stability & Maturity ★ Best Fit / Audience 👥 Key Differentiator 🏆
LangGraph (LangChain) Graph-based agent loops; deterministic state machines; JS/TS SDK 💰 Free OSS, production patterns cut debug & waste ★★★★ 👥 Teams building robust, stateful agent workflows 🏆 Proven production patterns + large ecosystem
Microsoft Agent Framework (MAF) Multi-language SDK; deployment templates; Azure integrations 💰 Free OSS, enterprise deployment reduces rollout cost ★★★★ 👥 Enterprise teams, Azure-centric migrations 🏆 Vendor-backed enterprise tooling & migration guides
CrewAI Role-based multi-agent crews; large tool catalog 💰 Free OSS, rapid prototyping can lower dev spend ★★★ 👥 Fast prototyping teams needing complex workflows 🏆 Rich ready-to-use tools for multi-agent collaboration
PydanticAI Type-safe agent I/O; strict schema validation 💰 Free OSS, fewer retries = direct token savings ★★★★ 👥 Teams needing predictable, testable agents 🏆 Strong type-safety to reduce wasted LLM calls
LlamaIndex Agents & Workflows Data/knowledge-first agents; workflows & retrievers 💰 Free OSS + managed options, speeds RAG value capture ★★★★ 👥 RAG/document-centric enterprise apps 🏆 Deep data tooling and retrieval integrations
OpenAI Swarm Minimal multi-agent primitives; tiny codebase 💰 Free OSS, minimal overhead, but more dev effort ★★★ 👥 Teams embedding lightweight agents or learning 🏆 Extremely small, auditable codebase
Hugging Face smolagents Tool-calling & code agents; HF model integrations 💰 Free OSS, quick experiments, optional provider routing ★★★ 👥 Prototype-focused teams using HF ecosystem 🏆 Lightweight API with useful agent types out-of-the-box
Letta (MemGPT) Persistent, self-editing memory; long-lived agents 💰 Free OSS, reduces repeated context & token costs ★★★ 👥 Personal assistants, chatbots with long histories 🏆 Stateful memory that cuts ongoing token usage
OpenHands (OpenDevin) Software agent SDK; sandboxed CLI/browser automation 💰 Free OSS, saves developer time on automation tasks ★★★★ 👥 Engineering teams automating dev workflows 🏆 Purpose-built tooling + secure sandboxes for code agents
Langroid Actor/message-passing multi-agent model; composable agents 💰 Free OSS, low dependency footprint lowers ops cost ★★★ 👥 Research teams & bespoke production agents 🏆 Principled, lightweight actor model for fine control

Build Agents That Create Value, Not Just Costs

Choosing an open source AI agent framework is not just a developer preference, it's an operating decision. The best framework for your team is the one that fits your orchestration needs, your language stack, and your governance requirements while keeping token waste visible. The wrong choice usually doesn't fail loudly, it just creates a slow leak, more retries, more tool calls, more maintainers, and more ambiguity about what the agent is doing.

The market is clearly moving toward production-scale adoption. Open-source frameworks appear to hold a majority share in the broader agentic AI frameworks market, with one report estimating 63.81% share in 2025 for open-source solutions, and a separate market analysis projecting the agent market to grow from $7.84 billion in 2025 to $52.62 billion by 2030 at a 46.3% CAGR (Mordor Intelligence market report). Gartner also forecasts 40% of enterprise applications will feature task-specific AI agents by the end of 2026 (same market analysis). That's why observability, cost attribution, and model-switch planning matter as much as raw capability.

The highest-performing teams don't start by asking which framework is “best.” They start by asking which layer of the stack they need, orchestration, memory, tools, browser control, coding, evals, or inference, and they instrument spend before they scale. That's the difference between a clever demo and a system that survives a budget review.


SpendLens AI helps teams make that decision with real usage data, not guesswork. It instruments OpenAI and Anthropic workloads with lightweight tracking, then shows spend by project, provider, model, and workload so engineering and FinOps can spot waste fast. If you're choosing an open source AI agent framework and want to see where the cost goes, visit SpendLens AI and use it to track the agent workflows you're about to ship.