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.storebaseBaseStoreput
    Method●Since v1.0

    put

    Store or update an item in the store.

    Copy
    put(
      self,
      namespace: tuple[str, ...],
      key: str,
      value: dict[str, Any],
      index: Literal[False] | list[str] | None = None,
      *,
      ttl: float | None | NotProvided = NOT_PROVIDED
    ) -> None

    Note:

    Indexing support depends on your store implementation. If you do not initialize the store with indexing capabilities, the index parameter will be ignored.

    Similarly, TTL support depends on the specific store implementation. Some implementations may not support expiration of items.

    Store item. Indexing depends on how you configure the store:

    store.put(("docs",), "report", {"memory": "Will likes ai"})

    Do not index item for semantic search. Still accessible through get() and search() operations but won't have a vector representation.

    store.put(("docs",), "report", {"memory": "Will likes ai"}, index=False)

    Index specific fields for search:

    store.put(("docs",), "report", {"memory": "Will likes ai"}, index=["memory"])

    Parameters

    NameTypeDescription
    namespace*tuple[str, ...]

    Hierarchical path for the item, represented as a tuple of strings. Example: ("documents", "user123")

    key*str

    Unique identifier within the namespace. Together with namespace forms the complete path to the item.

    value*dict[str, Any]

    Dictionary containing the item's data. Must contain string keys and JSON-serializable values.

    indexLiteral[False] | list[str] | None
    Default:None

    Controls how the item's fields are indexed for search:

    • None (default): Use fields you configured when creating the store (if any) If you do not initialize the store with indexing capabilities, the index parameter will be ignored
    • False: Disable indexing for this item
    • list[str]: List of field paths to index, supporting:
      • Nested fields: "metadata.title"
      • Array access: "chapters[*].content" (each indexed separately)
      • Specific indices: "authors[0].name"
    ttlfloat | None | NotProvided
    Default:NOT_PROVIDED

    Time to live in minutes. Support for this argument depends on your store adapter. If specified, the item will expire after this many minutes from when it was last accessed. None means no expiration. Expired runs will be deleted opportunistically. By default, the expiration timer refreshes on both read operations (get/search) and write operations (put/update), whenever the item is included in the operation.

    View source on GitHub