AgentCore Memory
AWS Bedrock AgentCore is a managed memory service — sessions, events, retrieval, summarization all server-side. agentfootprint’s
AgentCoreStoremaps theMemoryStoreinterface onto AgentCore’s session/event model so you can use it as a drop-in forInMemoryStorein production.
Install
Section titled “Install”npm install @aws-sdk/client-bedrock-agent-runtimeLazy peer-dep declared in peerDependenciesMeta with optional: true. AWS credentials resolved via the standard SDK chain (env, profile, IAM role).
Subpath import
Section titled “Subpath import”import { AgentCoreStore } from 'agentfootprint/memory-agentcore';Subpath keeps the main barrel small + lets bundlers tree-shake when AgentCore isn’t used.
const store = new AgentCoreStore({ memoryId: 'arn:aws:bedrock:us-east-1:000000000000:memory/demo', _client: fakeClient,});
const memory = defineMemory({ id: 'agentcore-window', description: 'Last 10 turns persisted in AgentCore Memory.', type: MEMORY_TYPES.EPISODIC, strategy: { kind: MEMORY_STRATEGIES.WINDOW, size: 10 }, store,});The store implements every MemoryStore method except search(). Pair with defineMemory({ store, ... }) like any other adapter.
Mapping to AgentCore primitives
Section titled “Mapping to AgentCore primitives”MemoryStore call | AgentCore mapping |
|---|---|
MemoryIdentity tuple | AgentCore sessionId (derived deterministically from identity) |
MemoryEntry | AgentCore event payload (JSON envelope keyed by entry id) |
put / putMany | PutMemoryEvent (sequentialized — no batch API) |
get | GetMemoryEvent |
list | ListMemoryEvents (cursor via nextToken) |
delete | DeleteMemoryEvent |
forget | DeleteMemorySession |
seen / recordSignature | In-process shadow Map (NOT durable — see caveats) |
feedback / getFeedback | In-process shadow Map (NOT durable) |
search | NOT exposed — see caveats |
Caveats (call out before adopting)
Section titled “Caveats (call out before adopting)”These are documented in the JSDoc; promoted here for visibility:
-
putIfVersionis emulated — AgentCore’sPutMemoryEventoverwrites unconditionally. The adapter does read-then-write inside a JS critical section. Adequate for single-writer-per-session deploys; weaker for multi-writer. -
Built-in summarization may double-compress — AgentCore has its own server-side summarization. Mixing
defineMemory({ strategy: SUMMARIZE })on top will double-compress. Pick one summarizer. -
seen/feedbackare in-process — they don’t survive process restart. For durable recognition, useRedisStoreinstead (or layer Redis on top of AgentCore). -
search()not exposed — AgentCore’s retrieval API is opaque (server-side retrieval pipeline). Mapping it toMemoryStore.search(cosine + threshold) would be a leaky abstraction. A separateagentcoreRetrieve()helper is planned for v2.5. -
AWS rate limits apply — production deployments should wrap with
withRetryand budget calls per session. AWS SDK has built-in retry; tune via the SDK’smaxAttemptsconfig.
Test injection
Section titled “Test injection”AgentCoreStore({ _client: ... }) accepts a mock-injected client for tests — no live AWS account needed for CI:
const mockClient = { putEvent: async () => ({}), getEvent: async () => ({ payload: '...' }), listEvents: async () => ({ events: [] }), deleteEvent: async () => ({}), deleteSession: async () => ({}),};
const store = new AgentCoreStore({ memoryId: 'test', _client: mockClient });When to use AgentCore vs Redis vs InMemory
Section titled “When to use AgentCore vs Redis vs InMemory”- Production AWS-native deployment — AgentCore is the natural choice if you’re already on Bedrock.
- Production multi-tenant with low latency + durable feedback — Redis (RedisStore).
- Dev / test / single-process — InMemoryStore.
- Hybrid — combine: AgentCore for causal snapshots; Redis for hot recent + feedback.
Next steps
Section titled “Next steps”- Memory store adapters — full adapter matrix
- Memory guide — types × strategies that pair with this store
- AWS Bedrock provider — paired LLM provider