mastra  by mastra-ai

TypeScript framework for AI agent development

Created 1 year ago
16,668 stars

Top 2.8% on SourcePulse

GitHubView on GitHub
Project Summary

Mastra is an opinionated TypeScript framework for building AI applications, offering primitives for agents, workflows, RAG, and evaluations. It targets developers seeking to rapidly develop and deploy AI-powered features, supporting any LLM provider through a unified interface.

How It Works

Mastra leverages the Vercel AI SDK for LLM interoperability, enabling seamless integration with providers like OpenAI, Anthropic, and Google Gemini. Its core components include: Agents that orchestrate LLM actions using tools and workflows; Tools as typed, executable functions with schema validation and integration access; Workflows as durable, graph-based state machines supporting complex logic like loops and error handling; RAG for building knowledge bases via ETL pipelines; and Integrations for auto-generated, type-safe API clients.

Quick Start & Requirements

  • Install via npx create-mastra@latest.
  • Run with npm run dev.
  • Requires Node.js (v20.0+).
  • LLM provider API keys (OpenAI, Anthropic, Google Gemini, Groq, Cerebras) are necessary.
  • Environment variables ANTHROPIC_API_KEY or GOOGLE_GENERATIVE_AI_API_KEY may be required.
  • Official docs: https://docs.mastra.ai/

Highlighted Details

  • Unified interface for any LLM provider via Vercel AI SDK.
  • Agents can call custom functions, third-party APIs, and access knowledge bases.
  • Workflows feature built-in OpenTelemetry tracing.
  • Evals provide automated, model-graded testing for LLM outputs.

Maintenance & Community

Licensing & Compatibility

  • License: MIT.
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

The framework is opinionated, which may require adaptation for highly custom architectures. Contribution guidelines suggest discussing code contributions via issues before submitting pull requests.

Health Check
Last Commit

12 hours ago

Responsiveness

1 day

Pull Requests (30d)
829
Issues (30d)
498
Star History
798 stars in the last 30 days

Explore Similar Projects

Starred by Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
7 more.

SuperAGI by TransformerOptimus

0.1%
17k
Open-source framework for autonomous AI agent development
Created 2 years ago
Updated 7 months ago
Feedback? Help us improve.