Remember the one rule: one agent execution = one trace. Record model calls, tool calls, retrieval, and app logic inside that trace.
What you are building
Steps
Optional: install the Lemma tracing skill
If you want a coding agent to add tracing for you, install the Lemma skill from the public repo with the Skills CLI:Then prompt your agent to use the Lemma tracing skill to add tracing to your application.
Set environment variables
Find these in Lemma project settings.
Trace one agent execution
Create a client, open a trace, then record one-off generation and tool events inside the trace callback.
- TypeScript
- Python
Verify in Lemma
Open the Lemma dashboard -> Traces. Within seconds 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.
What’s next
Trace contract
The exact shape Lemma reads.
Concepts
Traces, spans, generations, and threads.
Lemma tracing skill
Install the Lemma skill from the public repo.
Threads & context
Group conversations and attach users.
Instrument an agent
Build up a full trace with generations, tools, spans, and errors.
Vercel AI SDK
Record AI SDK model calls and tool executions.