Skip to main content
A trace is one agent run. Spans are the steps inside it. The SDK adds Atlan’s observation semantics on top of ordinary OpenTelemetry spans, so a step reads as an LLM call or a tool call rather than an untyped span.

Observation types

Set as_type / asType to classify a span. Agent Registry uses the type to decide how to render the step and which metrics apply.

Create spans

start_as_current_span / startAsCurrentSpan opens a span, makes it the active parent for anything started inside, and closes it on exit.
Use start_span / startSpan for a detached span when the parent is not the active context — a framework tracking its own run tree, a retroactive span with an explicit start_time, or a child of a remote parent. Detached spans must be ended explicitly.

Record model usage and cost

update sets fields on the span that spent them. Record usage and cost on the llm span, not the root.
cost accepts input, output, and total. Provide total when your provider bills a single figure you cannot split.

Wrap a function with observe

observe traces a function without restructuring it. It handles sync functions, async functions, and generators.
Input and output are captured by default. Turn either off per function with capture_input=False / capture_output=False when the payload is large or sensitive. For a blanket rule across every span, use trace_content instead.

Carry identity across a run

propagate_attributes stamps association attributes onto every span started in its scope — including spans created by third-party instrumentation you do not control.
session_id groups traces into one session in Agent Registry. trace_name overrides the display name of the trace, which is useful when the root span name is generic but the run has a meaningful external label.

Deterministic trace IDs

create_trace_id(seed) derives a trace ID from a stable external key. The same seed always produces the same trace ID, in both SDKs, byte-identical. Use it when a run is triggered by something that already has an id — a webhook, a ticket, a queue message — so retries and multi-service handling converge on one trace instead of fragmenting.
Called with no seed, it returns a random ID. The derivation is Langfuse-compatible, so a run already keyed by seed in Langfuse keeps the same trace ID here.

Record failures

record_failure / recordFailure marks the span as errored and records the exception without re-raising it, so tracing never changes your control flow.

Next steps

Add scores

Attach evaluation results to a trace.

Privacy controls

Mask payloads and suppress content.

Inspect a trace

What a trace looks like in Agent Registry.

Configuration

Options, environment variables, and export modes.