Skip to main content
Export traces from Mastra agents to TraceRoot using the @traceroot-ai/mastra exporter package. This integrates with Mastra’s built-in OpenTelemetry observability system.

Install

Set up

Configure TraceRoot as an exporter in your Mastra instance:

Usage

Once configured, all agent calls are traced automatically:

Verify

Run your code and confirm the trace arrives:
  1. In the TraceRoot UI: Navigate to Tracing > Traces in TraceRoot Cloud. You should see a trace with root span agent run: 'weatherAgent', named after the agent id.
  2. Via the CLI: Run traceroot traces list to inspect your recent traces from the terminal.

What gets captured

Limitations

  • Tracing requires exporting spans through the @traceroot-ai/mastra exporter package configured in Mastra’s Observability system.

Run the example

Clone the repo and run a complete agent end-to-end.

TypeScript

Run the TypeScript example

Next steps

TypeScript SDK Reference

Explore the full TypeScript SDK reference and configuration options.

Cost Tracking

Learn how TraceRoot calculates token costs and tracks model spend.