Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.
{
  "mcpServers": {
    "respan-docs": {
      "url": "https://respan.ai/docs/mcp"
    }
  }
}

What is Mastra?

Mastra is a TypeScript framework for building AI agents and workflows. It provides structured agent orchestration, tool management, and built-in telemetry via OpenTelemetry.

Setup

1

Install packages

npm install mastra @respan/exporter-vercel
2

Set environment variables

export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
3

Configure Mastra with Respan

import { Mastra } from 'mastra';
import { RespanExporter } from '@respan/exporter-vercel';

const mastra = new Mastra({
  telemetry: {
    serviceName: 'my-mastra-app',
    enabled: true,
    export: {
      type: 'custom',
      exporter: new RespanExporter({
        apiKey: process.env.RESPAN_API_KEY!,
        baseUrl: process.env.RESPAN_BASE_URL,
        debug: true, // enable for troubleshooting
      }),
    },
  },
});
4

View your trace

Open the Traces page to see your agent traces.

Configuration

Mastra uses the RespanExporter from @respan/exporter-vercel. See the Vercel Exporter SDK reference for exporter configuration.
Mastra configTypeDescription
telemetry.serviceNamestringApplication name for traces.
telemetry.enabledbooleanEnable/disable telemetry.
telemetry.export.type"custom"Must be "custom" for Respan.
telemetry.export.exporterSpanExporterRespanExporter instance.
Run the Mastra development playground to test your agent:
mastra dev