Skip to main content

langgraph-store-firestore

A Google Firestore long-term-memory store (BaseStore) for LangGraph — namespaced key/value memory with prefix search, filters, list_namespaces, and native semantic search via Firestore vector search.

pip install langgraph-store-firestore
from langgraph_store_firestore import FirestoreStore

store = FirestoreStore(project_id="my-gcp-project")
store.put(("users", "1", "memories"), "food", {"text": "loves sushi", "kind": "pref"})
item = store.get(("users", "1", "memories"), "food")
hits = store.search(("users", "1"), filter={"kind": "pref"})

Use it as a LangGraph store: graph.compile(store=FirestoreStore(...)). Async methods work too (sync calls run in a thread). Authentication uses Application Default Credentials (gcloud auth application-default login).

Pass a LangGraph IndexConfig and the store embeds the configured fields on put (stored as a Firestore Vector) and ranks search(query=...) by cosine similarity using find_nearest:

from langgraph_store_core import bedrock_titan_embeddings
from langgraph_store_firestore import FirestoreStore

store = FirestoreStore(project_id="my-gcp-project", collection="memory",
                       index={"dims": 1024, "embed": bedrock_titan_embeddings(dimensions=1024), "fields": ["text"]})
store.put(("memories", "kamal"), "k1", {"text": "the user loves sushi", "kind": "pref"})
hits = store.search(("memories", "kamal"), query="what food does the user like?", filter={"kind": "pref"})
print(hits[0].score, hits[0].value)

embed may be any LangChain Embeddings, a list[str] -> list[list[float]] callable, or a provider string. fields defaults to ["$"] (whole value as JSON). put(..., index=False) skips embedding for one item.

Firestore requires a vector index. With create_index=True (default) the store creates a composite index prefix ASC + embedding (flat, dims) on the collection through the Firestore Admin API if one is missing; the build is asynchronous and query searches fail with FAILED_PRECONDITION until it is READY (usually a few minutes; check gcloud firestore indexes composite list). The caller needs datastore.indexes.create / list permissions, or create the index yourself and pass create_index=False:

gcloud firestore indexes composite create --collection-group=memory --query-scope=COLLECTION \
  --field-config=order=ASCENDING,field-path=prefix \
  --field-config=vector-config='{"dimension":"1024","flat":"{}"}',field-path=embedding

The namespace prefix is a range pre-filter on the vector query. Firestore pre-filters are limited to indexed equality/range fields, so value filters are applied on the returned candidates (the store oversamples when a filter is given).

Data model

A single collection of documents {prefix, key, value, created_at, updated_at[, embedding: Vector]}, doc id = enc(prefix)__enc(key). Search is a prefix range query; filters and namespace matching are evaluated in the core.

Docs: https://skamalj.github.io/agentstate-reducer/

License

MIT

Release files for langgraph-store-firestore 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-store-firestore 0.1.0
File Size Uploaded
langgraph_store_firestore-0.1.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-store-firestore 0.1.0
File Interpreter ABI Platform
langgraph_store_firestore-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / langgraph_store_firestore-0.1.0.tar.gz

Download URL langgraph_store_firestore-0.1.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2058928a3ea434e0df245e4e32ac0372fa1f9668e5dc006719abae05f6c6021d
BLAKE2b-256 checksum
How to use checksums
78baaeefe94c00d268aa307dddcb85cef3fa10924576efd1b14962285ec4a511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / langgraph_store_firestore-0.1.0-py3-none-any.whl

Download URL langgraph_store_firestore-0.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a760d429718d526e2717c40db3c08107f56509138ddb2d927a62eeca491ae84
BLAKE2b-256 checksum
How to use checksums
65d1ed45be06e409e4f213bfa42d096a72b3513e6466a75f2eb1e39c2cd85e00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page