- Newest
- Most votes
- Most comments
Amazon Bedrock Agents provide built-in capabilities for managing long-term memory across multiple sessions, which can help address your requirements for persistent user-specific data.
To implement persistent memory per user:
-
Enable the memory feature for your Bedrock Agent. This allows the agent to retain conversational context across multiple sessions.
-
Use a unique memory identifier (memoryId) for each user. When invoking the agent, provide the same memoryId for the same user across different sessions. This ensures that the agent loads the stored memory for that specific user.
-
The agent will automatically store important information from each session as summaries in the memory store. These summaries serve as memory synopses of previous dialogues and can include user preferences, profile information, and other relevant details.
-
At the start of each new session, the agent will automatically load the memory associated with the provided memoryId, giving it access to the user's history and preferences.
To detect the end of a chat session and save content:
-
Use the 'endSession' parameter when invoking the agent. Set it to 'true' when you want to explicitly end a session. This will trigger the agent to associate the current session with a specific memory context.
-
Configure the 'idleSessionTimeout' for your agent. If a session becomes idle for the specified duration, it will automatically end, allowing the agent to process and store the session information.
-
When a session ends (either explicitly or due to timeout), the agent will automatically process the conversation and store relevant information in its long-term memory.
Best practices:
-
Use consistent memoryIds for users across sessions to ensure continuity.
-
Be mindful of the storage duration you set for memory retention. You can configure this based on your specific use case needs.
-
Leverage the agent's ability to summarize and store important information automatically. The built-in summarization process uses advanced prompt templates to enhance accuracy.
-
Monitor and manage memory usage. You can access and clear memory as needed using the agent's API.
-
Consider using session state attributes (SessionAttributes and PromptSessionAttributes) for additional control over what information is retained between sessions.
By utilizing these features and following these practices, you can effectively manage long-term memory in your Bedrock Agent chatbot, providing a personalized and context-aware experience for your users across multiple interactions.
Sources
Retain conversational context across multiple sessions using memory - Amazon Bedrock
Enabling complex generative AI applications with Amazon Bedrock Agents | AWS Machine Learning Blog
Agents for Amazon Bedrock now support memory retention and code interpretation (preview) | AWS News Blog
answered a year ago
Relevant content
asked 2 years ago
asked 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 6 months ago
