Skip to main content
Send one complete agent trace to Lemma. The software development kit (SDK) sends JSON to the Lemma API. One agent execution is one trace. Record model calls, tool calls, retrieval, and app logic inside that trace.

What you are building

You will send one support-agent trace with a nested generation and tool call.

Steps

1

Install the SDK

2

Set environment variables

Find these in Lemma project settings.
The SDK sends to https://api.uselemma.ai by default. Pass baseUrl / base_url only for a custom endpoint.
3

Trace one agent execution

Create a client, open a trace, then record one generation and one tool call inside the trace callback.
4

Verify in Lemma

Open the Lemma dashboard and go to Traces. You should see:
  • One trace for the whole execution
  • The root trace with input and output
  • A nested generation with model metadata
  • A nested tool call with arguments and result

Stamp a release

Tag every ingest payload with the stable identifier your deployment process assigns to the running app, such as an app version, commit SHA, or container tag. Change it with each deployment. Pass release on the client, or set LEMMA_RELEASE. Most continuous integration systems expose the current commit SHA as an environment variable. Set LEMMA_RELEASE to that value during deployment. An explicit constructor value wins over the environment variable. Lemma omits empty, whitespace-only, longer-than-200-character, or newline, tab, or carriage-return values. It does not guess a git SHA. Adapters (vercelAI, openAIAgents, langChain, langGraph, mastra) accept the same release field and forward it to the client they construct.

Next steps

Use these pages after the first trace lands.

Instrument an agent

Add spans, tools, generations, and errors to a real agent.

Concepts

Traces, spans, generations, and threads.

Trace contract

The exact shape Lemma reads.

Threads and context

Group conversations and attach users.