LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_clientresourcesthreadsThreadsResourcelist_traces
Method●Since v0.10

list_traces

Copy
list_traces(
  self,
  thread_id: str,
  *,
  project_id: str,
  
View source on GitHub
cursor
:
str
|
Omit
=
omit
,
filter
:
str
|
Omit
=
omit
,
page_size
:
int
|
Omit
=
omit
,
selects
:
List
[
Literal
[
'THREAD_ID'
,
'TRACE_ID'
,
'OP'
,
'PROMPT_TOKENS'
,
'COMPLETION_TOKENS'
,
'TOTAL_TOKENS'
,
'START_TIME'
,
'END_TIME'
,
'LATENCY'
,
'FIRST_TOKEN_TIME'
,
'INPUTS_PREVIEW'
,
'OUTPUTS_PREVIEW'
,
'INPUTS'
,
'OUTPUTS'
,
'ERROR'
,
'PROMPT_COST'
,
'COMPLETION_COST'
,
'TOTAL_COST'
,
'PROMPT_TOKEN_DETAILS'
,
'COMPLETION_TOKEN_DETAILS'
,
'PROMPT_COST_DETAILS'
,
'COMPLETION_COST_DETAILS'
,
'NAME'
,
'ERROR_PREVIEW'
]
]
|
Omit
=
omit
,
extra_headers
:
Headers
|
None
=
None
,
extra_query
:
Query
|
None
=
None
,
extra_body
:
Body
|
None
=
None
,
timeout
:
float
|
httpx
.
Timeout
|
None
|
NotGiven
=
not_given
)
->
SyncItemsCursorGetPagination
[
ThreadTrace
]

Parameters

NameTypeDescription
project_id*str

project_id is the tracing project UUID (required).

cursorstr | Omit
Default:omit

cursor is the opaque string from a previous response's next_cursor. Omit on the first request; pass the returned cursor to fetch the next page.

filterstr | Omit
Default:omit
page_sizeint | Omit
Default:omit
selectsList[Literal['THREAD_ID', 'TRACE_ID', 'OP', 'PROMPT_TOKENS', 'COMPLETION_TOKENS', 'TOTAL_TOKENS', 'START_TIME', 'END_TIME', 'LATENCY', 'FIRST_TOKEN_TIME', 'INPUTS_PREVIEW', 'OUTPUTS_PREVIEW', 'INPUTS', 'OUTPUTS', 'ERROR', 'PROMPT_COST', 'COMPLETION_COST', 'TOTAL_COST', 'PROMPT_TOKEN_DETAILS', 'COMPLETION_TOKEN_DETAILS', 'PROMPT_COST_DETAILS', 'COMPLETION_COST_DETAILS', 'NAME', 'ERROR_PREVIEW']] | Omit
Default:omit
extra_headersHeaders | None
Default:None
extra_queryQuery | None
Default:None
extra_bodyBody | None
Default:None
timeoutfloat | httpx.Timeout | None | NotGiven
Default:not_given

Alpha: The request and response contract may change; Retrieve all traces belonging to a specific thread within a project.

filter narrows which traces are returned for this thread, using a LangSmith filter expression evaluated against each root trace run. For example: eq(status, "success") or has(tags, "production"). See https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language for syntax.

page_size is the maximum number of traces to return in this response. Defaults to 20 when omitted; must be between 1 and 100 inclusive when set.

selects lists which properties to include on each returned trace (repeatable query parameter). Accepts any value of the ThreadTraceSelectField enum. Properties not listed are omitted from each trace object; trace_id is always returned.

Send extra headers

Add additional query parameters to the request

Add additional JSON properties to the request

Override the client-level default timeout for this request, in seconds