AWS Bedrock Memory
A runnable memory reference architecture for AWS Bedrock: a memory-augmented Converse loop plus the FIRST Bedrock Agents action-group memory integration from any vendor — recall under a hard budget, idempotent persistence, and a multi-tenant identity ladder. Install bedrock-memorysync from PyPI.
Two runnable patterns
pip install bedrock-memorysync
Before each converse call the user’s relevant memories are recalled under a hard 1.2s budget and injected as a system block; both turns persist afterwards with deterministic idempotency seeds. A slow or down memory service degrades to a memory-free turn — memory can never delay or break the model call. You own the boto3 client (region, credentials, retry policy).
| AWS AgentCore Memory | Mem0 | Zep / Supermemory / Letta | MemorySync | |
|---|---|---|---|---|
| Bedrock Agents action group | n/a (separate runtime) | ✗ none | ✗ nothing at all | ✓ first and only |
| Setup | control-plane resource + strategy activation polling | ✗ OSS sidecar: self-hosted Mem0 + an OpenSearch domain you operate | — | ✓ one API key |
| Extraction control | ✗ black-box strategies | your own infra to tune | — | ✓ managed pipeline with server-side gating |
| Cross-platform recall | ✗ AWS-only (actorId inside one account) | ⚠ self-hosted API | — | ✓ the same memories in LangChain, Flowise, Dify, voice agents… |
| Portability | ✗ total AWS lock-in | ⚠ | — | ✓ any cloud + Bedrock |
Pattern 2 — the Bedrock Agents action group
Deploy the Lambda with the included SAM template, attach the importable function schema, and any Bedrock Agent gains four curated memory functions. No memory vendor ships this — this is the first.
sam deploy --guided --parameter-overrides MemorySyncApiKey=ms_...
| Function | What it does |
|---|---|
remember | Store a fact/turn — idempotent seeds mean agent retries never duplicate |
recall_context | A prompt-ready block of the user’s relevant memories |
search_memories | Scored JSON list (≤25 results) |
forget_memory | Delete exactly ONE memory by id, loudly — a failed delete never looks deleted |
Identity ladder (multi-tenant safe): sessionAttributes.memorysync_user_id (your app sets it when invoking the agent) → a user_id parameter → the Bedrock sessionId. Every failure returns a structured responseState: FAILURE body the agent can react to — never an unhandled Lambda error surfaced as a wall of text.
Supported versions
| Surface | Requires | Verified on |
|---|---|---|
bedrock-memorysync 1.0.0 | Python 3.10+; boto3 1.34+ (Converse API); Lambda runtime python3.12 | 28 CI checks: the REAL boto3 client under botocore’s Stubber with verbatim request assertions (the recall system block, multi-turn accumulation, the no-memory-block shape when recall times out) plus the documented Bedrock Agents event shapes — identity ladder, idempotent retries, FAILURE response states, result caps, body truncation, the no-delete_all schema assertion, and quota modes |