# Laminar exporter

[Laminar](https://laminar.sh/) is an open-source platform for engineering LLM products. The Laminar exporter sends your Mastra traces to Laminar via OTLP/HTTP (protobuf), with Laminar-native span attributes for correct rendering (paths, inputs/outputs, tags, metadata).

## Installation

**npm**:

```bash
npm install @mastra/laminar@beta
```

**pnpm**:

```bash
pnpm add @mastra/laminar@beta
```

**Yarn**:

```bash
yarn add @mastra/laminar@beta
```

**Bun**:

```bash
bun add @mastra/laminar@beta
```

## Configuration

### Prerequisites

1. **Laminar Project**: Create/select a project in Laminar
2. **Project API Key**: Copy from Laminar Project Settings
3. **Environment Variables**: Set your credentials

```bash
# Required
LMNR_PROJECT_API_KEY=lmnr_...

# Optional
LMNR_BASE_URL=https://api.lmnr.ai
LAMINAR_ENDPOINT=https://api.lmnr.ai/v1/traces
```

### Zero-Config Setup

With environment variables set, use the exporter with no configuration:

```typescript
import { Mastra } from '@mastra/core'
import { Observability } from '@mastra/observability'
import { LaminarExporter } from '@mastra/laminar'

export const mastra = new Mastra({
  observability: new Observability({
    configs: {
      laminar: {
        serviceName: 'my-service',
        exporters: [new LaminarExporter()],
      },
    },
  }),
})
```

### Explicit Configuration

You can also pass credentials directly (takes precedence over environment variables):

```typescript
import { Mastra } from '@mastra/core'
import { Observability } from '@mastra/observability'
import { LaminarExporter } from '@mastra/laminar'

export const mastra = new Mastra({
  observability: new Observability({
    configs: {
      laminar: {
        serviceName: 'my-service',
        exporters: [
          new LaminarExporter({
            apiKey: process.env.LMNR_PROJECT_API_KEY!,
            baseUrl: process.env.LMNR_BASE_URL, // Optional
            endpoint: process.env.LAMINAR_ENDPOINT, // Optional
            realtime: process.env.NODE_ENV === 'development', // Optional
          }),
        ],
      },
    },
  }),
})
```

## Related

- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
- [Laminar Documentation](https://docs.laminar.sh)