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_clientresourcesthreadsAsyncThreadsResourcequery
Method●Since v0.10

query

Copy
query(
  self,
  *,
  cursor: str | Omit = omit,
  
View source on GitHub
filter
:
str
|
Omit
=
omit
,
max_start_time
:
Union
[
str
,
datetime
]
|
Omit
=
omit
,
min_start_time
:
Union
[
str
,
datetime
]
|
Omit
=
omit
,
page_size
:
int
|
Omit
=
omit
,
project_id
:
str
|
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
)
->
AsyncPaginator
[
Thread
,
AsyncItemsCursorPostPagination
[
Thread
]
]

Parameters

NameTypeDescription
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

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

max_start_timeUnion[str, datetime] | Omit
Default:omit
min_start_timeUnion[str, datetime] | Omit
Default:omit
page_sizeint | Omit
Default:omit
project_idstr | 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; Query threads within a project (session), with cursor-based pagination. Returns threads matching the given time range and optional filter.

max_start_time is the exclusive upper bound on thread activity (RFC3339 date-time). Defaults to now (UTC) when omitted.

min_start_time is the inclusive lower bound on thread activity (RFC3339 date-time). Defaults to 1 day before now (UTC) when omitted.

page_size is the maximum number of threads to return in this response. Defaults to 20 when omitted; must be between 1 and 100 inclusive when set. The response may contain fewer threads than page_size even when next_cursor is non-null.

project_id is the tracing project UUID.

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