Framework · Mastra
Mastra at a glance
A TypeScript framework that bundles agents, workflows with suspend and resume, memory, evals and the Studio UI in one package. It drops into Next.js, Express or Hono apps; the core is Apache-2.0, while ee/ directories use an enterprise licence.
Best for: TypeScript teams that want a single stack for agents, workflows, memory and evals.
Key facts
- Maintainer
- Mastra
- Languages
- TypeScript
- Licence
- Apache-2.0 (core)
- Latest version
@mastra/core 1.73.0· October 1, 2026- Repository
- mastra-ai/mastra
- Hosted option
- Mastra Cloud / Mastra Platform
Quickstart
Install the package, set the credentials, then run the smallest agent from the official docs. Model IDs are the ones the docs use and may not be enabled on your account.
npm install @mastra/core@latest zod@latest typescript@latest @types/node@latest mastra@latest (or scaffold: npm create mastra@latest)// src/mastra/agents/weather-agent.ts
import { Agent } from '@mastra/core/agent'
import { weatherTool } from '../tools/weather-tool.ts'
export const weatherAgent = new Agent({
id: 'weather-agent',
name: 'Weather Agent',
instructions: `
You are a helpful weather assistant that provides accurate weather information.
Your primary function is to help users get weather details for specific locations. When responding:
- Include relevant details like humidity, wind conditions, and precipitation
- Keep responses concise but informative
Use the weatherTool to fetch current weather data.
`,
// Use a string in provider/model format, not provider:model or a provider object.
model: 'openai/gpt-5.6-sol',
tools: { weatherTool },
})
// run.mjs (after registering the agent in src/mastra/index.ts)
import { mastra } from './src/mastra/index.ts'
const agent = mastra.getAgentById('weather-agent')
const response = await agent.generate('Weather in SF')
console.log(response.text)Features
| Any model | Yes | Model router strings in provider/model form |
|---|---|---|
| MCP client | Yes | |
| MCP server | Yes | MCPServer exposes agents, tools, workflows, prompts and resources |
| Multi-agent | Yes | Agents can act as tools for other agents |
| Durable runs | Yes | Suspend and resume with snapshots in libSQL, Postgres and others |
| Human approval | Yes | suspend() and resume() collect human input |
| Tracing | Yes | OTel exporters to Langfuse, Braintrust, Datadog and LangSmith |
| Evals | Yes | Scorers run live with sampling, or offline in CI |
Recent changes
- npm create mastra now scaffolds a general-purpose harness with workspace, shell tools, memory and schedules.
- Mastra Factory targets software factories built from coding agents.