SaaS stacks
Yui Tanaka7 min read4 views

Mastra vs LangChain vs LlamaIndex: TypeScript AI Agents (2026)

Mastra, LangChain.js, and LlamaIndex.TS for building AI agents in TypeScript, 2026: stars, license, which is still maintained, and how to choose.

Updated on July 16, 2026

Three pedestals in a warm ShipGarden gallery: a tower of modular teal blocks, an interlocking brass chain, and a crystal preserved under a glass bell jar, illustrating Mastra's modular TypeScript framework, LangChain.js composability, and the archived LlamaIndex.TS.
Three pedestals in a warm ShipGarden gallery: a tower of modular teal blocks, an interlocking brass chain, and a crystal preserved under a glass bell jar, illustrating Mastra's modular TypeScript framework, LangChain.js composability, and the archived LlamaIndex.TS.
On this page

The ShipGarden gallery keeps a wall for the tools you actually build agents with, and this quarter three names kept coming up in the same breath: Mastra logo Mastra, LangChain logo LangChain.js, and LlamaIndex logo LlamaIndex.TS. All three promise a TypeScript team the same thing: a way to wire a model to tools, memory, and your own data without hand-rolling the orchestration. They do not deliver it equally, and one of them quietly stopped delivering it at all this year.

We build with these before we shelve them, so this is the decision framed the way we actually make it: by what you are shipping and what language your team lives in, not by whose feature list is longest.

Quick answer (2026)

If you are building a TypeScript logo TypeScript Next.js SaaS and want a framework designed for your language from the ground up, Mastra is the current pick. It is TypeScript-native, moves fast (@mastra/core v1.51.0 shipped July 15, 2026), and treats agents, workflows, memory, and retrieval as first-class parts of one package.

If you are already invested in the LangChain ecosystem, or you need the widest set of integrations plus a mature tracing and evaluation story, LangChain.js is the safe, MIT-licensed default.

LlamaIndex.TS is still strong at retrieval, but its TypeScript package was archived in 2026, so for a new TS project you are choosing between a frozen library and running LlamaIndex in Python. The full reasoning is below.

The three at a glance (2026)

Scroll to see more

FrameworkStarsLicenseNative languageLatestMaintainedBest for
Mastra logo Mastra26.2kApache-2.0 coreTypeScript@mastra/core v1.51.0 (Jul 15, 2026)Yes, very activeNew TS agent + workflow apps
LangChain logo LangChain.js17.9kMITJS/TS port of Python@langchain/core v1.2.3 (Jul 14, 2026)Yes, activeIntegrations, evals, ecosystem
LlamaIndex logo LlamaIndex.TS3.1kMITJS/TS port of Pythonlast release Dec 2025No, archived read-onlyRetrieval, if you accept a frozen dep

Star, license, and version figures pulled from each project's GitHub repository in July 2026: Mastra, LangChain.js, and LlamaIndex.TS.

Mastra: built for TypeScript, moving fast

Mastra is the youngest of the three and the only one written as a TypeScript framework rather than ported into one. That shows up in the ergonomics: agents, tools, workflows, memory, and RAG live behind one typed API, and it deploys cleanly to Vercel, a Node server, or Cloudflare. At 26.2k stars with commits landing daily, it has the momentum of the moment, and its core is Apache-2.0 and free to self-host per its repository and docs (2026).

Where it loses: youth is a real cost. A fast release cadence means the API still moves under you, so pinning versions matters. The core is Apache-2.0, but a directory named ee/ in the repo is commercially licensed, so read the boundaries if enterprise features tempt you. Its integration catalog is narrower than LangChain's, and the managed Mastra Cloud is a separate paid product, not part of the framework.

LangChain.js: the mature default

LangChain.js is the framework you reach for when the answer is "there is already an integration for that." It carries the largest connector catalog of the three, ships under a permissive MIT license, and pairs with LangGraph for stateful multi-step agents and LangSmith for tracing and evaluation. At 17.9k stars on @langchain/core v1.2.3 (July 2026), it has the deepest community and the most Stack Overflow answers when you are stuck, all documented at its repo and JS docs.

Where it loses: the JavaScript library began as a port of the Python project and has historically trailed it on new features. The abstractions can feel heavy for a small agent, where you write more framework than logic. And the parts that make it shine in production, LangSmith observability in particular, are a separate commercial layer, so "free framework" and "free to operate well" are not the same sentence.

LlamaIndex.TS: the archived specialist

This is the honest one. LlamaIndex is the best-known name in retrieval-augmented generation, and the Python project is thriving: run-llama/llama_index sits at 50.9k stars under MIT and ships constantly (2026). The TypeScript port is a different story. As of 2026 the LlamaIndexTS repository is archived and read-only, with its last release in December 2025. For a pure-TypeScript team that means no new features and no security fixes from here.

It still installs and handles straightforward retrieval, so it is not useless. But building a new 2026 project on an archived dependency is a decision you should make with eyes open, not by accident. If RAG is your core and you can run a Python service, the maintained Python LlamaIndex is the stronger home. If you must stay in TypeScript, Mastra and LangChain.js now both cover retrieval well enough that reaching for a frozen library is hard to justify.

How to actually choose

  • Greenfield TypeScript Next.js SaaS, agents plus workflows: start with Mastra. The TS-native ergonomics save the most time when nothing legacy is pinning you.
  • You need a specific integration, or you already run LangChain, and you want evals and tracing: LangChain.js, with LangSmith if you are willing to pay for observability.
  • RAG is the whole product and Python is on the table: the Python LlamaIndex, not the archived TS port. Otherwise use Mastra's retrieval or LangChain.js.
  • Genuinely unsure: build the same three-step agent in Mastra and LangChain.js over one afternoon. The SDK that fits your head, not the one with the most stars, is the right answer.

Cost, honestly (2026)

All three frameworks are free and open source; your real bill is model API calls plus wherever the agent runs. The money question is the managed layer sitting next to each one: Mastra Cloud, LangChain's LangSmith and LangGraph Platform, and LlamaCloud are separate commercial products with their own tiers, and those tiers change often, so price them on each vendor's current pricing page before you commit. None of them is required to ship. You can run any of these frameworks entirely self-hosted and pay only your model provider.

We test these building blocks before we recommend them. The Mastra starter template review walks the three deploy paths for a Mastra agent hands-on, and the LlamaIndex.TS RAG starter review shows what the retrieval path actually looks like if you still want it.

FAQ

Your move: pick the two frameworks that fit your stack, build the same small agent in each this week, and let the developer experience, not the star count, make the call.

Yui Tanaka

Written by

Yui Tanaka

Yui Tanaka curates the ShipGarden gallery, testing open-source and source-available boilerplates and the platforms founders ship them on.

Frequently asked questions

Is Mastra, LangChain.js, or LlamaIndex.TS best for a TypeScript AI agent in 2026?

It depends on the build. Mastra is the pick for new TypeScript-native projects that want agents, workflows, and retrieval in one fast-moving package. LangChain.js wins on integrations, ecosystem, and evaluation tooling. LlamaIndex.TS only makes sense if you accept an archived library or run LlamaIndex in Python for retrieval (2026).

Is LlamaIndex.TS still maintained?

No. The LlamaIndexTS repository was archived and made read-only in 2026, with its last release in December 2025, so it receives no new features or security fixes. The maintained flagship is the Python llama_index project (50.9k stars, MIT). For new TypeScript work, prefer Mastra or LangChain.js, or run LlamaIndex in Python (2026).

Is Mastra open source and free?

Yes. Mastra's core is Apache-2.0 and free to self-host (26.2k stars, @mastra/core v1.51.0, July 2026). A commercial ee/ enterprise directory in the repository and the optional Mastra Cloud platform are separate paid products, not requirements to run the framework (2026).

Mastra vs LangChain, which should I pick?

Pick Mastra if you want a TypeScript-first framework designed for TS ergonomics and fast-moving agent and workflow APIs. Pick LangChain.js if you want the largest integration catalog, LangGraph state machines, and LangSmith evaluation, and you do not mind heavier abstractions. Both are free and open source, so the real difference is developer experience and ecosystem, not price (2026).

Can I use these frameworks with Next.js on Vercel?

Yes. All three run in a Node or serverless runtime and work with Next.js route handlers and server actions. Watch long-running agents against serverless timeouts; for long tasks, run the agent on a persistent host and keep the Next.js app on Vercel (2026).

Do I need LangSmith or Mastra Cloud?

No. The frameworks ship free and self-hostable. LangSmith (tracing and evaluation) and Mastra Cloud (managed deploys and observability) are optional paid layers you add when you want managed observability. They are not required to build or run an agent (2026).