Skip to content
Letta Platform Letta Platform Letta Docs
Sign up

Retrieve Trace For Run

client.runs.trace.retrieve(stringrunID, TraceRetrieveParams { limit } query?, RequestOptionsoptions?): TraceRetrieveResponse
get/v1/runs/{run_id}/trace

Retrieve OTEL trace spans for a run.

Returns a filtered set of spans relevant for observability:

  • agent_step: Individual agent reasoning steps
  • tool executions: Tool call spans
  • Root span: The top-level request span
  • time_to_first_token: TTFT measurement span

Requires ClickHouse to be configured for trace storage.

ParametersExpand Collapse
runID: string
query: TraceRetrieveParams { limit }
limit?: number

Maximum number of spans to return

maximum5000
minimum1
ReturnsExpand Collapse
TraceRetrieveResponse = Array<Record<string, unknown>>
Retrieve Trace For Run
import Letta from '@letta-ai/letta-client';

const client = new Letta({
  apiKey: process.env['LETTA_API_KEY'], // This is the default and can be omitted
});

const traces = await client.runs.trace.retrieve('run_id');

console.log(traces);
[
  {
    "foo": "bar"
  }
]
Returns Examples
[
  {
    "foo": "bar"
  }
]