Laminar exporter
Laminar is an open-source, OpenTelemetry-native observability platform for AI agents. Trace, debug, and monitor every Mastra agent run, model step, tool call, and sub-agent with a single MastraExporter wired into your Observability config.
InstallationDirect link to Installation
- npm
- pnpm
- Yarn
- Bun
npm install @lmnr-ai/lmnr
pnpm add @lmnr-ai/lmnr
yarn add @lmnr-ai/lmnr
bun add @lmnr-ai/lmnr
ConfigurationDirect link to Configuration
PrerequisitesDirect link to Prerequisites
- Laminar Project: Create/select a project in Laminar
- Project API Key: Copy from Laminar Project Settings
- Environment Variables: Set your credentials
# Required
LMNR_PROJECT_API_KEY=lmnr_...
# Optional
LMNR_BASE_URL=https://api.lmnr.ai
Zero-Config SetupDirect link to Zero-Config Setup
With environment variables set, use the exporter with no configuration:
import { Mastra } from '@mastra/core'
import { Observability } from '@mastra/observability'
import { Laminar, MastraExporter } from '@lmnr-ai/lmnr'
Laminar.initialize()
export const mastra = new Mastra({
observability: new Observability({
configs: {
laminar: {
serviceName: 'my-service',
exporters: [new MastraExporter()],
},
},
}),
})
Explicit ConfigurationDirect link to Explicit Configuration
You can also pass credentials directly (takes precedence over environment variables):
import { Mastra } from '@mastra/core'
import { Observability } from '@mastra/observability'
import { Laminar, MastraExporter } from '@lmnr-ai/lmnr'
Laminar.initialize({
projectApiKey: process.env.LMNR_PROJECT_API_KEY!,
baseUrl: process.env.LMNR_BASE_URL, // Optional
// ...other options
})
export const mastra = new Mastra({
observability: new Observability({
configs: {
laminar: {
serviceName: 'my-service',
exporters: [
new MastraExporter({
realtime: process.env.NODE_ENV === 'development', // Optional
}),
],
},
},
}),
})
For advanced usage, including the full MastraExporter options and multi-agent trace examples, see Laminar's Mastra integration guide.
Mastra also ships a standalone LaminarExporter in @mastra/laminar that sends spans over OTLP/HTTP. It cannot inherit an active OTel context and does not fully map Mastra spans to Laminar's native format, so use the @lmnr-ai/lmnr integration above for observe() wrappers, multi-agent root spans, and accurate Laminar rendering.