Skip to main content

LangGraph Store Aerospike

Store LangGraph state and data in Aerospike using the provided AerospikeStore.

Installation

pip install -U langgraph-store-aerospike

Usage

  1. Bring up Aerospike locally using prebuilt Aerospike Docker Image:
docker run -d --name aerospike -p 3000-3002:3000-3002 container.aerospike.com/aerospike/aerospike-server
  1. Point the store at your cluster (Default):

    • AEROSPIKE_HOST=127.0.0.1
    • AEROSPIKE_PORT=3000
    • AEROSPIKE_NAMESPACE=langgraph (default namespace for the store)
    • AEROSPIKE_SET=store (default set name)
  2. Compile a LangGraph graph with the store. Nodes reach it through get_store(), so the same long-term memory is shared across every run and every thread (unlike a checkpointer, which is scoped to a single thread):

from typing import TypedDict

import aerospike
from langgraph.config import get_store
from langgraph.graph import START, END, StateGraph

from langgraph.store.aerospike import AerospikeStore

# 1. Connect to Aerospike and build the store.
client = aerospike.client({"hosts": [("127.0.0.1", 3000)]}).connect()
store = AerospikeStore(client=client, namespace="test", set="langgraph_store")

# 2. Define a graph whose node reads and writes long-term memory.
class State(TypedDict):
    user_id: str
    food: str

def remember_preference(state: State) -> State:
    store = get_store()
    namespace = ("users", state["user_id"])

    # Persist something we learned about this user.
    store.put(namespace, key="profile", value={"favorite_food": state["food"]})

    # Read it back (would also be visible in any future run / thread).
    profile = store.get(namespace, key="profile")
    print(profile.value)  # {"favorite_food": "pizza"}
    return state

builder = StateGraph(State)
builder.add_node("remember_preference", remember_preference)
builder.add_edge(START, "remember_preference")
builder.add_edge("remember_preference", END)

# 3. Compile with the Aerospike store and run.
graph = builder.compile(store=store)
graph.invoke({"user_id": "user_123", "food": "pizza"})

The store is also a standalone BaseStore, so you can use it directly outside a graph for the same cross-thread memory:

# Search within a namespace prefix, filtering on stored fields.
results = store.search(("users",), filter={"favorite_food": "pizza"}, limit=10)

# Delete an item.
store.delete(("users", "user_123"), key="profile")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langgraph_store_aerospike-0.3.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langgraph_store_aerospike-0.3.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_store_aerospike-0.3.0.tar.gz.

File metadata

File hashes

Hashes for langgraph_store_aerospike-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5a92b1daf172dab9ffa9e51f0ddfa5a81cfaa330d828debf2a19f72b8cb5df94
MD5 e19ef546c6340c8518d19ca8e59f9e01
BLAKE2b-256 2a5effb2ac1ea54b9f3c28ba6c42dbc32106f46c3f0f5949b44d77a0fff9f108

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_store_aerospike-0.3.0.tar.gz:

Publisher: release-store.yml on aerospike/langgraph-aerospike

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langgraph_store_aerospike-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_store_aerospike-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df6c17d9f59da15e632ed7e10f68915efc30402724b32839b162b83bb0b6902c
MD5 0bd3edcab14d4859991113c40551bff1
BLAKE2b-256 9460998e38e4acec14d078917c8dc8c7a61efb4a8cc3536e67944c71b7c35576

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_store_aerospike-0.3.0-py3-none-any.whl:

Publisher: release-store.yml on aerospike/langgraph-aerospike

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page