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.

For greenfield implementations, start with Langfuse’s framework guides. Langfuse handles the framework/provider instrumentation details, and Lemma only needs the resulting OpenTelemetry spans exported via OTLP. If your framework is already instrumented with an OpenTelemetry-compatible stack (OpenInference, Arize, Braintrust, provider SDK instrumentation, or another OTel pipeline), keep that instrumentation and add Lemma as an OpenTelemetry export destination.

Framework directory

Pick the Langfuse guide that matches your app, then use OpenTelemetry export to send the resulting spans to Lemma.

Vercel AI SDK

Instrument generateText, streamText, and tool calls with AI SDK telemetry.

OpenAI Agents SDK

Instrument agent runs, handoffs, tool calls, and model spans.

Claude Agent SDK JS/TS

Instrument Claude Agent SDK runs, tool calls, and model responses with Langfuse via OpenInference.

LangChain

Instrument LangChain chains, retrievers, tools, and model calls.

LangGraph

Instrument graph runs, nodes, tools, and multi-step agent workflows.

OpenTelemetry generic

Use this for custom frameworks or direct OpenTelemetry spans.

Existing OTel instrumentation

Keep OpenInference, Arize, Braintrust, provider SDK instrumentation, or another OTel stack and add Lemma export.
Lemma export requires LEMMA_BASE_URL (https://api.uselemma.ai/otel/v1/traces), LEMMA_API_KEY, and LEMMA_PROJECT_ID. See OpenTelemetry export for TypeScript and Python setup examples.

Add Lemma metadata

Set Lemma-specific and semantic-convention-friendly metadata inside the framework’s telemetry options or Langfuse propagation callbacks. At minimum, use lemma.thread_id to link multi-turn conversations in Lemma.
import { streamText } from "ai";

await streamText({
  model: "openai/gpt-4o-mini",
  messages,
  experimental_telemetry: {
    isEnabled: true,
    functionId: "support-agent",
    metadata: {
      "gen_ai.agent.name": "planwise-support-agent",
      "lemma.thread_id": threadId,
      "user.id": userId,
      "session.id": sessionId,
      "deployment.environment.name": process.env.NODE_ENV,
    },
  },
});
Use OpenTelemetry semantic conventions for general metadata (user.id, session.id, deployment.environment.name, service.version) and reserve lemma.thread_id for Lemma’s canonical conversation grouping key. By semantic convention, gen_ai.agent.name should use snake_case, CamelCase, or kebab-case values, such as support_agent, SupportAgent, or support-agent.

Next Steps