LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    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
    LangGraph Store
    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
    stream

    Open a v3 thread-centric streaming session.

    When thread_id is None, a fresh UUIDv4 is minted client-side and included in the URL of subsequent POST /threads/{thread_id}/... calls. The server creates the thread row lazily on the first run.start (internal server detail — the SDK does not send any if_not_exists flag). The v3 protocol response carries only run_id, never thread_id — that's why the SDK mints the id client-side.

    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"})