Mastra
Connect a Mastra agent to the same chat view used by the Vercel AI SDK.
Stream v7 UI messages from Mastra
Install the tested Mastra packages on your server.
Keep your Mastra instance, agent, and authentication on the server. Set version: "v7" to match the client recipe.
Supply validated request parameters from your server route. Preserve the returned response headers. Configure memory/resource/thread identity and tool policy in Mastra rather than accepting a client-selected privileged resource.
Render in React
Point the Vercel AI SDK client at your route with DefaultChatTransport. Its hook tracks messages, and createAiSdkAdapter passes them to Ghost. Workflows and networks can use this client when their outputs use the same protocol.
Extend and diagnose
Keep native run/thread IDs and resume data for approval/recovery. A local Ghost edit is not a Mastra memory rewrite. For a missing tool or sub-agent view, inspect native UI data parts and supply an intentional renderer rather than silently dropping them. Mismatched SDK/bridge versions can fail at stream decoding even when the endpoint returns 200.
See Mastra AI SDK UI for server routes, approval and memory configuration, and stability for checked frontend versions.