Retain conversational context across multiple sessions using memory
The Memory for Agents feature is in preview release for Amazon Bedrock and is subject to change. |
Memory provides your agent the ability to retain conversational context across multiple sessions and to recall past actions and behaviors. By default, your agent retains conversational context from a single session. To configure memory for your agent, enable the memory setting for your agent and specify the storage duration to retain the memory.
The conversational context is stored in the memory as sessions with each session given a session identifier (ID) that you provide when you invoke the agent. You can specify the same session Id across requests to continue the same conversation.
After you enable memory for your agent, the current session gets associated with a specific memory context when you invoke agent with same
sessionId
as the current session and with endSessions
set to 'true
', or when the
idleSessionTimeout
configured for the agent has timed out. This memory context is given a unique memory identifier. Your agent
uses the memory context to access and utilize the stored conversation history and conversation summaries to generate responses.
If you have multiple users, make sure to provide the same memory identifier (memoryId) for the same user. The agent stores the memory for each user against that memoryId and the next time you invoke the agent with the same memoryId, the summary of each session stored in the memory gets loaded to the current session.
You can access the memory at any time to view the summarized version of the sessions that are stored in the memory. You can also, at any time, clear the memory by deleting all the sessions stored in the memory.
Memory duration
If memory is enabled, your Bedrock Agent retains the sessions in the memory for up to thirty days. You can optionally configure the retention period by specifying a duration between 1 and 30 days. All session summaries beyond this duration will be deleted.
Supported models
You can only enable memory for Agents that are using the following models:
Model name | Model Id |
---|---|
Anthropic Claude 3 Sonnet v1 | anthropic.claude-3-sonnet-20240229-v1:0 |
Anthropic Claude 3 Haiku v1 | anthropic.claude-3-haiku-20240307-v1:0 |
Make sure that the model you are planning to use is available in your region. For more information, see Model support by AWS Region.