One agent execution = one trace. The trace has a single root span; LLM calls, tool calls, and app logic are child spans. See the trace contract.
The model
A trace is a tree of spans:- Traces - the root span 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.
- Good trace vs bad trace - conformant vs malformed traces.
- Troubleshooting - fix missing spans, flat traces, and delayed exports.