Automatic tracing for Mastra agents with Raindrop
npm install @raindrop-ai/mastra @mastra/core
import { createRaindropMastra } from "@raindrop-ai/mastra"; import { Agent } from "@mastra/core/agent"; import { openai } from "@ai-sdk/openai"; const raindrop = createRaindropMastra({ writeKey: "rk_...", userId: "user-123", }); const agent = new Agent({ name: "Assistant", model: openai("gpt-4o-mini"), instructions: "Be helpful", }); const wrapped = raindrop.wrap(agent); const response = await wrapped.generate("What is the capital of France?"); console.log(response.text); await raindrop.shutdown();
const raindrop = createRaindropMastra({ writeKey: "rk_...", // Optional: omit to disable telemetry endpoint: "...", // Optional: custom Raindrop API endpoint userId: "user-123", // Optional: associate events with a user convoId: "convo-456", // Optional: conversation/thread ID debug: false, // Optional: enable verbose logging });
await raindrop.flush(); // flush pending data await raindrop.shutdown(); // flush + release resources
Was this page helpful?