trace.recordTool() / trace.record_tool() after the tool returns.
Record a tool call
- TypeScript
- Python
- TypeScript
- Python
traceId is required for detached tools. When the tool belongs under a span, parentSpanId is required; missing IDs warn and no-op.
Pass durationMs when you already measured the tool call. If you omit it, Lemma splits the parent span’s remaining unclaimed duration equally across siblings that also omitted duration.
Show a tool call as an assistant message
When a successful tool sends text directly to the user, setuserFacingMessage
/ user_facing_message to the exact text they received. Lemma displays it as an
assistant message while preserving complete input and output in the span detail.
- TypeScript
- Python
Measure a live tool call
UsestartTool() / start_tool() when you want a handle before the tool finishes. End it only after the tool returns or fails.
- TypeScript
- Python
What the SDK records
See Native contract props and Client fields vs ingest normalization.
Record failures
- TypeScript
- Python
Next steps
Spans
Trace retrieval, ranking, and app logic.
Threads & context
Group conversations and attach users.