One agent execution = one trace. The root is the trace record; LLM calls, tool calls, and app logic are child spans inside it. See the trace contract.
The model
A trace is a tree of spans:- Traces - the root record for one execution.
- Generations - LLM calls.
- Tool calls - tool invocations.
- Spans - retrieval, ranking, app logic.
- Threads & context - conversations, users, metadata.
Pick your path
Instrument with the SDK
Install the Lemma SDK, then add traces, generations, tool calls, and spans.
How Lemma reads your traces
Lemma is an opinionated sink: it reads a specific trace shape to power input/output display, model visibility, timing, tool visibility, threads, and automated issue detection. The trace contract documents exactly what it reads and how each SDK helper maps to it.Next steps
- Setup - install the SDK and point it at Lemma.
- Trace contract - the exact shape Lemma reads.
- Building high-quality traces - the ideal instrumentation path, with bad → better → best examples.
- Troubleshooting - fix missing spans, flat traces, and delayed exports.