Enable agent memory - Amazon Bedrock

Enable agent memory

To configure memory for your agent, you must first enable memory and then optionally specify the retention period for the memory. You can enable memory for your agent when you create or update your agent.

To learn how to configure memory for your agent, select the tab corresponding to your method of choice and follow steps.

Console
To configure memory for your agent
  1. If you're not already in the agent builder, do the following:

    1. Sign in to the AWS Management Console using an IAM role with Amazon Bedrock permissions, and open the Amazon Bedrock console at https://console.aws.amazon.com/bedrock/.

    2. Select Agents from the left navigation pane. Then, choose an agent in the Agents section.

    3. Choose Edit in Agent Builder

  2. In the Agent details section, for Select model.

  3. In the Memory section, do the following:

    1. For Enable session summarization, select Enabled.

    2. (Optional) For Memory duration, enter a number between 1 and 365 to specify the memory duration for your agent. By default, agent retains conversational context for 30 days.

    3. For Maximum number of recent sessions, select a number for maximum number of recent sessions to store as memory.

    4. (Optional) You can optionally make changes to your session summarization prompt. To make changes, in the Session summarization prompt, choose View and edit.

  4. Make sure to first Save and then Prepare to apply the changes you have made to the agent before testing it.

API

To enable and configure memory for your agent, send an CreateAgent or UpdateAgent request with an Agents for Amazon Bedrock build-time endpoint.

In the Amazon Bedrock API, you specify the memoryConfiguration when you send a CreateAgent or UpdateAgent request.

The following shows the general format of the memoryConfiguration:

"memoryConfiguration": { "enabledMemoryTypes": [ "SESSION_SUMMARY" ], "storageDays":30, "sessionSummaryConfiguration": { "maxRecentSessions": 5 } }

You can optionally configure the memory retention period by assigning the storageDays with a number between 1 and 365 days.

Note

If you enable memory for the agent and do not specify memoryId when you invoke the agent, agent will not store that specific turn in the memory.