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

    Chat LangChain

    What can I help with?

    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_asyncthreadsThreadsClientget_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
    ,
    select
    :
    list
    [
    ThreadStateSelectField
    ]
    |
    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
    selectlist[ThreadStateSelectField] | None
    Default:None
    headersMapping[str, str] | None
    Default:None
    paramsQueryParamTypes | None
    Default:None

    Get the state history of a thread.

    client = get_client(url="http://localhost:2024)
    thread_state = await client.threads.get_history(
        thread_id="my_thread_id",
        limit=5,
    )

    Return states before this checkpoint.

    Filter states by metadata key-value pairs.

    Fields to include in the response. Use values.<key> to return a single state key (e.g. values.messages), which lets the server skip loading the rest of the state. Defaults to all fields.

    Optional custom headers to include with the request.

    Optional query parameters to include with the request.