Skip to main content
Set trace-level context when you open the trace.

Threads

When one user has a back-and-forth with your agent, each turn is its own trace. Give related turns the same threadId so Lemma groups them into one conversation.

Users

Metadata

Attach any custom keys on the trace or a child span. There is no reserved set — firm.slug, plan, or any other key works. Ingest copies each key onto that span as an attribute, so you can filter with attr.<key>:<value>. Use dotted string keys, not nested objects. metadata: { "firm.slug": "acme" } becomes the attribute firm.slug. metadata: { firm: { slug: "acme" } } becomes one object-valued firm attribute and will not filter cleanly.
Filter those traces with attr.firm.slug:acme.
To keep staging data out of production, use a separate Lemma project. The SDK ingest path always stores service_name: "lemma-sdk"; set a custom service name through the OTLP resource service.name.

Reference

See the trace contract for how each field is sent and normalized.

Next steps

Trace contract

What clients send, what ingest requires, and what Lemma normalizes.

Building high-quality traces

The ideal instrumentation path, with bad → better → best examples.