Substructure vs. Mastra for AI agents

Checked August 7, 2026

Mastra is the TypeScript agent framework from the Gatsby founders, and it has earned its momentum. Agents, workflows, memory, RAG, evals, and observability in one package, a genuinely nice local Studio, and a stable 1.0 as of January 2026. If your team lives in TypeScript and wants to build an agent into your own app, it is one of the best ways to do that.

Substructure gives you both halves of that trade. A working agent comes out of one config file: Slack, MCP auth, history, and streaming, all handled by the engine. And the loop stays fully yours to customize. Point the agent at your webhook and the engine sends every step there as JSON for your code to accept, rewrite, or replace, in any language.

The short answer

Pick Mastra when the agent is a feature of your TypeScript app and you want the whole thing, memory to RAG to evals, as typed code in your repo. Pick Substructure when the agent is a thing your team talks to. The Slack app, the MCP auth, the history, and the streaming already exist, and the loop is still yours: build the tools and decisions you want to own, and skip the rest.

Durability is table stakes. Check who does the work.

Both products persist agent state, and neither deserves applause for it. But the mechanics differ, and the difference is about whose job it is. Mastra persists workflow state as snapshots at suspension points, when a step calls await suspend(). Resume is a call your code makes; nothing in the open-source engine watches for a dead run and restarts it. Mastra's own deployment docs point at Inngest as the workflow engine for production workloads that need memoized steps and automatic retries. In other words, hard durability is something you wire in.

In Substructure the engine saves every step before it runs and resumes on its own after a crash or a redeploy. There is no snapshot API to call, no third-party execution platform to add, and no storage backend to choose first. It is just how the engine runs.

What you write

A Mastra agent is TypeScript in your process: typed tools with Zod schemas, a model string that resolves against a registry of 600+ models, workflows composed with .then() and .branch(). It is genuinely good code to write. It is also a commitment: the agent is your app now, and everything around it deploys and scales as your app does.

A Substructure agent is a file:

substructure.toml
[agent.oncall]
llm = "openrouter"
model = "moonshotai/kimi-k3"
system = "You are the on-call assistant."
mcp = [{ id = "sentry", tools = { read_only = true } }]

[slack]
mentions = "oncall"

Run subs apply and the bot answers in Slack threads. And that file is a default agent, not the whole story. Add a worker URL and the engine sends every decision in the loop to your endpoint as JSON: accept the step, rewrite the prompt, swap the model, run the tool inside your own system, or pause for a person. Every single step is overridable, which is more loop control than most agent SDKs expose. Your worker can be TypeScript. It can also be Rails, Go, or Python, because it is a stateless function behind an HTTP endpoint: state arrives with each request, the decision goes back, and the engine persists the rest. Nothing to keep alive, nothing to store.

Slack and MCP

Mastra shipped Channels in April 2026, and it is a real Slack story: adapters, streaming, thread-scoped memory. You still create the Slack app yourself, wire the signing secret, and run one Slack app per agent. MCP support is thorough too, client and server both, with OAuth flows you configure in code.

In Substructure, subs slack connect opens the consent page and the bot is live; [slack] in the config routes channels to agents. For MCP, the engine handles the authorization and runs every tool call, so your code never holds a token. Both products speak AG-UI, so the client story is a wash: CopilotKit and assistant-ui work with either.

Running it and paying for it

Mastra builds to a Hono server you host, or you use Mastra Platform, which meters usage: observability events, CPU-hours, egress, with always-on servers as a $100-per-project add-on and a Team tier at $250 a month. The core is Apache 2.0 with a source-available enterprise layer.

Substructure's self-hosted engine is one open-source Rust binary with SQLite, and it is the full product. The cloud is one flat price. You bring your own LLM key, and the bill does not move when your agents get busier.

Where Mastra is the right call

The TypeScript developer experience is the best in this space. One command scaffolds a project, the Studio playground is excellent, the model router gives you 600+ models with autocomplete, and memory, RAG, scorers, and tracing are all first-party. The community is large and the release cadence is fast. If you are building an AI product in TypeScript and the agent is part of its fabric, Mastra is a strong choice.

But if what you want is an agent your team uses, in Slack, today, without standing up a TypeScript service to get it, that is Substructure. The quick start takes about five minutes.