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_syncthreadsSyncThreadsClientget_history
    Method●Since v0.3

    get_history

    Copy
    get_history(
      self,
      thread_id: str,
      *,
      limit: int = 10,
      before: 
    View source on GitHub
    str
    |
    Checkpoint
    |
    None
    =
    None
    ,
    metadata
    :
    Mapping
    [
    str
    ,
    Any
    ]
    |
    None
    =
    None
    ,
    checkpoint
    :
    Checkpoint
    |
    None
    =
    None
    ,
    headers
    :
    Mapping
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    params
    :
    QueryParamTypes
    |
    None
    =
    None
    )
    ->
    list
    [
    ThreadState
    ]

    Parameters

    NameTypeDescription
    thread_id*str

    The ID of the thread to get the state history for.

    checkpointCheckpoint | None
    Default:None

    Return states for this subgraph. If empty defaults to root.

    limitint
    Default:10

    The maximum number of states to return.

    beforestr | Checkpoint | None
    Default:None
    metadataMapping[str, Any] | None
    Default:None
    headersMapping[str, str] | None
    Default:None

    Get the state history of a thread.

    
    thread_state = client.threads.get_history(
        thread_id="my_thread_id",
        limit=5,
        before="my_timestamp",
        metadata={"name":"my_name"}
    )

    Return states before this checkpoint.

    Filter states by metadata key-value pairs.

    Optional custom headers to include with the request.