MastraAI

M

MastraAI

The TypeScript Agent FrameworkFrom the team that brought you Gatsby: prototype and productionize AI features with a modern JavaScript stack.

Join

Mastra React SDK

It is complicated to connect to mastra instance only via client js SDK, i need to write my own react hooks and manage that, it should be simple for mastra to create a react SDK as well above the existing client js sdk. this would REALLY help, please...

List of generateVNext compatible models

Is there a list of models compatible with the generateVNext API? I am seeing a v1 compatibility error with 4o-mini and couldn't confirm which model I should move to instead to be compatible with the new API

Possible memory leak or expected behavior?

Hey Mastra! I have this strange behavior that keeps eating RAM until it hits the limit and, by using AWS ECS, it just restarts and we're good to go. I'm using ECS with 1 vcpu and 2GB RAM, which I know is not much, but due to my use case it is better to have 2~3 small instances because our workload goes down a lot after evening....
No description

Do you plan to implement indexing support for other storage systems as well?

https://github.com/mastra-ai/mastra/issues/5876 Regarding PostgreSQL, this has been addressed in this PR, but will support for other storage systems be added in the future?...

initial message generation

I'm wondering if someone has setup a chat system where the chat agent welcomes the user with the initial message. I have this working with a special endpoint but my problem is this 1. if I use memory on the generateVNext call it saves the user prompt also 2. if I don't use memory I can't find a way to store the agent (assistant) message so it's lost on reload. Does anyone have any ideas on how I can store the assistant response without the user prompt?...

How do I make RuntimeContext Typesafe?

if seems that the RuntimeContext becomes type unknown when used in a workflow or step. for example here I need to re-define finished every time I want to use it which feels very counter intuitive. ```typescript .dountil(mainLoopWorkflow, async ({ inputData, runtimeContext }) => {...

Monetize mastra agents

I built a mastra instance with a lot of relevant ai workflows and ai agents for my customers, How is it best to monetize it? Is there some middleware? If i just put some auth middleware it's ok from SECURITY standpoint or will it be hackable?...

Standalone Agent Scorers storage

i am using standalone mastra agents without a mastra instance, where do i put a storage object so i could save these evals and scorers results such as when having a mstra instance + server? This is my code: `...
No description

The latest version cannot install private packages.

When running mastra build, the following error occurs: ```sh ackend:build: INFO [2025-09-18 10:46:23.071 +0900] (Mastra CLI): ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/@my-org%2Fprivate-package: Not Found - 404 backend:build: ...

generateVNext with structured output results in undefined object

```ts const result = await agent.generateVNext(inputData.prompt, { structuredOutput: { schema: z .object({...

HTML Chunking via Mastra rag Mdocument

I want a simple example of it, in the current example it is really basic and not real world. I did this code and it does not work, chunks are too big. Bottom line i just want a real world working example of html chunking for websites (otherwise im thinking about using firecrawl -> markdown -> chunk via markdown) ...

Mastra masks useful errors

Mastra tends to give "Unknown error" for valid errors such as when the prompt is too big: https://discord.com/channels/1309558646228779139/1309558648476930100/1417631233072173168

WritableStream is locked after updating from 0.15.2 to 0.16.3

Hey, I started getting following when updating Mastra. Anyone seen similar, and how to overcome it? Unfortuantely I don't exactly know what causes it so providing a targeted repro is pretty hard. ``` TypeError: Invalid state: WritableStream is locked at setupWritableStreamDefaultWriter (node:internal/webstreams/writablestream:612:11)...

Straight usage of @mastra/server

Is it ok to use @mastra/server to serve my agents on the web to mastra client? Instead of the whole mastra CLI? I guess it can also support mastra client in frontend. Am i missing something?...

RAG pipeline example - workflow

Is it just me or all of the rag pipelines are better to be represented as mastra workflows? That way you can run it from wherever with strong typings. Is it ok or is it anti pattern?...

Anthropic System Prompt Caching Regression

It seems that Anthropic Prompt caching is being regressed from the AI-SDK implementation. I read the source code for the Agent class in mastra and it seems like in multiple places the providerOptions are not being passed for system role messages. The work around would of been to pass the system role messages as part of the message list when .streamVNext is called, as below: ```typescript...

How to address several running instances of a workflow

Suppose, I have a workflow with waitForEvent step: ``` import { createWorkflow, createStep } from "@mastra/core/workflows"; import { z } from "zod";...

Mastra RAG with sources advice needed:

I have a bunch of Q&A questions which i want to do a simple RAG agent on them, I am using Postgresql + PGVector + Mastra. Bottom line i want to get the sources as well, meaning i want to show in my UI (assistant-ui) the citations or the original Q&A question. It is super important and with mastra i dont see how it is possible right now, is it true? ...

Mastra products

is there going to be some extra mastra products such as agent builder (i saw in github) or workflow builder no-code or something extra? Or something i can embed in my website like a no-code builder? or maybe some thing extra just any extra product which is not mastra library and not mastra cloud...