Manage agent memory - Amazon Bedrock

Manage agent memory

The Memory for Agents feature is in preview release for Amazon Bedrock and is subject to change.

After you enable memory for your agent, you can view sessions stored in the memory or delete all sessions from memory.

View memory sessions

The agent stores the memory for each session against the unique memory identifier (memoryId) provided for each user when you invoke the agent. The next time you invoke the agent with the same memoryId, the entire memory is loaded to the session. After you end the session, the agent generates a summarized version of the session and stores the session summary.

Note

It can take several minutes after you end your session for the session summaries to appear in the console or in the API response.

To learn how to view the session summaries, select the tab corresponding to your method of choice and follow the steps.

Console
To view session summaries,
  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. In the Test window, choose the expand icon and choose Memory tab.

    If you are in Agent builder page, in the Memory section, choose View memory.

  4. You can also view memory sessions when you are testing your agent. To view sessions stored in the memory when you are testing,

    1. In the test window, choose Show trace and then choose Memory tab.

      Note

      If you are viewing memory sessions when you are testing your agent, you can view the session summary only after the latest session has ended. If you try to view memory sessions when the current session is in progress you will be informed that session summary is being generated and it will take time to generate the sessions. You can force end the current session by choosing the broom icon.

API

To view memory sessions of your agent, send a GetAgentMemory request (see link for request and response formats and field details) with an Agents for Amazon Bedrock build-time endpoint.

The following fields are required:

Field Short description
agentId The identifier of the agent
agentAliasId The identifier of the agent alias
memoryId The identifier of the memory that has the session summaries
memoryType The type of memory. Valid value: SESSION_SUMMARY
Note

If you are viewing memory sessions when you are testing your agent, you can view the session summary only after the latest session has ended. If you try to view memory sessions when the current session is in progress you will be informed that session summary is being generated and it will take time to generate the sessions. You can force end the current session by sending an InvokeAgent request and specifying Y for the endSession field.

Delete session summaries from the alias

To learn how to delete the session summaries, select the tab corresponding to your method of choice and follow the steps.

Console
To delete session summaries,
  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

  4. In the Memory section, choose View memory and choose Memory tab.

  5. To choose the session summaries you want to delete,
    1. In the Find memory sessions, select the filter you want to use to search for the sessions summaries you want to delete.

    2. Specify the filter criteria.

  6. Choose Delete alias memory and then choose Delete.

API

To delete session summaries, send a DeleteAgentMemory request (see link for request and response formats and field details) with an Agents for Amazon Bedrock build-time endpoint.

The following fields are required:

Field Short description
agentId The identifier of the agent.
agentAliasId The identifier of the agent alias.

The following field is optional.

Field Short description
memoryId The identifier of the memory that has the session summaries

Disable memory for your Amazon Bedrock agent

You can disable memory for your agent at any time. You cannot access memory sessions after you disable memory for your agent.

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.

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

Console
To disable memory for your agent,
  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

  4. In the Memory section, choose Disable.

API

To disable memory, send a UpdateAgent request (see link for request and response formats and field details) with an Agents for Amazon Bedrock build-time endpoint. Send the request without specifying the memoryConfiguration structure. This will disassociate the memory from the agent.