AgentCore Memory Store
The AgentCore Memory Store
implements the Strands MemoryStore
interface on top of Amazon Bedrock AgentCore Memory. Search maps to AgentCore’s
retrieveMemoryRecords, and conversation turns are ingested for
server-side memory extraction into long-term records. Attach it to an agent through a
MemoryManager like any other store. See
the Getting Started section for more information.
Requirements
Section titled “Requirements”bedrock-agentcore >= 0.4.1@strands-agents/sdk >= 1.5.0- An Amazon Bedrock AgentCore Memory resource, with AWS credentials to reach it
Installation
Section titled “Installation”npm install bedrock-agentcore @strands-agents/sdkcreateAgentCoreMemoryStores builds one store per namespace over a shared client, and you
attach them to an agent through a MemoryManager. Mark a namespace writable to capture the
conversation into it; a namespace left unmarked stays read-only for recall.
import { Agent, MemoryManager, BedrockModel } from '@strands-agents/sdk'import { createAgentCoreMemoryStores } from 'bedrock-agentcore/memory/strands'
const stores = createAgentCoreMemoryStores({ memoryId: 'mem-abc', actorId: 'user-123', sessionId: 'session-1', namespaces: [ { namespace: '/facts/{actorId}', writable: true }, { namespace: '/preferences/{actorId}', minScore: 0.5 }, ], extraction: true,})
const agent = new Agent({ model: new BedrockModel(), memoryManager: new MemoryManager({ stores }),})A single AgentCoreMemoryStore can also be constructed directly when you only need one
namespace:
import { AgentCoreMemoryStore } from 'bedrock-agentcore/memory/strands'
const store = new AgentCoreMemoryStore({ memoryId: 'mem-abc', actorId: 'user-123', sessionId: 'session-1', namespace: '/facts/{actorId}', writable: true, extraction: true,})Configuration
Section titled “Configuration”In createAgentCoreMemoryStores, namespace, writable, and minScore are set per
namespaces entry, while everything else is passed once at the top level. The direct
AgentCoreMemoryStore constructor takes all options in one flat config.
| Option | Type | Description |
|---|---|---|
memoryId | string | The AgentCore Memory resource to read from and write to. |
actorId | string | Identifies the user; substituted into {actorId} placeholders. |
sessionId | string | Identifies the conversation; substituted into {sessionId} placeholders. |
namespace | string | Exact namespace prefix for recall. Use namespacePath instead to query a whole subtree. |
writable | boolean | Enables writing conversation turns for extraction. Defaults to false. |
extraction | boolean | object | Turns on server-side extraction, with optional cadence and filter config. |
minScore | number | Drops recalled records below this relevance threshold. |
See the package README for the full option reference, including subtree reads and over-fetch tuning.
- One writable store per session. Mark at most one store
writablefor a given(actorId, sessionId): because writes are namespace-free, multiple writable stores would emit duplicate events to the same(memoryId, actorId, sessionId)stream.createAgentCoreMemoryStoresenforces this and throws if more than one store is writable. - Placeholders resolve at construction. Only
{actorId}and{sessionId}are substituted client-side, into the namespace used for recall. Any other placeholder in a namespace causes construction to throw. Provision strategies with{actorId}/{sessionId}-only templates to match. - Eventual consistency. Writes and extraction are asynchronous, so a fact written this turn may not be retrievable on the next one.