Mastra
The Mastra provider transforms Devcaster tools into Mastra's tool format with built-in execution.
Install
npm install @devcaster/core @devcaster/mastra @mastra/core @ai-sdk/openaiConfigure API Keys
Set DEVCASTER_API_KEY with your API key from Settings and OPENAI_API_KEY with your OpenAI API key.
DEVCASTER_API_KEY=xxxxxxxxx
OPENAI_API_KEY=xxxxxxxxxCreate session and run
import { Devcaster } from "@devcaster/core";
import { MastraProvider } from "@devcaster/mastra";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";
const devcaster = new Devcaster({
provider: new MastraProvider(),
});
// Create a session for your user
const session = await devcaster.create("user_123");
const tools = await session.tools();
const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant.",
model: openai("gpt-5.2"),
tools,
});
const { text } = await agent.generate([
{ role: "user", content: "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Devcaster!'" },
]);
console.log(text);