strands-sql-storage
A SQL (SQLAlchemy) 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. One provider for any SQLAlchemy-supported database (SQLite, PostgreSQL, MySQL, …), selected purely by connection URL.
pip install strands-sql-storage
from strands.storage import Storage
from strands_sql_storage import SQLStorage
storage = SQLStorage("postgresql://user:pass@localhost/db") # or engine=<Engine>
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
Implements the four Storage operations over opaque bytes:
| Method | Behaviour |
|---|---|
write(key, data) |
Upsert bytes under a /-separated key |
read(key) |
Return the bytes, or None if the key is absent |
delete(key) |
Delete the key (no-op if missing) |
list(prefix) |
Full keys matching the prefix, sorted ascending |
Data model
A single table (strands_storage by default) of (key VARCHAR PRIMARY KEY, data BLOB), created automatically. An optional prefix= namespaces all keys within the table. Blocking SQLAlchemy 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
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 strands_sql_storage-0.1.0.tar.gz.
File metadata
- Download URL: strands_sql_storage-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49a528d9f30bb336419b63e0cc987e5d50406f6b262ae7311f0ef6f4ba9ef68f
|
|
| MD5 |
6a41b82a22aed04b35045b75af81b478
|
|
| BLAKE2b-256 |
da92c4fd576ac8c269d8c439d33ab1ec218ade1bb172196df0131bbec1cefbbe
|
File details
Details for the file strands_sql_storage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: strands_sql_storage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef3e5de6898aaaccb3827851433bea32337074dc4689c87e073f43f34697ac5
|
|
| MD5 |
66ccf28497facf0ad3c65ded9457223c
|
|
| BLAKE2b-256 |
697fffeaa40c217d4a22f2922ebeecef3b8b9d82c5274eec5277af8863c9beb0
|