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.
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.logwhen 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.
By the numbers
By the numbers
Flue
2.4k
140
TypeScript
MIT
2026-05-01
Fred K. Schott + Astro team (at Cloudflare)
Cloudflare
Cloudflare Durable Objects; also deploys to Node, GitHub Actions, GitLab CI
Yes
Mastra
22.7k
1.8k
TypeScript
Apache-2.0
2024-08-06
Mastra AI
Spark Capital, Y Combinator
Series A ($22M, Apr 2026 — $35M total)
244.0k
GitHub stats as of April 2026. Stars indicate community interest, not necessarily quality or fit for your use case.
| Concept | Flue | Mastra |
|---|---|---|
| Agent | `createAgent({ model, instructions, tools })` — declarative config, framework runs the loop | `new Agent({ model, instructions, tools })` with automatic tool dispatch |
| Tools | Registered with valibot schemas: `{ name, description, schema, execute }` | `createTool({ name, schema, execute })` with Zod validation |
| State | Durable Streams — replayable, checkpointed event log stored in Cloudflare Durable Objects | — |
| Deployment | One config controls deploys to Cloudflare, Node, GitHub Actions, or GitLab CI | — |
| Runtime | The Pi harness — same runtime as OpenClaw, so agents share tooling with that ecosystem | — |
| Cloudflare-native | Durable Objects give per-agent persistence and locking without an external DB | — |
| Workflows | — | `Workflow` class with `.step()`, `.then()`, `.branch()` for orchestration |
| RAG | — | Built-in document syncing, chunking, embedding, and vector search |
| Memory | — | Short-term thread memory + long-term vector memory across sessions |
| Studio | — | Mastra 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 →