MastraM
Mastra7mo ago
3 replies
testbuilder

USAGE WITH ai Sdk Ui

import { mastra } from "@/src/mastra";

export async function POST(req: Request) {
const { prompt } = await req.json();
const myAgent = mastra.getAgent("weatherAgent");
const stream = await myAgent.stream([{ role: "user", content: prompt }]);

return stream.toDataStreamResponse();
}

USAGE with Ai sdk shows as this, I can not have a api route in my project can I some how directly pass localhost:4111 url in usechat hook of ai sdk?
Was this page helpful?