Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions site/src/config/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ sidebar:
- label: Memory Stores
items:
- docs/community/memory-stores/overview
- docs/community/memory-stores/agentcore-memory-store
- label: Session Managers
items:
- docs/community/session-managers/agentcore-memory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
title: AgentCore Memory Store
community: true
description: Amazon Bedrock AgentCore Memory as a MemoryStore for long-term recall and server-side extraction
integrationType: memory-store
languages: TypeScript
sidebar:
label: "AgentCore Memory Store"
project:
npm: https://www.npmjs.com/package/bedrock-agentcore
github: https://github.com/aws/bedrock-agentcore-sdk-typescript/tree/main/src/memory/integrations/strands
maintainer: aws
service:
name: Amazon Bedrock AgentCore
link: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory.html
---

The [AgentCore Memory Store](https://github.com/aws/bedrock-agentcore-sdk-typescript/tree/main/src/memory/integrations/strands)
implements the Strands [`MemoryStore`](../../user-guide/concepts/memory/overview.md#custom-stores)
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`](../../user-guide/concepts/memory/overview.md) like any other store. See
the [Getting Started](../../user-guide/concepts/memory/overview.md#getting-started) section for more information.

## Requirements

- `bedrock-agentcore >= 0.4.1`
- `@strands-agents/sdk >= 1.5.0`
- An [Amazon Bedrock AgentCore Memory](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory.html) resource, with AWS credentials to reach it

## Installation

```bash
npm install bedrock-agentcore @strands-agents/sdk
```

## Usage

`createAgentCoreMemoryStores` 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.

```typescript
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:

```typescript
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

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. |

Comment thread
opieter-aws marked this conversation as resolved.
Resolved
See the [package README](https://github.com/aws/bedrock-agentcore-sdk-typescript/tree/main/src/memory/integrations/strands)
for the full option reference, including subtree reads and over-fetch tuning.

## Notes

- **One writable store per session.** Mark at most one store `writable` for a given
`(actorId, sessionId)`: because writes are namespace-free, multiple writable stores would
emit duplicate events to the same `(memoryId, actorId, sessionId)` stream.
`createAgentCoreMemoryStores` enforces 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.

## References

- [Integration source](https://github.com/aws/bedrock-agentcore-sdk-typescript/tree/main/src/memory/integrations/strands)
- [`bedrock-agentcore` on npm](https://www.npmjs.com/package/bedrock-agentcore)
- [Amazon Bedrock AgentCore Memory](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory.html)
- [Report an issue](https://github.com/aws/bedrock-agentcore-sdk-typescript/issues/new/choose)