LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdk_asyncthreadsThreadsClient
    Classā—Since v0.3

    ThreadsClient

    Copy
    ThreadsClient(
        self,
        http: HttpClient,
    )

    Constructors

    Attributes

    Methods

    View source on GitHub
    constructor
    __init__
    NameType
    httpHttpClient
    attribute
    http: http
    method
    get

    Get a thread by ID.

    method
    create

    Create a new thread.

    method
    update

    Update a thread.

    method
    delete

    Delete a thread.

    method
    search

    Search for threads.

    method
    count

    Count threads matching filters.

    method
    copy

    Copy a thread.

    method
    prune

    Prune threads by ID.

    method
    get_state

    Get the state of a thread.

    method
    update_state

    Update the state of a thread.

    method
    get_history

    Get the state history of a thread.

    method
    join_stream

    Get a stream of events for a thread.

    Client for managing threads in LangGraph.

    A thread maintains the state of a graph across multiple interactions/invocations (aka runs). It accumulates and persists the graph's state, allowing for continuity between separate invocations of the graph.

    Example
    client = get_client(url="http://localhost:2024"))
    new_thread = await client.threads.create(metadata={"user_id": "123"})