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_asyncthreads
    Module●Since v0.3

    threads

    Async client for managing threads in LangGraph.

    Attributes

    Classes

    Type Aliases

    View source on GitHub
    attribute
    OnConflictBehavior: Literal['raise', 'do_nothing']
    attribute
    PruneStrategy: Literal['delete', 'keep_latest']
    attribute
    SortOrder: Literal['asc', 'desc']
    attribute
    ThreadSelectField: Literal['thread_id', 'created_at', 'updated_at', 'metadata', 'config', 'context', 'status', 'values', 'interrupts']
    attribute
    ThreadSortBy: Literal['thread_id', 'status', 'created_at', 'updated_at', 'state_updated_at']
    attribute
    ThreadStatus: Literal['idle', 'busy', 'interrupted', 'error']
    attribute
    ThreadStreamMode: Literal['run_modes', 'lifecycle', 'state_update']
    class
    HttpClient
    class
    Checkpoint
    class
    StreamPart
    class
    Thread
    class
    ThreadState
    class
    ThreadUpdateStateResponse
    class
    ThreadsClient
    typeAlias
    Json: dict[str, Any] | None
    typeAlias
    QueryParamTypes: Mapping[str, PrimitiveData | Sequence[PrimitiveData]] | list[tuple[str, PrimitiveData]] | tuple[tuple[str, PrimitiveData], ...] | str | bytes

    Specifies behavior on conflict:

    • "raise": Raise an exception when a conflict occurs.
    • "do_nothing": Ignore conflicts and proceed.

    Strategy for pruning threads:

    • "delete": Remove threads entirely.
    • "keep_latest": Prune old checkpoints but keep threads and their latest state.

    The order to sort by.

    The field to sort by.

    Represents the status of a thread:

    • "idle": The thread is not currently processing any task.
    • "busy": The thread is actively processing a task.
    • "interrupted": The thread's execution was interrupted.
    • "error": An exception occurred during task processing.

    Defines the mode of streaming:

    • "run_modes": Stream the same events as the runs on thread, as well as run_done events.
    • "lifecycle": Stream only run start/end events.
    • "state_update": Stream state updates on the thread.

    Handle async requests to the LangGraph API.

    Adds additional error messaging & content handling above the provided httpx client.

    Represents a checkpoint in the execution process.

    Represents a part of a stream response.

    Represents a conversation thread.

    Represents the state of a thread.

    Represents the response from updating a thread's state.

    Represents a JSON-like structure, which can be None or a dictionary with string keys and any values.

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