0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/core
History 2026-11-17 05:14:13 +00:00
..
__recordings__ test(core): replace save-and-errors, model.loop and image-prompt recordings with aimock scenarios (#28465) 2026-10-26 16:31:39 -05:00
scripts docs(models): classify Requesty as a gateway (#29970) 2026-11-10 14:14:49 -08:00
src Merge branch 'fix/gateway-v2-client' into fix/gateway-v2-studio-errors 2026-11-17 05:14:13 +00:00
tools fix: improve @mastra/server commonjs compatibility (#12068) 2026-01-22 14:35:06 +01:00
.gitignore feat(core): dynamic model router with auto-refresh and runtime type generation (#8688) 2025-10-10 16:19:33 -07:00
AGENTS.md docs(core): move runScope contract from AGENTS.md into run-scope.ts (#25340) 2026-09-28 11:06:11 -07:00
api-extractor.json Fix internal types (#9818) 2025-11-06 15:02:40 +01:00
CHANGELOG.md chore: version packages (alpha) (#30516) 2026-11-16 23:44:41 +01:00
docker-compose.yaml chore: eslint fixes for core (#3370) 2025-04-01 14:30:47 +02:00
lint-staged.config.js refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
oxlint.config.ts chore: migrate linting to oxlint (#20173) 2026-07-25 01:04:02 +02:00
package.json chore: version packages (alpha) (#30516) 2026-11-16 23:44:41 +01:00
README.md chore(*): Update/unify/add READMEs (#22858) 2026-09-02 14:36:59 +02:00
tsconfig.build.json fix(core): ship .d.ts for @mastra/core/test-utils/llm-mock (#21427) 2026-08-13 16:51:50 -07:00
tsconfig.json feat(core): add experimental storage v2 for workflow runs (in-memory) (#27144) 2026-11-03 18:36:09 -08:00
tsdown.config.ts fix(core,agent-builder): ship every file referenced by package exports (#29056) 2026-10-30 14:35:14 -07:00
turbo.json fix(core): prototype-safe experiment comparison and clean-checkout core tests (#27718) 2026-10-19 16:46:16 -07:00
vitest.config.ts feat(core, pg, libsql, server): run evented workflows and durable agents on storage v2 (#29370) 2026-11-16 08:23:06 -08:00
vitest.isolated-tests.ts feat(core): recover stopped workflow runs from a loop with one leader (#30281) 2026-11-13 18:15:40 -03:00
vitest.no-isolate-setup.ts test(core): share the module cache across core unit test files (#29131) 2026-11-12 21:05:07 -07:00

@mastra/core

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

It includes everything you need to go from early prototypes to production-ready applications. Mastra integrates with frontend and backend frameworks like React, Next.js, and Node, or you can deploy it anywhere as a standalone server. It's the easiest way to build, tune, and scale reliable AI products.

Installation

@mastra/core is an essential building block for a Mastra application. We recommend following the installation guide to get started with Mastra.

You can install the package like so:

npm install @mastra/core

Core Components

  • Mastra (/mastra): Central orchestration class that initializes and coordinates all Mastra components. Provides dependency injection for agents, workflows, tools, memory, storage, and other services through a unified configuration interface. Learn more about Mastra

  • Agents (/agent): Autonomous AI entities that understand instructions, use tools, and complete tasks. Encapsulate LLM interactions with conversation history, tool execution, memory integration, and behavioral guidelines. Learn more about Agents

  • Workflows (/workflows): Graph-based execution engine for chaining, branching, and parallelizing LLM calls. Orchestrates complex AI tasks with state management, error recovery, and conditional logic. Learn more about Workflows

  • Tools (/tools): Functions that agents can invoke to interact with external systems. Each tool has a schema and description enabling AI to understand and use them effectively. Supports custom tools, toolsets, and runtime context. Learn more about Tools

  • Memory (/memory): Thread-based conversation persistence with semantic recall and working memory capabilities. Stores conversation history, retrieves contextually relevant information, and maintains agent state across interactions. Learn more about Memory

  • MCP (/mcp): Model Context Protocol integration enabling external tool sources. Supports SSE, HTTP, and Hono-based MCP servers with automatic tool conversion and registration. Learn more about MCP

  • Observability: Type-safe observability system tracking AI operations through spans. Provides flexible tracing with event-driven exports, configurable sampling, and pluggable processors and exporters for real-time monitoring. Full observability features are available in the @mastra/observability package. Learn more about Observability

  • Storage (/storage): Pluggable storage layer with standardized interfaces for multiple backends. Supports PostgreSQL, LibSQL, MongoDB, and other databases for persisting agent data, memory, and workflow state. Learn more about Storage

  • Vector (/vector): Vector operations and embedding management for semantic search. Provides unified interface for vector stores with filtering capabilities and similarity search. Learn more about Vector

  • Server (/server): HTTP server implementation built on Hono with OpenAPI support. Provides custom API routes, middleware, authentication, and runtime context for deploying Mastra as a standalone service. Learn more about Server

  • Voice (/voice): Voice interaction capabilities with text-to-speech and speech-to-text integration. Supports multiple voice providers and real-time voice communication for agents. Learn more about Voice

  • Browser (/browser): Base classes and utilities for browser automation. Provides the MastraBrowser abstract class, thread management, and screencast streaming for building browser providers. Use with @mastra/agent-browser or @mastra/stagehand for complete browser automation. Learn more about Browser

License

This package uses a dual-license model:

  • Apache License 2.0: The vast majority of this codebase is open source under Apache-2.0.
  • Mastra Enterprise License: Code in any directory named ee/ (e.g., @mastra/core/auth/ee) is source-available under the Mastra Enterprise License. These features require a valid enterprise license for production use but can be freely used for development and testing.

See LICENSE.md for the full license mapping and ee/LICENSE for the enterprise license terms.