Strands Memory Stores¶
Real Strands MemoryStore implementations — long-term, semantic agent memory (search / add) — each backed by its datastore's native vector search. No external vector database.
Why native vector search (not the Storage interface)?
A MemoryStore needs search(query) -> ranked entries, but strands.storage.Storage has no search primitive (only write/read/delete/list). So a semantic store can't ride generically on Storage — it must use a backend that has search. Each store below talks to its backend directly, the way the SDK's BedrockKnowledgeBaseStore talks to Bedrock.
The stores¶
| Package | Vector engine | Backend requirement |
|---|---|---|
strands-dynamodb-store |
DynamoDB native SearchVectors |
boto3>=1.43.78 |
strands-postgres-store · strands-store-postgres |
PostgreSQL pgvector (<=> / HNSW) |
vector extension on the server |
strands-mongodb-store · strands-store-mongodb |
MongoDB Vector Search — Automated Embedding (Voyage) | Atlas or self-managed Community 8.2+ (mongot) + a Voyage key |
Usage¶
from strands import Agent
from strands.memory import MemoryManager
from strands_postgres_store import PostgresMemoryStore # or DynamoDBMemoryStore / MongoDBMemoryStore
store = PostgresMemoryStore(name="user-memories", url="postgresql://user:pass@host:5432/db")
agent = Agent(memory_manager=MemoryManager(stores=[store]))
await store.add("The user prefers dark mode", metadata={"kind": "pref"})
hits = await store.search("what theme does the user like?")
for h in hits:
print(h.metadata["_score"], h.content)
Constructor per backend:
How it works¶
- Semantic recall via the backend's native ANN — ranked by similarity, surfaced as
_scorein each entry's metadata. - Embeddings. DynamoDB and Postgres bring their own — by default each embeds with Amazon Bedrock Titan Text v2 (1024-dim, cosine); pass any
embeddercallable to use Cohere / OpenAI / a local model. MongoDB uses Automated Embedding — MongoDB (via Voyage AI) generates embeddings at index- and query-time, so you store and query plain text and there is no external embedder. - Each
addstores a record (content+ metadata; DynamoDB/Postgres also store the vector); the table / index is created automatically.
Store vs. storage
A memory store (strands-<backend>-store) is the semantic layer. The byte Storage backend is strands-<backend>-storage / strands-storage-<backend> — a different, lower layer.
Backend notes¶
- DynamoDB — native vector search GA'd 2026-08-05; needs a region where it's available. Table is
PAY_PER_REQUESTwith a vector index. - PostgreSQL — needs the
pgvectorextension (apt install postgresql-16-pgvector,brew install pgvector, or the extension on RDS / Cloud SQL / Azure). The store runsCREATE EXTENSION IF NOT EXISTS vector. - MongoDB — MongoDB Vector Search on Atlas or self-managed Community 8.2+ running the
mongotbinary (Linux; Docker / tarball / K8s). Automated Embedding needs a Voyage AI API key configured on the deployment. Models:voyage-4-lite(default),voyage-4,voyage-4-large,voyage-code-3.
License¶
MIT · part of the strands-agents-session family.