Skip to main content
The Lemma SDK sends trace JSON directly to the Lemma API.

1. Install

npm install @uselemma/tracing

2. Set environment variables

Find your API key and project ID in Lemma project settings.
export LEMMA_API_KEY="lma_..."
export LEMMA_PROJECT_ID="proj_..."
The SDK sends to https://api.uselemma.ai by default. Pass baseUrl to new Lemma({ baseUrl }) only when you need a custom endpoint.

3. Create a client

import { Lemma } from "@uselemma/tracing";

export const lemma = new Lemma();

4. Send your first trace

await lemma.trace(
  {
    name: "hello-agent",
    input: "What is the capital of France?",
  },
  async () => {
    return "Paris.";
  },
);
Open the Lemma dashboard -> Traces. Your trace appears within seconds.

Next steps

Traces

Define one agent execution.

Generations

Capture LLM calls with model, prompt, completion, and timing.

Tool calls

Record tool arguments and results.

Trace contract

The exact shape Lemma reads.