Mastra
Mastra is a TypeScript framework for building AI agents. To configure tracing with Braintrust:
- For
generateVNext
/streamVNext
: use AI SDK v5 wrappers - For
generate
/stream
: use OpenTelemetry export
wrapMastraAgent (AI SDK v5)
To trace Mastra agents, use wrapMastraAgent
and wrapLanguageModel
.
Mastra OTeL (AI SDK v4)
To trace AI SDK v4 spans with Braintrust, configure these environment variables:
When you create your agent, enable telemetry and export the data using OpenTelemetry:
This will automatically send interactions, tool calls, and performance metrics to Braintrust for monitoring and evaluation.