strands-memorysync
MemorySync for Strands Agents (AWS's agent SDK): automatic memory injection before every model call, duplicate-proof turn-by-turn extraction, and a crash-proof lifecycle — with zero framework dependencies.
pip install strands-memorysync
Quick start
from strands import Agent
from strands.memory import MemoryManager
from strands_memorysync import MemorySyncStore
store = MemorySyncStore(
api_key="ms_...", # or MEMORYSYNC_API_KEY
user_id="customer-42", # required — who these memories belong to
session_id="support", # scopes the transcript
)
agent = Agent(memory_manager=MemoryManager(stores=[store]))
agent("which seat should I book?")
The MemoryManager consults the store before every model call
(automatic injection — not tool-gated), and conversation turns persist
through the extraction sink.
Why this one
Mem0 (mem0_memory tool in strands-tools) |
Zep (zep-strands 0.1.0) |
MemorySync | |
|---|---|---|---|
| Automatic injection | ✗ tool-gated — the LLM must decide to recall | ✓ | ✓ |
initialize() safety |
— | ✗ shipped an event-loop crash (RuntimeError: bound to a different event loop; fix unreleased) |
✓ deliberately inert — a test asserts zero network calls |
| First-turn recall | — | ✗ 5-turn extraction lag: early recalls return nothing | ✓ turn-by-turn extraction works from the first exchange (idempotent writes make it safe) |
| Failure blast radius | sync client blocks the loop | ✗ store errors surface as unhandled AggregateMemoryError |
✓ search and extraction fail open; only explicit add() raises |
| Model-facing danger | ✗ exposes a delete action — one prompt injection wipes memories |
— | ✓ search + save tools only; identity never model-facing |
| Data at rest | ✗ default FAISS path in /tmp — wiped on restart |
cloud | ✓ MemorySync cloud |
| Framework pin | — | ✗ strands-agents>=1.45 |
✓ zero dependencies (Protocol duck-typing) |
| Retry safety | ✗ duplicates | — | ✓ deterministic idempotency seeds |
| Python | — | ✗ ≥3.11 | ✓ ≥3.10 (matches the framework) |
Semantics worth knowing
- Turns store verbatim under the
strands::<session>transcript scope with deterministic seeds — manager retries and batch overlaps converge on one stored row. - Tool/system messages are never persisted.
AddMessagesContext.sequence_numbersare recorded in metadata for ordering.- Free-tier quota exhaustion is silent by design (adds accepted-without-
storing, reads empty); evaluation keys surface strict
429s. store.get_tools()returnsmemorysync_search+memorysync_save(@tool-decorated) — enabled via the MemoryManager's tool config.
Configuration
| Parameter | Default | Meaning |
|---|---|---|
user_id |
— (required) | End user the memories belong to |
session_id |
"default" |
Transcript scope |
top_k |
5 |
Memories considered per model call |
recall_timeout |
1.2 |
Hard recall budget, seconds |
min_prompt_chars |
8 |
Skip recall for trivial queries |
writable |
True |
Allow the extraction sink to store turns |
extraction |
True |
Strands extraction wiring ({"cadence": 1} recommended) |
expose_tools |
True |
Return tools from get_tools() |
Development
pip install -e . strands-agents pytest pytest-asyncio
python -m pytest tests -q # 22 tests incl. a REAL Agent turn (stub Model)
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_memorysync-1.0.0.tar.gz.
File metadata
- Download URL: strands_memorysync-1.0.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f2abdb94af92110ed19493e2caeadb9973f0223dc0795aff4089b26e6d38d76
|
|
| MD5 |
760569b0cccebeb290f5c31b6085333b
|
|
| BLAKE2b-256 |
7aba22c9e905787a3ce1be71f8bb69d1dfc917b5622ec205c4c5a07adb6b8769
|
File details
Details for the file strands_memorysync-1.0.0-py3-none-any.whl.
File metadata
- Download URL: strands_memorysync-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8537855cb77cde6069f0bbef4e0414b13ca64669c2ae75b47008f45e3bb76773
|
|
| MD5 |
022e6f5adbaf98a2f6a0a716a23712b2
|
|
| BLAKE2b-256 |
2cb73067d1cbcdbea782338a37ed1d0b28937bed3bcafcd20320ab905b09468a
|