Mastra

M

Mastra

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

Join

Structured output breaks for gemini flash 2.5

I get the following error Function calling with a response mime type: 'application/json' is unsupported I don't get this error for flash 2.0. When using mastra agents....

.branch() output mismatches the return type

When we use .branch method for running either StepA or StepB, it executes the step based on condition, which lets assume is running StepA. Now the output is like below: ```json { "stepA" : { ... }...
No description

Can semantic recall put more importance on more recent context?

My issue is that my agent keeps pulling old information about a task. Let’s say the task is “submit a YC demo.” Even though I’ve completed it, and told the agent I’ve completed it , it still keeps semantically recalling older messages where I haven’t completed it yet. It’s not pulling the most recent state. Is there a way to fix this?...

Product Feedback: maxSteps reached termination is not obvious in the logs

Hello everyone 👋 Thanks to the Mastra Team, you're doing a great job, it's a pleasure to work with your framework everyday !! Typescript will soon rule the AI Kingdom 👑 😁 Quick product feedback though : when an agent fails due to Max Steps reached, the failure is quite silent and can lead to a llooooonnnngggg investigation figuring out what's wrong. ...
No description

Mastra Cloud studio stuck on 'starting' state

Hi Guys, I am using Mastra Studio, and the studio has been stuck for 2 days. I also can't restart. Any clue? I can fetch the data from the API tho, which is great!...
No description

AI SDK workflowRoute does not pass through runtimeContext/requestContext

Using the mastra/ai-sdk workflowRoute, if you set runtimeContext variables in your middleware, they are not received by the workflow. chatRoute does properly pass runtimeContext, because tool calls by that agent do receive the variables....

Could you include the src files in packages like @mastra/core?

When implementing applications using mastra, we've encountered issues that aren't actually with our application but with the core mastra library itself. On several occasions, we've spent significant time debugging issues in mastra itself. I believe including source files and properly distributing sourcemaps would make debugging much easier. While this would increase the npm install time. What are your thoughts on this?...

I am building e-commerce AI Assistant. Is .network a good choice?

Background: I am building e-commerce AI Assistant. It will use the API of the e-commerce system through the tools. The Assistant can do different things - fetches orders, products, manages promotions etc. Plan: My plan is to create many AI Agents which will handle different areas (order, products etc.) with one supervisor and use the .network. My idea is that user will send the request and supervisor will properly route it to the agent. However, I am facing couple of problems:...

bailing a step in forEach

I've a workflow with an array as input, which I need to iterate over, but if one of that loop element (nestedWorkflow) throws an error or calls bail it should not call next element, given concurrency is 1.

Cursor, workflow or agent ?

Hello! I’m building a chatbot for my company using our customer data. I’m trying to understand something: if Cursor was built with Mastra, does it rely on an agent or a workflow? Right now, my agent isn’t very smart — it just calls 2–3 tools and answers. But I want it to reason more. For example: if I ask for the property’s surface areas, I want the agent to think: “Okay, you asked for surface information. I see in the listing that there’s a total surface value. Let me check the other files… I see 5 JSON files, this one contains X, etc.” ...

Question: does createQueryVectorTool support db schema

Our setup have schema isolated storage instances. I was able to setup vector stores in schema but when agent calls the createQueryVectorTool, it does not respect schema isolation. If i create a custom tool to create embeddings on query and perform a vector search, it does work. But the custom tool does not get called easily with prompt engineering. I would like to use the native tool but have support for schema could be a key provided in databaseConfig.pgVector?...

MCP Client : Incorrect timeout Parameter Position in listTools Call

Summary The listTools function in packages/mcp/src/client/client.ts passes timeout in the wrong parameter position, causing the timeout configuration to be ignored. Location...

How to save `data-` emitted from workflows in storage?

I've added memory to an agent which generates object, it's storing the output in DB, but the steps emits some data-* which aren't stored. Right now, I am using this, but not sure how to convert chunks to parts/MastraDBParts. (And it's not working as chunks have text-delta and parts have only text) Wanted to understand what's basic difference in storage and memory, and if there's way I can save eveything that's being stream to DB?...

Getting "Mastra telemetry is deprecated" when telemetry is not enabled.

Getting this consistently in the terminal, not sure why: WARN [2025-11-26 18:17:16.556 +0000] (Mastra): If you are using a custom instrumentation file or want to disable this warning, set the globalThis._MASTRATELEMETRY variable to true in your instrumentation file. WARN [2025-11-26 18:17:16.562 +0000] (Mastra): Mastra telemetry is deprecated and will be removed on the Nov 4th release. Instead use AI Tracing. More info can be found here: https://github.com/mastra-ai/mastra/issues/8577 and here: https://mastra.ai/en/docs/observability/ai-tracing/overview ...

Does Runtime Context is persistent across Messages

Lets say I set a value in runtime Context and in the next message I get the value from runtime context will that work ?
No description

Architecture Decision for many Tools

Wanted to ASK what you would recommend for a Agent that has possible either 1.many Tools (20+) 2. Or 1 Tool that can Take a Type a Input Toolxyz(inputdata)...

MASTRA_GET_WORKFLOW_BY_ID_NOT_FOUND

I keep getting MASTRA_GET_WORKFLOW_BY_ID_NOT_FOUND, "id": "MASTRA_GET_WORKFLOW_BY_ID_NOT_FOUND", "domain": "MASTRA", "category": "USER",...

generateTitle API broken in Beta ?

Hey all! I can no longer specify a custom generateTitle config for my agent in Beta: memory: new Memory({ options: { generateTitle: {...

Tool Calling Errors

I am getting tool calling errors that respond with "Invalid JSON response" but when I reconcile the request made by the tool to whatever API provider the tool uses, I see a successfully executed request. I am wondering if there is some sort of timeout associated with tools. To recreate this, create a tool that calls a long running image generation tool like nano-banana-pro. On a large set of requests you should see the occasional timeout, but when you go to reconcile the generation is successful....

Issues when using base64 encoded images with threads

I get the following error when trying to use a base64 encoded image in an agent call that is also passing a thread/resouce when using the latest 1.0 beta versinon of Mastra Error: ``` Error executing step prepare-memory-step: Error: Invalid URL: iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII...