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.
I compared this with the chatRoute and found that there the RuntimeContext is explicitly extracted from the Hono context. But it doesn't seem to be supported through the request body.
Maybe I'm missing something, but I expected all these configuration points to be supported and rather be merged if there are no conflicting keys. That way some params could be provided via the request body and others can be provided through the middleware.
Using Vercel AI SDK | Frameworks | Mastra Docs
Learn how Mastra leverages the Vercel AI SDK library and how you can leverage it further with Mastra
GitHub
mastra/client-sdks/ai-sdk/src/chat-route.ts at main ยท mastra-ai/ma...
The TypeScript AI agent framework. โก Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
3 Replies
๐ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10438
๐ If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
๐ Thank you for helping us improve Mastra!
Thanks for reporting this @Sebastian!
This PR https://github.com/mastra-ai/mastra/pull/10427 should address this
GitHub
Fix: Forward request context set in middleware to workflows in work...
Description
This PR adds ability to forward requestContext set in middleware in workflowRoute similar to chatRoute. Changes were made based on chatRoute implementation.
Similar to chatRoute
adds w...
We'll also look at making sure it behaves the same way in both