ScriptsMar 30, 2026·2 min read

Mastra — TypeScript AI Agent Framework

AI agent framework for TypeScript from the Gatsby team. Build agents with tools, workflows, RAG, memory, evals, and 50+ integrations. Modern TS-native design. 22K+ stars.

TO
TokRepo精选 · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

npx create-mastra@latest my-agent
cd my-agent
npm run dev

Or add to an existing project:

npm install mastra @mastra/core

Intro

Mastra is an AI agent framework for TypeScript, built by the team behind Gatsby. It provides a modern, TypeScript-native way to build AI agents with tools, multi-step workflows, RAG pipelines, persistent memory, evaluations, and 50+ pre-built integrations. Designed for production use with type safety throughout. 22,000+ GitHub stars, MIT licensed.

Best for: TypeScript/Node.js developers building production AI agents Works with: OpenAI, Anthropic, Google, Ollama, any LangChain-compatible model


Core Features

Agents with Tools

const agent = new Agent({
  name: "Research Assistant",
  instructions: "You help users research topics.",
  model: openai("gpt-4o"),
  tools: { search: searchTool, summarize: summarizeTool },
});

Workflows

Multi-step, branching workflows with automatic state management:

const workflow = new Workflow({ name: "content-pipeline" })
  .step("research", researchStep)
  .step("write", writeStep, { after: "research" })
  .step("review", reviewStep, { after: "write" });

RAG

Built-in vector storage and retrieval with chunking strategies.

Memory

Persistent conversation memory across sessions with thread management.

50+ Integrations

Pre-built connectors for GitHub, Slack, Notion, Google, Stripe, and more.

Evals

Test agent quality with built-in evaluation framework.


FAQ

Q: What is Mastra? A: A TypeScript AI agent framework from the Gatsby team. Build agents with tools, workflows, RAG, memory, evals, and 50+ integrations. 22K+ GitHub stars, MIT licensed.

Q: How is Mastra different from LangChain.js? A: Mastra is TypeScript-native with first-class type safety, built-in workflow engine, persistent memory, and a scaffold CLI. More opinionated and production-oriented.


🙏

Source & Thanks

Created by Mastra AI (from the Gatsby team). Licensed under MIT. mastra-ai/mastra — 22,000+ GitHub stars

Related Assets