- TypeScript 99.2%
- JavaScript 0.6%
- CSS 0.1%
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases ## @mastra/core@1.84.0-alpha.6 ### Minor Changes - Knowledge storage can supply scope declarations, access rules included. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) A store returns declarations from `getScopeDeclarations()` (none by default). Knowledge merges them under its config's: the config wins on a key both declare, and a declaration that doesn't compile is skipped with a warning. When stored scopes come from a skipped declaration, the declaration check's error names that declaration and why it was skipped, so it can be fixed in the store. The store's answer is reused for 30 seconds and read again after `renameScopeDeclaration`, so a declaration the store adds, removes or changes (access rules included) applies within that window without a store read on every call. Revoking access through the store can therefore take up to 30 seconds to take effect. ```ts class ImportingKnowledgeStorage extends InMemoryKnowledgeStorage { override async getScopeDeclarations() { return { 'imports:$name': {}, 'linear:$account:$connection': { access: [{ principal: 'imports:all', role: 'viewer' }] }, }; } } ``` Runs that hold `imports:all` then read every Linear connection's pages. ## @mastra/platform@0.1.0-alpha.1 ### Minor Changes - Added `PlatformBrowser`, a Stagehand browser backed by a Mastra Platform browser session. By default it provisions a session with `POST /v1/browsers/sessions` on the Platform and connects to the returned CDP URL; pass `cdpUrl` to connect to a session you already provisioned, with no token or API call. The access token falls back to `MASTRA_PLATFORM_ACCESS_TOKEN` / `MASTRA_PLATFORM_SECRET_KEY`, the project to `MASTRA_PROJECT_ID`, and the API URL to `MASTRA_BROWSER_API_URL`. `@mastra/platform` now depends on `@mastra/stagehand` at runtime. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) ```ts import { PlatformBrowser } from '@mastra/platform'; const agent = new Agent({ name: 'browser-agent', model, browser: new PlatformBrowser() }); ``` - Added `@mastra/platform`: hosted Mastra Platform Memory and Knowledge clients, with Platform Sandbox and Filesystem re-exported from `@mastra/platform-workspace`. `PlatformMemory` is a drop-in `memory` for `Agent` that loads observations and recent messages from a Platform Memory instance and saves each turn back; observation and reflection run on the Platform. `PlatformMemoryClient` exposes the same API directly. Credentials fall back to `MASTRA_PLATFORM_ACCESS_TOKEN` / `MASTRA_PLATFORM_SECRET_KEY`. `PlatformMemory` uses `MASTRA_MEMORY_INSTANCE_ID`; `PlatformKnowledge` uses `MASTRA_KNOWLEDGE_INSTANCE_ID`. `PlatformKnowledge` takes every scope declaration and access rule from its instance, Memory's and Platform importers' included, and has no `scopes` option. Agents read imported pages when their runs hold the scope an importer's rule grants (for now `imports:all`). ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) ```ts import { PlatformMemory, PlatformKnowledge, PlatformSandbox, PlatformFilesystem } from '@mastra/platform'; const agent = new Agent({ name: 'assistant', model, memory: new PlatformMemory() }); ``` ### Patch Changes - `PlatformKnowledge` now supports listing pins: `knowledge_pin` with `kind: 'list'` pins a page's listing on hosted Knowledge instead of refusing it as an old storage adapter. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) - `PlatformMemory` fixes for read-only runs and working memory: ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) - A read-only run (`memory: { options: { readOnly: true } }`) now sees the thread's observations and unobserved messages, read through the Memory instance's read-only context route. Before, it got no stored context at all. It still saves nothing and starts no observation. - The `workingMemory` option now delivers what it says: `readonly` and `tool` add the resource's stored working memory to each run's prompt, read fresh each run; `tool` also tells the agent to update it with `updateWorkingMemory`; `off` leaves it out. Before, stored working memory never reached the prompt in any mode. - Updated dependencies [[`0eb407e`]( |
History
|
|
|---|---|---|
| .agents/skills | ||
| .changeset | ||
| .claude | ||
| .cursor | ||
| .dev | ||
| .github | ||
| .husky | ||
| .mastracode | ||
| .opencode | ||
| .superset | ||
| agent-sdks | ||
| auth | ||
| browser | ||
| channels | ||
| client-sdks | ||
| code-mode | ||
| deployers | ||
| docs | ||
| e2e-tests | ||
| ee | ||
| embedders/voyageai | ||
| examples | ||
| explorations | ||
| integrations | ||
| mastracode | ||
| observability | ||
| packages | ||
| patches | ||
| pubsub | ||
| scripts | ||
| server-adapters | ||
| signals | ||
| stores | ||
| templates | ||
| test-fixtures/workflow-builder-canonical | ||
| voice | ||
| workflows | ||
| workspaces | ||
| .coderabbit.yaml | ||
| .gitattributes | ||
| .gitignore | ||
| .mastra-project.json | ||
| .oxfmtrc.json | ||
| .prettierrc | ||
| .stylelintrc.json | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| DEVELOPMENT.md | ||
| LICENSE.md | ||
| lint-staged.config.js | ||
| oxlint.config.ts | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| renovate.json | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| turbo.json | ||
| vitest.config.observability.ts | ||
| vitest.config.ts | ||
Mastra
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.
Why Mastra?
Purpose-built for TypeScript and designed around established AI patterns, Mastra gives you everything you need to build great AI applications out-of-the-box.
Some highlights include:
-
Model routing: Connect to 40+ providers through one standard interface. Use models from OpenAI, Anthropic, Gemini, and more.
-
Agents: Build autonomous agents that use LLMs and tools to solve open-ended tasks. Agents reason about goals, decide which tools to use, and iterate internally until the model emits a final answer or an optional stopping condition is met.
-
Workflows: When you need explicit control over execution, use Mastra's graph-based workflow engine to orchestrate complex multi-step processes. Mastra workflows use an intuitive syntax for control flow (
.then(),.branch(),.parallel()). -
Human-in-the-loop: Suspend an agent or workflow and await user input or approval before resuming. Mastra uses storage to remember execution state, so you can pause indefinitely and resume where you left off.
-
Context management: Give your agents the right context at the right time. Provide conversation history, retrieve data from your sources (APIs, databases, files), and add human-like memory with Observational Memory so your agents behave coherently.
-
Integrations: Bundle agents and workflows into existing React, Next.js, or Node.js apps, or ship them as standalone endpoints. When building UIs, integrate with agentic libraries like Vercel's AI SDK UI and CopilotKit to bring your AI assistant to life on the web.
-
MCP servers: Author Model Context Protocol servers, exposing agents, tools, and other structured resources via the MCP interface. These can then be accessed by any system or agent that supports the protocol.
-
Production essentials: Shipping reliable agents takes ongoing insight, evaluation, and iteration. With built-in evals and observability, Mastra gives you the tools to observe, measure, and refine continuously.
Get started
The recommended way to get started with Mastra is by running the command below:
npm create mastra@latest
Follow the Installation guide for step-by-step setup with the CLI or a manual install.
If you're new to AI agents, check out our templates, course, and YouTube videos to start building with Mastra today.
Alternative: Use this pre-built prompt to get started
Create a new Mastra project. Mastra is a framework for AI applications and agents on a modern TypeScript stack. Before running the command, ask these questions one at a time and wait for each answer unless it was already provided:
1. Project name? (default: "my-mastra-app")
2. Provider? (required; options: "openai", "anthropic", "google", "xai")
If the provider isn't supported, ask again and list the supported values.
Run: `npm create mastra@latest <project-name> -- --llm <provider>`
The command creates a default Mastra project, installs Mastra skills for detected coding assistants, and initializes Git when appropriate.
After creation, enter the project directory and start the dev server: `npx bgproc start -n <project-name> -w -- npm run dev`
Open Mastra Studio at `http://localhost:4111`. Studio is the interface for building, testing, and managing agents, workflows, and tools.
Also mention that the Mastra model router provides access to thousands of models: https://mastra.ai/models
Documentation
Visit our official documentation.
Build with AI
Learn how to make your agent a Mastra expert by following the Build with AI guide.
Contributing
Looking to contribute? Pull requests are limited to collaborators only. Therefore you can best help by creating high-quality issues with good reproductions and descriptions. Mastra will then verify your report and prioritize it accordingly.
If you want to run Mastra or its tests locally, refer to the development documentation
Support
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.
It's also super helpful if you leave the project a star here, at the top of the page
Licensing
This repository uses a dual-license model:
- Apache License 2.0: The core framework and the vast majority of this codebase is open source under Apache-2.0.
- Mastra Enterprise License: Code in any directory named
ee/(e.g.,packages/core/src/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.
Security
We are committed to maintaining the security of this repo and of Mastra as a whole. If you discover a security finding we ask you to please responsibly disclose this to us at security@mastra.ai and we will get back to you.