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

    threads

    Synchronous 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
    SyncHttpClient
    class
    Checkpoint
    class
    StreamPart
    class
    Thread
    class
    ThreadState
    class
    ThreadUpdateStateResponse
    class
    SyncThreadsClient
    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 synchronous requests to the LangGraph API.

    Provides error messaging and content handling enhancements above the underlying httpx client, mirroring the interface of HttpClient but for sync usage.

    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.

    Synchronous client for managing threads in LangGraph.

    This class provides methods to create, retrieve, and manage threads, which represent conversations or stateful interactions.

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