Mastra

M

Mastra

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

Join

Question: are data- events persisted in mastra when used with ai-sdk?

My setup leverages chatRoute and useChat from ai-sdk, i use data- partial events to expose deeply nested workflow step updates all the way to the supervisory agent stream generative UI. But upon fetching messages from storage and converting to UIMessages i don't see the emitted events persisted and hence the components are not rendered when i refresh the chat. I'm on v1 beta...

How to configure and use HonoServerAdapter?

How do I use this: https://github.com/mastra-ai/mastra/blob/main/server-adapters/hono/src/index.ts ? I cannot find the package where it's published. The readme belongs to a different package, but the example is relevant. I'm adding mastra to an existing project with a custom CD pipeline and I don't want to use a deployer...

Integration with Datadog LLM Observability

Hello, has anybody attempted to integrate Mastra with Datadog LLM observability? Any insights if it works at all? If it works, how did you do it?

Mastra sample code not working

Hey @Abhi Aiyer and @roamin , I realize my response on the last post was a bit late since I was a conference last week and did not have time to reply. I saw that @Abhi Aiyer told me to open a new post. It seem like the sample still has some issues, the RDS instance is connecting now but app itself seem to broken in some ways after you updated the Mastra packages. Here are the two issues I’m seeing: ...

How to use state when using `foreach`

if inputData is [1,2] and in subWorkflow1, I do setState it should be passed to subWorkflow2. (RequestContext works fine.)
workflows.forEach(subWorkflow => subWorkflow.branch([input === 1,subWorkflow1],[input === 2,subWorkflow2]]))
workflows.forEach(subWorkflow => subWorkflow.branch([input === 1,subWorkflow1],[input === 2,subWorkflow2]]))
...

Network Agent with Telegram

Hey there, I'm having trouble integrating a network agent with telegram. I've used the personal assitant example, but network is giving me a lot of chunk.type and I don't know which one to send to the user on telegram....

Confusing usage of RuntimeContext in workflowRoute and chatRoute

I was just using the RuntimeContext to store additional info from within a Middleware as described here. But when using workflowRoute, the additional info was missing in the RuntimeContext. I looked at the sources and noticed that in workflowRoute, the RuntimeContext is not explicitly extracted anywhere. It is just passed from the request body as part of the rest parameters. ...

Mastra Cloud Deploy

I'm trying to deploy to Mastra Cloud, but no matter how many times I try, I get the following error. ``` Build process failed for build 82f10c50-88f5-4505-980e-e3aaba58438c and project 297bcc46-e9f4-4c9e-81fa-a2c4e7212e92: {"message":"[createRunner] Failed to create Knative service","details":{"message":"[createRunner] Failed to create Knative service","domain":"BUILDER","category":"SYSTEM","details":{}},"code":"BUILDER_FAILED_TO_CREATE_RUNNER"} ...

Way to fire and forget the tool call

Hi team, wanted to know if there is a way to fire and forget the tool calls. We can do this with tools that we design but say for tool like updateWorkingMemory it slows down the whole workflow. Is there a way to fire and forget?

`mastra dev` generating malformed provider-registry.json on every execution

Hi! I’ve got an error that has started happening consistently on my machine but not on any of my coworkers, and I’m looking for some guidance from someone who works with the Mastra source - I think it’s likely an easy fix for someone familiar with the codebase. I'm not sure if I can provide any reproduction given how my coworkers don't have this issue with the same codebase. - Mastra's auto-generated provider-registry.json becomes malformed on my machine every time for unknown reasons - This could be bypassed if I could turn off dynamic loading but there does not appear to be a way to do that without me editing the code directly. - Relevant code: packages/core/src/llm/model/provider-registry.ts - This means mastra dev doesn't work on my machine at all without some very awkward workarounds....

Nested Workflow with custom writer

Workflow -> .branch(condition, nestedWorkflow) in nestedWorkflow -> createStep -> writer.custom toAISDK(workflow.run().stream(), {from:workflow}) ...

suspend will repeat waitForEvenr

Basically I have a step in my workflow which needs to wait before it is given permission to execute however this step also has hitl suspend. The issue I face is I want it to waitForEvent only once before it executes the step and then go into execution and hitl until it can go to next step. I'm having it hard wrapping my head around the best pattern to approach this. My root problem is I'm building a workflow which follows a user journey into phases. Once a phase ends the user enters the next pha...

@mastra/ai-sdk 1.0.0-beta doesnt support mastra core at beta version

When we use this dependencies: "dependencies": { "@ai-sdk/openai": "^2.0.71", "@mastra/ai-sdk": "^1.0.0-beta.3",...

Cloud Access Token

I'm hoping to use Mastra Cloud for observability following the instructions at https://mastra.ai/docs/observability/ai-tracing/exporters/cloud#prerequisites - I can't find a way to generate MASTRA_CLOUD_ACCESS_TOKEN from my Mastra Cloud dashboard. Can someone point me in the right direction? Thanks a lot!

toAISDKStream Not Returning Reasoning Output

I’ve configured a simple agent with reasoning enabled in the provider options. When I test it in Studio, I can see the reasoning coming through correctly. However, when I call it via toAISDKStream, there doesn’t appear to be any reasoning in the response. Does toAISDKStream support reasoning, or am I missing a configuration step?...
No description

Authorize Mastra cloud user for using the agent

Hi, I have setup Mastra auth by extending MastraAuthProvider, so now Mastra cloud can not access my Mastra agents. What's the best way to authorize Mastra cloud user? ``` config.server!.auth = new FrontofficeMastraJwtAuth({...

Studio Ui issue

Default load UI of the workflow always cut the last step behind the floating zoom panel See attached image. A very small improvement that to reduce the loading zoom a bit more so it shows all step and do not have to zoom out or move the flow every time you have to access last step and click on its buttons....
No description

Sending tool messages back

Hi, As far as I understand, we should send back the assistant messages with tool-call and the tool message with tool-result back to the model also on subsequent messages, not just for the last message. Which may look like; role: user with prompt...

How to set runtimeContext with chatRoutes

In my current setup, i add some runtime context in the api/route.ts which is then passed to the agent.stream options. How do I implement the same when using chatRoute?

Network Agent subagent stream text

When I call agent.network(...) and one of the sub-agents needs to ask a follow-up question, the message comes through the data-network stream instead of the regular text stream when using the AI SDK. Most of the data-network payload isn’t useful to me, only the actual text content matters. Shouldn’t that text be streamed through the text chunk instead?