Skip to main content

strands-mongodb-storage

A MongoDB implementation of the Strands Agents unified Storage interface — durable bytes-under-string-keys that backs session snapshots, context offloading, memory stores, and anything else that consumes strands.storage.Storage.

pip install strands-mongodb-storage
from strands.storage import Storage
from strands_mongodb_storage import MongoDBStorage

storage = MongoDBStorage("mongodb://localhost:27017")
assert isinstance(storage, Storage)

await storage.write("sessions/abc/state.json", b"...bytes...")
data = await storage.read("sessions/abc/state.json")   # -> bytes | None
keys = await storage.list("sessions/")                 # sorted, prefix-matched
await storage.delete("sessions/abc/state.json")        # no-op if absent

Interface

Method Behaviour
write(key, data) Upsert bytes under a /-separated key
read(key) Return the bytes, or None if absent
delete(key) Delete the key (no-op if missing)
list(prefix) Full keys matching the prefix, sorted ascending

Data model

One document per key: {_id: <key>, data: <BinData>} in a single collection (strands_storage.storage by default). An optional prefix= namespaces all keys. Blocking PyMongo calls run in a thread so the async interface never blocks the event loop.

License

MIT

Download files

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

Source Distribution

strands_mongodb_storage-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

strands_mongodb_storage-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file strands_mongodb_storage-0.1.0.tar.gz.

File metadata

  • Download URL: strands_mongodb_storage-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for strands_mongodb_storage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f9677f89a4bd0e8978dfc696889e2aba35df7fe25e5de96a0b71ab941a80bf86
MD5 8eff1d9bdbf934534a6091688e4cbd1a
BLAKE2b-256 ac019ef1854c841acc30ec893cb845720e84eb2e48c2604243a73f2b022e8307

See more details on using hashes here.

File details

Details for the file strands_mongodb_storage-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for strands_mongodb_storage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a2c30287d474cfc94b2a59966001d5d0daea2647f3c1f5c1ef823d5fa2f5854
MD5 253e1132c51772e7b3b809cefd37e0fb
BLAKE2b-256 8aaa098c02143eb987575570f3d3ad10612259ee6593b09f2788f88170b39e32

See more details on using hashes here.

Supported by

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