LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmith_openapi_clientresourcesTracesquery
Method●Since v0.10

query

Returns a paginated list of traces (root runs) for a single tracing project. Each item carries the trace's root run plus optional trace-wide aggregates (total_tokens, total_cost, first_token_time) under trace_aggregates, so clients never have to merge by trace_id.

Traces are scanned within a start_time window: min_start_time defaults to 24 hours before the request, max_start_time defaults to the request time. Set either explicitly to widen or narrow the window.

Supports filters (trace_filter, tree_filter), cursor pagination (cursor), and field projection (selects).

Copy
query(
  body: TraceQueryParams,
  options: RequestOptions
): PagePromise<TracesItemsCursorPostPagination, Trace>

Parameters

NameTypeDescription
body*TraceQueryParams
optionsRequestOptions

Example

Copy
// Automatically fetches more pages as needed.
for await (const trace of client.traces.query()) {
  // ...
}
View source on GitHub