Mastra
Mastra agents, through the model router's custom endpoint.
Connect
ts
const agent = new Agent({
id: "plugboard-agent",
name: "Plugboard",
instructions: "Be concise.",
model: { id: MODEL, url: URL, apiKey: KEY },
tools: { get_weather: weather },
});idneeds a provider prefix:plugboard/fastroutes to yoururland sendsfast. A barefastfails withFailed to resolve model configuration, andopenai/fastgoes to OpenAI.urlis the/v1base; don't add/chat/completions.- Set
api: "responses"on the model object to use the Responses API instead of Chat Completions.
What works
agent.generate, agent.stream, and tools made with createTool.
Limits
- Mastra requests no stream usage, so streamed answers carry no token counts.