Skip to main content
These methods query threads and list the traces inside a thread. For deprecation dates, minimum SDK versions, and the agent prompt that applies to every method, see Migrate to SmithDB-backed SDK methods.

Threads: query

Query threads within a project, with cursor-based pagination. Returns threads matching the given time range and optional filter.

Main changes

Method name

client.threads.query() is now async. Call it with await.
See the reference for the full parameter and field list.

Query parameters

Response fields

Python’s legacy ListThreadsItem only has thread_id, runs (full embedded Run[]), count, min_start_time, max_start_time. It has no token/cost/latency/feedback fields at all.The new Thread never embeds the full run list (that is what threads.list_traces is for) but adds real feedback_stats, latency_p50/latency_p99, cost/token sums with per-category _details, first_trace_id/last_trace_id, first_inputs/last_outputs previews, last_error, num_errored_turns.

Examples

List threads in a project

Fetch every thread with activity in a project during a time range.
Before

Find threads with errors

Find threads that had a turn end in an error.
Before

Threads: list traces

Retrieve all traces belonging to a specific thread within a project.

Main changes

Method name

client.threads.list_traces() is now async. Call it with await.
See the reference for the full parameter and field list.

Query parameters

read_thread’s is_root has no new equivalent. list_traces always returns traces (root runs) only, matching its name. read_thread’s order (asc/desc) also has no new equivalent: results are always sorted by start_time ascending, a fixed server-side order.

Response fields

The legacy read_thread returns full Run objects (a generator). The new ThreadTrace is lightweight: preview fields (inputs_preview/outputs_preview) instead of full inputs/outputs, no embedded child runs. selects controls what’s populated, the same as traces.query.

Examples

List every trace (turn) in a thread

Fetch all the traces (conversation turns) that belong to one thread.
Before

Select specific trace’s fields

Request just the fields you need instead of every field, to reduce response size.
Before

See also