Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.uselemma.ai/llms.txt

Use this file to discover all available pages before exploring further.

New to Lemma? Lemma is an observability platform for AI agents. Every agent execution becomes a trace — a structured record of timing, inputs, outputs, LLM calls, and tool invocations — so you can understand exactly what your agent did and where it went wrong. Learn more about the concepts →

Manual setup

1

Install OTLP + Langfuse packages (TypeScript)

npm install @langfuse/otel @opentelemetry/exporter-trace-otlp-proto @opentelemetry/sdk-trace-node
2

Set environment variables

Find your API key and project ID in Lemma project settings.
# Lemma export target
export LEMMA_BASE_URL="https://api.uselemma.ai/otel/v1/traces"
export LEMMA_API_KEY="lma_..."
export LEMMA_PROJECT_ID="proj_..."

# Langfuse instrumentation credentials
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_BASE_URL="https://cloud.langfuse.com"
3

Register tracer provider startup hook

Put this in your startup instrumentation file (for example instrumentation.ts in Next.js, or a startup tracer module in Node.js):
import { LangfuseSpanProcessor } from "@langfuse/otel";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";

const provider = new NodeTracerProvider({
  spanProcessors: [
    new LangfuseSpanProcessor({
      exporter: new OTLPTraceExporter({
        url: process.env.LEMMA_BASE_URL,
        headers: {
          Authorization: `Bearer ${process.env.LEMMA_API_KEY}`,
          "X-Lemma-Project-ID": process.env.LEMMA_PROJECT_ID,
        },
      }),
    }),
  ],
});

provider.register();
4

Instrument your framework with Langfuse

Langfuse is the recommended greenfield path. Keep your framework/provider instrumentation in Langfuse, then Lemma receives those emitted spans automatically via the exporter above.
5

Already instrumented? Reuse it

If you already emit OpenTelemetry-compatible spans with OpenInference, Arize, Braintrust, provider SDK instrumentation, or another OTel stack, you do not need to switch to Langfuse.Keep the instrumentation you have and configure Lemma as an OTLP trace export destination. See OpenTelemetry export for setup details.
6

See your trace in Lemma

Open the Lemma dashboard and navigate to Traces. Your trace appears within seconds; click a trace to inspect span timing, model calls, tool spans, and metadata.

What’s next

Concepts

Understand runs, spans, threads, and how they relate.

Langfuse integration

Recommended greenfield setup and export options.

OpenTelemetry export

Add Lemma to an existing OTel pipeline.

Tracing overview

Understand setup choices and trace anatomy.

Query traces from your IDE

Use the Lemma MCP server to search and inspect traces from Cursor, Claude Desktop, or any MCP client.