Comparisons / Flue vs Mastra

Flue vs Mastra: Which Agent Framework to Use?

Flue vs Mastra, head to head

Flue and Mastra are both TypeScript-native agent frameworks with production ambitions, and the decision between them isn't language or paradigm — both are declarative-ish, both use per-tool schemas, both target teams that don't want a Python sidecar. It's what each one bundles by default, and where each one wants to run.

Mastra is deploy-agnostic and batteries-included. new Agent({ model, instructions, tools }) is one line. Tools register with createTool + Zod. Workflows are first-class: Workflow.step().then().branch(). RAG is built in — chunking, embedding, vector store, retrieval. Memory spans short-term (per-thread) and long-term (vector). Mastra Studio is a local browser-based debugger. Series A of $22M in April 2026 from Spark Capital; relicensed to Apache 2.0 the same month.

Flue is Cloudflare-native and thinner. createAgent({ model, instructions, tools }) is also one line, but state lives in Durable Streams — a replayable event log stored in Cloudflare Durable Objects, giving per-agent persistence and locking without an external database. Tools use valibot instead of Zod (smaller runtime, faster). Built on the Pi harness (same runtime as OpenClaw). One config deploys to Cloudflare, Node, GitHub Actions, and GitLab CI — the cross-runtime story is genuinely unusual.

The honest split is by deploy target and surface area. Mastra gives you more out of the box (Studio, RAG, workflow engine) and runs anywhere Node runs. Flue gives you Cloudflare Durable Objects as first-class state and a lighter framework surface, but its main leverage is only there on Cloudflare.

Pick Flue if

Pick Flue when Cloudflare Durable Objects earn their keep.

  • Per-agent state + locking via Durable Objects is a real primitive; you'd otherwise wire Redis + Postgres + a queue.
  • Same agent needs to run in production AND in CI (nightly bots, GitHub Actions research agents) — the cross-runtime config matters.
  • You want a thinner framework: valibot instead of Zod, no Studio, no built-in RAG, less surface to learn.
  • Your team is on the Pi/OpenClaw stack and shared tooling matters.
Full Fluecomparison →

Pick Mastra if

Pick Mastra when deploy target is TBD or heterogeneous, and you want the batteries.

  • Built-in RAG (chunking, embedding, vector store, retrieval) saves real integration work.
  • Mastra Studio is a productivity lever — visual traces beat console.log when iterating on tool behavior.
  • Workflow branching (Workflow.step().then().branch()) covers the orchestration case without pulling in a graph DSL.
  • You want the option to move deploy targets later without rewriting; Mastra runs anywhere Node runs.
Full Mastracomparison →

What both add

Both are TypeScript-first and both add a real framework layer between your code and the model API. When something misbehaves at the HTTP level, you'll be reading framework source before you see the actual request. That's the tax; whether it's worth it depends on how much of each framework's surface you actually use.

Both are also evolving quickly. Flue is a 1.0 beta as of mid-2026 — API churn likely. Mastra just took Series A and is moving fast on the platform side. Pin your dependencies either way.

By the numbers

By the numbers

Flue

GitHub Stars

2.4k

Forks

140

Language

TypeScript

License

MIT

Created

2026-05-01

Created by

Fred K. Schott + Astro team (at Cloudflare)

Backed by

Cloudflare

Cloud/SaaS

Cloudflare Durable Objects; also deploys to Node, GitHub Actions, GitLab CI

Production ready

Yes

github.com/withastro/flue

Mastra

GitHub Stars

22.7k

Forks

1.8k

Language

TypeScript

License

Apache-2.0

Created

2024-08-06

Created by

Mastra AI

Backed by

Spark Capital, Y Combinator

Funding

Series A ($22M, Apr 2026 — $35M total)

Weekly downloads

244.0k

github.com/mastra-ai/mastra

GitHub stats as of April 2026. Stars indicate community interest, not necessarily quality or fit for your use case.

ConceptFlueMastra
Agent`createAgent({ model, instructions, tools })` — declarative config, framework runs the loop`new Agent({ model, instructions, tools })` with automatic tool dispatch
ToolsRegistered with valibot schemas: `{ name, description, schema, execute }``createTool({ name, schema, execute })` with Zod validation
StateDurable Streams — replayable, checkpointed event log stored in Cloudflare Durable Objects
DeploymentOne config controls deploys to Cloudflare, Node, GitHub Actions, or GitLab CI
RuntimeThe Pi harness — same runtime as OpenClaw, so agents share tooling with that ecosystem
Cloudflare-nativeDurable Objects give per-agent persistence and locking without an external DB
Workflows`Workflow` class with `.step()`, `.then()`, `.branch()` for orchestration
RAGBuilt-in document syncing, chunking, embedding, and vector search
MemoryShort-term thread memory + long-term vector memory across sessions
StudioMastra Studio: local GUI for testing agents, viewing traces, debugging

Or build your own in 60 lines

Both Flue and Mastra implement the same 8 patterns. An agent is a function. Tools are a dict. The loop is a while loop. The whole thing composes in ~60 lines of Python.

No framework. No dependencies. No opinions. Just the code.

Build it from scratch →