LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraph-sdkclientThreadsClient
Class●Since v0.0

ThreadsClient

Copy
class ThreadsClient

Bases

BaseClient

Constructors

constructor
constructor

Properties

property
apiUrl: string

Base URL of the LangGraph API server.

Defaults to http://localhost:8123, unless the runtime provides a langgraph_api:url global override.

property
asyncCaller: AsyncCaller
property
defaultHeaders: Record<string, HeaderValue>

Headers applied to every request.

The configured API key, when present, is added as the x-api-key header after these defaults are initialized.

property
onRequest: RequestHook

Hook for inspecting or mutating a request before it is sent.

Receives the resolved URL and prepared RequestInit; return the original init or a replacement object to continue the request.

property
streamProtocol: StreamProtocol

Streaming protocol used by stream-capable endpoints.

Defaults to "legacy" for backwards compatibility.

property
timeoutMs: number | undefined

Default timeout, in milliseconds, applied to client requests.

Per-request timeoutMs values override this default. Passing null at the request level disables the configured timeout for that request.

Methods

method
copy→ Promise<Thread<TStateType, unknown>>

Copy an existing thread

method
count→ Promise<number>

Count assistants matching filters.

method
create→ Promise<Assistant>

Create a new assistant.

method
delete→ Promise<void>

Delete an assistant.

method
fetch
method
get→ Promise<Assistant>

Get an assistant by ID.

method
getHistory→ Promise<ThreadState<ValuesType>[]>

Get all past states for a thread.

method
getState→ Promise<ThreadState<ValuesType>>

Get state for a thread.

method
joinStream→ AsyncGenerator<__type>

Stream output from a run in real-time, until the run is done.

method
patchState→ Promise<void>

Patch the metadata of a thread.

method
prepareFetchOptions
method
prune→ Promise<__type>

Prune threads by ID. The 'delete' strategy removes threads entirely. The 'keep_latest' strategy prunes old checkpoints but keeps threads and their latest state.

method
search→ Promise<AssistantsSearchResponse>

List assistants.

method
stream→ TypedAsyncGenerator<TStreamMode, TSubgraphs, TStateType, TUpdateType, TCustomEventType>

Create a run and stream the results.

method
streamWithRetry
method
update→ Promise<Assistant>

Update an assistant.

method
updateState→ Promise<Pick<Config, "configurable">>

Add state to a thread.

Inherited fromBaseClient

Properties

PapiUrl: string
—

Base URL of the LangGraph API server.

PasyncCallerPdefaultHeaders: Record<string, HeaderValue>
—

Headers applied to every request.

PonRequest: RequestHook
—

Hook for inspecting or mutating a request before it is sent.

PstreamProtocol: StreamProtocol
—

Streaming protocol used by stream-capable endpoints.

PtimeoutMs: number
—

Default timeout, in milliseconds, applied to client requests.

Methods

MfetchMprepareFetchOptionsMstreamWithRetry
View source on GitHub