Mastra
A self-hosted TypeScript AI agent framework that connects to local models through LM Studio, with persistent memory and resumable workflows.

Mastra is a TypeScript framework for developers building self-hosted AI agents and applications with local models through LM Studio. It supports gpt-oss, Qwen3 and DeepSeek through an OpenAI-compatible model server. The framework can also call OpenAI, Anthropic and Gemini, which send model requests to those remote providers.
You can embed it in React, Next.js or Node.js applications, or run it as a standalone server on your own infrastructure. Mastra Cloud is the hosted alternative. Model inference runs wherever your selected backend runs.
Mastra combines agents that choose tools for open-ended tasks with workflows where developers control execution:
- Workflows support branches, parallel steps and retries. Stored execution state lets an agent or workflow pause for approval and resume later.
- Memory provides conversation history, semantic recall and observational memory, with context retrieved from files, databases and APIs.
- MCP servers expose agents, tools and structured resources to compatible clients.
- Evaluations, traces, metrics and logs help assess behavior. Mastra Studio provides a local interface for testing and managing agents and workflows.
Its model router can use different models for different tasks and fall back to another provider when a request fails. The core framework is open source under Apache 2.0. Enterprise code is source-available under the Mastra Enterprise License and requires a valid enterprise license for production use.