Install Langfuse, point it at Lemma, and send your first trace
Lemma uses Langfuse as its instrumentation library. You write Langfuse spans; Langfuse exports them to Lemma over OpenTelemetry. This page wires up the exporter once. After this, every page in Instrumentation is just Langfuse code.
Pin the Langfuse v4 SDK (@langfuse/tracing + @langfuse/otel). The examples in these docs use startActiveObservation and propagateAttributes from that version.
Exporting only to Lemma does not require LANGFUSE_* credentials. You only need a Langfuse account if you also want traces in Langfuse — see dual export.
import { startActiveObservation } from "@langfuse/tracing";await startActiveObservation("hello-agent", async (root) => { root.update({ input: "What is the capital of France?", output: "Paris.", });});
Open the Lemma dashboard → Traces. Your trace appears within seconds.
Span processors batch and export in the background. In short-lived or serverless runtimes, flush before the process exits so the whole trace ships in one batch.
TypeScript
Python
import { lemmaProcessor } from "./instrumentation";// at the end of a request / serverless handlerawait lemmaProcessor.forceFlush();
from langfuse import get_clientget_client().flush()
Without a flush, a serverless function can exit before the root span is exported. If the root is dropped, the trace’s child spans can be orphaned and the trace discarded. Always flush at the end of short-lived handlers.