strands-postgres-storage
A PostgreSQL implementation of the Strands Agents unified Storage interface — durable bytes-under-string-keys that backs session snapshots, context offloading, memory stores, and anything that consumes strands.storage.Storage.
pip install strands-postgres-storage
from strands.storage import Storage
from strands_postgres_storage import PostgresStorage
storage = PostgresStorage("postgresql://user:pass@localhost:5432/db")
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
A single table (strands_storage by default) of (key VARCHAR PRIMARY KEY, data BYTEA), created automatically. An optional prefix= namespaces all keys. Built on the SQLAlchemy-backed strands-sql-storage — PostgresStorage is SQLStorage under a PostgreSQL-specific name; blocking 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_postgres_storage-0.1.0.tar.gz.
File metadata
- Download URL: strands_postgres_storage-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf2449a753cff6c4c8d4817dbddb9a90de0e693e75ca000af149632b2784c075
|
|
| MD5 |
5a2218a06e2909abc4a88020a8ec8ed1
|
|
| BLAKE2b-256 |
bf6fc33839696eace01537ece0b1c1f586a7e6b1b8523aa68bfdf54f38066410
|
File details
Details for the file strands_postgres_storage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: strands_postgres_storage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f77c3e113eba19d3ee691459e37a267600c63f6ce196bdeadd2fd6d8fb1b79b1
|
|
| MD5 |
9ca50bd108282339df48750334df8ff6
|
|
| BLAKE2b-256 |
af674f6222d853bbb9de87f33de8f4f73200f26245ad3671774da43d6293187c
|