Strands Agents Memory
A MemoryStore for Strands Agents: automatic recall injected before every model call under a hard budget, duplicate-proof turn-by-turn extraction, and a crash-proof lifecycle — with zero framework dependencies. Install strands-memorysync from PyPI.
What installs
pip install strands-memorysync
The MemoryManager consults the store before every model call — automatic injection, not tool-gated recall — and routes conversation turns to the store’s extraction sink. The store implements the MemoryStore Protocol by duck typing, so this package has zero framework dependencies and can never version-conflict with your Strands release.
| Mem0 (`mem0_memory` tool) | Zep (`zep-strands`) | Supermemory | MemorySync | |
|---|---|---|---|---|
| Automatic injection | ✗ tool-gated — the LLM must decide to recall | ✓ | — nothing at all | ✓ |
initialize() safety | — | ✗ shipped an event-loop crash (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 |
| Failure blast radius | ✗ sync client blocks the event loop | ✗ errors surface as unhandled AggregateMemoryError | — | ✓ search and extraction fail open; only explicit add() raises |
| Model-facing danger | ✗ exposes a `delete` action — prompt injection wipes memories | — | — | ✓ search + save only; identity never model-facing |
| Data at rest | ✗ default FAISS in /tmp — wiped on restart | cloud | — | ✓ MemorySync cloud |
| Framework pin | — | ✗ strands-agents>=1.45 | — | ✓ zero dependencies |
| Python floor | — | ✗ 3.11 only | — | ✓ 3.10 (matches the framework) |
Turn-by-turn extraction — no first-turn amnesia
Strands batches conversation turns to the store’s add_messages sink on a configurable cadence. zep-strands keeps the default five-turn batch, so a user’s first exchanges are simply not stored yet — early recalls return nothing by design. MemorySync’s add_turn is cheap and idempotent (deterministic seeds mean a manager retry converges on the same row), so turn-by-turn cadence is safe and recommended: memories are recallable from the very first exchange.
| Guarantee | How |
|---|---|
| A model call is never stalled | search waits at most recall_timeout (default 1.2s), then fails open to no memories |
| A memory outage never breaks the agent | search returns []; extraction logs and continues — no AggregateMemoryError into your code |
| Manager retries never duplicate | Seeds from role + session + content hash; sequence_numbers recorded for ordering |
| Tool noise never persists | Only user and assistant turns store; tool/system messages are skipped |
| Prompt injection cannot destroy data | No delete tool exists; deletion stays a human/API action |
Memory as agent tools
# The manager exposes its own managed search tool by default; the# store also offers its @tool pair:tools = store.get_tools() # memorysync_search + memorysync_save
The official Mem0 strands tool exposes a model-callable delete action — one prompt injection can wipe a user’s memories. Here the model can search and save, nothing else, and the user identity is never a tool parameter.
Configuration
| Parameter | Default | Meaning |
|---|---|---|
user_id | — (required) | End user the memories belong to |
session_id | default | Transcript scope: strands::<session> |
top_k | 5 | Memories considered per model call |
recall_timeout | 1.2 | Hard recall budget in 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 memorysync_search/memorysync_save from get_tools() |
Supported versions
| Surface | Requires | Verified on |
|---|---|---|
strands-memorysync 1.0.0 | A strands-agents release with the MemoryManager seam (2026+, Python 3.10+); the store itself has no framework dependency | 22 CI checks against the latest strands-agents: the REAL MemoryManager search path and a REAL Agent turn via a stub Model — injected context verifiably reaching the model, the inert-initialize regression (zep-strands’ event-loop crash), fail-open search under the budget, seeded duplicate-proof extraction with sequence metadata, the no-delete-tool assertion, and both monthly-quota server modes |