🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@mastra/langsmith

Package Overview
Dependencies
Maintainers
1
Versions
500
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

1.2.4
View campaign page

@mastra/langsmith

Langsmith observability provider for Mastra - includes tracing and future observability features

unpublished
Source
npmnpm
Version
1.2.4
Version published
Weekly downloads
26K
9.34%
Maintainers
1
Weekly downloads
 
Created
Source

@mastra/langsmith

LangSmith AI Observability exporter for Mastra applications.

Installation

npm install @mastra/langsmith

Usage

Zero-Config Setup

The exporter automatically reads credentials from environment variables:

# Required
LANGSMITH_API_KEY=lsv2_pt_...

# Optional
LANGCHAIN_PROJECT=my-project  # Project name, defaults to "default"
import { LangSmithExporter } from '@mastra/langsmith';

const mastra = new Mastra({
  ...,
  observability: {
    configs: {
      langsmith: {
        serviceName: 'my-service',
        exporters: [new LangSmithExporter()],
      },
    },
  },
});

Explicit Configuration

You can also pass credentials directly:

import { LangSmithExporter } from '@mastra/langsmith';

const mastra = new Mastra({
  ...,
  observability: {
    configs: {
      langsmith: {
        serviceName: 'my-service',
        exporters: [
          new LangSmithExporter({
            apiKey: 'lsv2_pt_...',
            projectName: 'my-custom-project', // Optional
          }),
        ],
      },
    },
  },
});

Configuration Options

OptionTypeDescription
apiKeystringLangSmith API key. Defaults to LANGSMITH_API_KEY env var
projectNamestringThe name of the LangSmith project to send traces to. Overrides LANGCHAIN_PROJECT env var
apiUrlstringCustom LangSmith API URL (for self-hosted instances)
clientClientCustom LangSmith client instance

Features

Tracing

  • Automatic span mapping: Root spans become LangSmith traces
  • Type-specific metadata: Extracts relevant metadata for each span type (agents, tools, workflows)
  • Error tracking: Automatic error status and message tracking
  • Hierarchical traces: Maintains parent-child relationships
  • Event span support: Zero-duration spans for event-type traces

FAQs

Package last updated on 17 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts