Aerospike-based store base for LangGraph
Project description
LangGraph Store Aerospike
Store LangGraph state and data in Aerospike using the provided AerospikeStore.
Installation
pip install -U langgraph-store-aerospike
Usage
- 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
-
Point the store at your cluster (Default):
AEROSPIKE_HOST=127.0.0.1AEROSPIKE_PORT=3000AEROSPIKE_NAMESPACE=langgraph(default namespace for the store)AEROSPIKE_SET=store(default set name)
-
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")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_store_aerospike-0.3.0.tar.gz.
File metadata
- Download URL: langgraph_store_aerospike-0.3.0.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a92b1daf172dab9ffa9e51f0ddfa5a81cfaa330d828debf2a19f72b8cb5df94
|
|
| MD5 |
e19ef546c6340c8518d19ca8e59f9e01
|
|
| BLAKE2b-256 |
2a5effb2ac1ea54b9f3c28ba6c42dbc32106f46c3f0f5949b44d77a0fff9f108
|
Provenance
The following attestation bundles were made for langgraph_store_aerospike-0.3.0.tar.gz:
Publisher:
release-store.yml on aerospike/langgraph-aerospike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_store_aerospike-0.3.0.tar.gz -
Subject digest:
5a92b1daf172dab9ffa9e51f0ddfa5a81cfaa330d828debf2a19f72b8cb5df94 - Sigstore transparency entry: 2119010353
- Sigstore integration time:
-
Permalink:
aerospike/langgraph-aerospike@baa8a58d9de991d5c08fa7148334bb93b43c02e7 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/aerospike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-store.yml@baa8a58d9de991d5c08fa7148334bb93b43c02e7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langgraph_store_aerospike-0.3.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_store_aerospike-0.3.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df6c17d9f59da15e632ed7e10f68915efc30402724b32839b162b83bb0b6902c
|
|
| MD5 |
0bd3edcab14d4859991113c40551bff1
|
|
| BLAKE2b-256 |
9460998e38e4acec14d078917c8dc8c7a61efb4a8cc3536e67944c71b7c35576
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_store_aerospike-0.3.0-py3-none-any.whl -
Subject digest:
df6c17d9f59da15e632ed7e10f68915efc30402724b32839b162b83bb0b6902c - Sigstore transparency entry: 2119010391
- Sigstore integration time:
-
Permalink:
aerospike/langgraph-aerospike@baa8a58d9de991d5c08fa7148334bb93b43c02e7 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/aerospike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-store.yml@baa8a58d9de991d5c08fa7148334bb93b43c02e7 -
Trigger Event:
push
-
Statement type: