Long-term memory - Amazon Bedrock AgentCore

Amazon Bedrock AgentCore is in preview release and is subject to change.

Long-term memory

Long-term memory stores structured information extracted from raw agent interactions, which is retained across multiple sessions. Instead of saving all raw conversation data, long-term memory preserves only the key insights such as summaries of the conversations, facts and knowledge (semantic memory), or user preferences. For example, if a customer tells the agent their preferred shoe brand during a chat, the AI agent stores this as a long-term memory. Later, even in a different conversation, the agent can remember and suggest the shoe brand, making the interaction personalized and relevant.

In AgentCore Memory, you can add memory strategies as part of CreateMemory operation which decides what information to extract from raw conversations. These strategies are configurations that intelligently capture main concepts from interactions (sent as events in the CreateEvent operation) and persists them. The strategies currently supported are summarization, semantic memory (facts and knowledge), and user preferences. AgentCore Memory allows two ways to add these strategies to the memory:

  • Built-in strategies (managed by AgentCore and runs in a service-managed account)

  • Custom strategies that let you append to the system prompt and choose the model. This lets you tailor the memory extraction and consolidation to your specific domain or use case

Long-term memory generation is an asynchronous process that runs in the background and automatically extracts insights after raw conversation/context is stored in Short Term Memory via CreateEvent. This efficiently consolidates key information without interrupting live interactions. As part of the long-term memory generation, AgentCore Memory performs the following operations:

  • Extraction: Extracts information from raw interactions with the agent

  • Consolidation: Consolidates newly extracted information with existing information in the AgentCore Memory.

Once long-term memory is generated, you can retrieve these extracted memories to enhance your agent's responses with persistent knowledge. Extracted memories are stored as memory records and can be accessed using the GetMemoryRecord, ListMemoryRecords, or RetrieveMemoryRecords operations. The RetrieveMemoryRecords operation is particularly powerful as it performs a semantic search to find memory records that are most relevant to the query. For example, when a customer asks about running shoes, the agent can use semantic search to retrieve related memory records, such as customer's preferred shoe size, favorite shoe brands, and previous shoe purchases. This lets the AI support agent provide highly personalized recommendations without requiring the customer to repeat information they've shared before.