MastraAI

M

MastraAI

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

Join

Get threadId associated with agent memory

I have a workflow that calls an agent with memory, configured to generate a thread title. How can I get access to the threadId automatically created for that agent once it's been used?...

Images are not kept in the thread context

Hey everyone, I’m running into an issue with Mastra when using it for image generation. I’m building an agent that generates images through a chat interface, using the Nano Banana image-to-image model. The problem is that image generation only works correctly if the image generation tool is called within the same message where the user uploads the image. Has anyone faced this before or found a way to make it work across multiple messages (e.g., when the image is uploaded in one message and processed in the next)?...

Cloudflare worker hyperdrive support

Hi there, is there any update on when this issue will be resolved, or any workarounds for it? https://github.com/mastra-ai/mastra/issues/8782

Structured output validation failed (Line break in my json)

Hi, I'm experiencing a recurring issue when generating JSON. Line breaks aren't being properly escaped: instead of getting \n in my strings, I'm getting actual newline characters that completely break the JSON object structure. This makes the JSON invalid and impossible to parse. ...

workflow resume on workflow as step not working

Or I should say, it's not working using the client JS even though it does appear to work in the playground. But we're stuck not understanding what the difference is. Here is our workflow: ```typescript...

Impossible to inspect workflow input/output etc while agent has active executions

Note: Please add Playground to labels. While agent is running some workflow it is impossible to open any modal to inspect any of workflows in the thread (even completed ones). Once modal opens on click it is getting closed immideately...

[help] how to force a filter on a createVectorQueryTool (pgVector)

hello, I have a context with some variables and I would like to force a filter on the query tool in the context, I set a clientId var and in the pgVector table, I also have a clientId field in metadata col ...

Handling "fast-routing" in mastra?

I’ve noticed Mastra can feel a bit slow for smaller or simpler tasks (which I assume is just part of having an agent in the loop). I’m exploring a setup where lightweight requests get handled directly through an NLP or heuristic route, and only more complex ones fall back to the full Mastra agent. The issue is that these “fast-routed” messages and their quick responses don’t get threaded through Mastra, so they don’t appear in the conversation history or memory context when the user continues chatting. Has anyone tackled this before or found a good workaround to keep fast responses visible in Mastra’s chat/memory context? Curious if there’s a recommended approach here....

Output processor results are not rendered in playground during execution

Output processor results overriding content can only be seen in playground with Memory enabled and only after page reload.

Is streamVNext still not deprecated in workflows?

A while ago bunch of xxVNext methods were deprecated. How about the Workdflow streamVNext? Based on docs it is still the upcoming one: https://mastra.ai/en/reference/streaming/workflows/streamVNext but since most of the other xxVNext were deprecated in favor of the "regular" methods, I'm not sure which one to use in workflows (and neither is my coding agent, it's totally lost about it!). Having these xxVNext coming and going is a bit hard to keep track of, especially if all of them are not following the same lifecycle....

`toUIMessageStreamResponse` also includes tool calls - how to filter out?

Hi all, I'm using AI SDK 5 with NextJS. When I call toUIMessageStreamResponse in /chat endpoint, the function returns all data, like messages and tool calls. As I want to build a public agent, I only want to return text messages, but not tool calls. How can I achieve this? I followed this tutorial here, so I guess my setup is fine: https://mastra.ai/en/examples/agents/ai-sdk-v5-integration...

agent run from workflow should automatically pick up tracing context

Issue: When creating a workflow step from an agent using createStep(myAgent), the tracing context is not automatically passed down through the workflow chain. Expected: Tracing context should automatically propagate without manual wiring. Given snippet should just work without need manually wire up tracing context: ...

Mastra MCP Windows Fix (Claude Code Extension)

Hey everyone! Just wanted to share a fix for anyone running into issues with the Mastra MCP server on Windows 10 using the VSCode/Cursor Claude Code extension. The Problem...

Model picker in the framework

https://x.com/hafezverde/status/1976686729525661893 is there any way to get functionality like this in the app...

Openrouter Multimodal

Hello everyone, I'm integrating with OpenRouter and noticed that they support reading input through the multimodal feature. Does anyone have an example of using it with Mastra? I tried testing it, but got a type error and the input file wasn’t sent. https://openrouter.ai/docs/features/multimodal/overview...

Incredibly Slow Agent Turns

Hey team! Just wondering if anyone has tips for finding what is slowing down my agent? Using structured working memory with gpt 5 mini. Working on finding the right reasoning effort but wondering if the slowdown could be coming from other parts of the agent loop. Has anyone worked on speeding up their mastra agents? I have agent turns running upwards of 20 minutes according to the ai_spans started and ended diff...

Using `MastraAuthClerk` breaks mastra cloud deployment

When you use MastraAuthClerk (https://mastra.ai/en/docs/auth/clerk) it breaks any deployment on mastra cloud because the health check fails. ``` server: { timeout: 60000,...
No description

toAISdkFormat and stream export issues (AI SDK v5)

getting an issue in vitest ever since i added import { toAISdkFormat } from '@mastra/ai-sdk';. The Error is SyntaxError: The requested module '@mastra/core/stream' does not provide an export named 'DefaultGeneratedFile' as anyone ran into this? my implementation is below: ```ts...

Using writer in workflow step with agent

Hello, I have a workflow step (see below) and I am trying to use the writer given the documentation, which I've followed. Lacking a specific example, I am: 1) unclear on how this is supposed to work, and 2) not seeing anything from my agent in the stream chunks via the browser client. Can someone tell me how this should work? My step:...