Skip to main content

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_numbers are 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() returns memorysync_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

strands_memorysync-1.0.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strands_memorysync-1.0.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

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

Hashes for strands_memorysync-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4f2abdb94af92110ed19493e2caeadb9973f0223dc0795aff4089b26e6d38d76
MD5 760569b0cccebeb290f5c31b6085333b
BLAKE2b-256 7aba22c9e905787a3ce1be71f8bb69d1dfc917b5622ec205c4c5a07adb6b8769

See more details on using hashes here.

File details

Details for the file strands_memorysync-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for strands_memorysync-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8537855cb77cde6069f0bbef4e0414b13ca64669c2ae75b47008f45e3bb76773
MD5 022e6f5adbaf98a2f6a0a716a23712b2
BLAKE2b-256 2cb73067d1cbcdbea782338a37ed1d0b28937bed3bcafcd20320ab905b09468a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page