# LangSmith Exporter
[EN] Source: https://mastra.ai/docs/observability/ai-tracing/exporters/langsmith

[LangSmith](https://smith.langchain.com/) is LangChain's platform for monitoring and evaluating LLM applications. The LangSmith exporter sends your AI traces to LangSmith, providing insights into model performance, debugging capabilities, and evaluation workflows.

## When to Use LangSmith

LangSmith is ideal when you need:

- **LangChain ecosystem integration** - Native support for LangChain applications
- **Debugging and testing** - Detailed trace visualization and replay
- **Evaluation pipelines** - Built-in evaluation and dataset management
- **Prompt versioning** - Track and compare prompt variations
- **Collaboration features** - Team workspaces and shared projects

## Installation

```bash npm2yarn
npm install @mastra/langsmith
```

## Configuration

### Prerequisites

1. **LangSmith Account**: Sign up at [smith.langchain.com](https://smith.langchain.com)
2. **API Key**: Generate an API key in LangSmith Settings → API Keys
3. **Environment Variables**: Set your credentials

```bash title=".env"
LANGSMITH_API_KEY=ls-xxxxxxxxxxxx
LANGSMITH_BASE_URL=https://api.smith.langchain.com  # Optional for self-hosted
```

### Basic Setup

```typescript title="src/mastra/index.ts"
import { Mastra } from "@mastra/core";
import { LangSmithExporter } from "@mastra/langsmith";

export const mastra = new Mastra({
  observability: {
    configs: {
      langsmith: {
        serviceName: "my-service",
        exporters: [
          new LangSmithExporter({
            apiKey: process.env.LANGSMITH_API_KEY,
          }),
        ],
      },
    },
  },
});
```

## Configuration Options

### Complete Configuration

```typescript
new LangSmithExporter({
  // Required credentials
  apiKey: process.env.LANGSMITH_API_KEY!,

  // Optional settings
  apiUrl: process.env.LANGSMITH_BASE_URL, // Default: https://api.smith.langchain.com
  callerOptions: {
    // HTTP client options
    timeout: 30000, // Request timeout in ms
    maxRetries: 3, // Retry attempts
  },
  logLevel: "info", // Diagnostic logging: debug | info | warn | error

  // LangSmith-specific options
  hideInputs: false, // Hide input data in UI
  hideOutputs: false, // Hide output data in UI
});
```

## Related

- [AI Tracing Overview](/docs/observability/ai-tracing/overview)
- [LangSmith Documentation](https://docs.smith.langchain.com/)


---
title: "OpenTelemetry Exporter | AI Tracing | Observability"
description: "Send AI traces to any OpenTelemetry-compatible observability platform"
---