AWS Builder Center
Memory Is Useful - Until Your AI Remembers Too Much

Memory Is Useful - Until Your AI Remembers Too Much

Understanding session memory, long-term agent memory, retention, privacy and deletion on AWS.

A useful AI assistant should not forget everything the moment a user sends the next message.
If someone says, “I am traveling to Seattle next week,” the assistant should understand what “my trip” means later in the conversation. If a returning customer has already shared a preferred language or communication style, remembering it may create a smoother experience.
But memory also creates a difficult question:
How much should an AI remember and for how long?

The model does not remember by itself

A foundation model does not automatically remember previous conversations.
The application creates memory by storing messages, summaries or extracted facts and providing the relevant information to the model during a later request.
This distinction matters because memory is not magic. It is stored data, which means it needs the same privacy, access and deletion controls as any other customer information.

Session memory keeps the conversation together

Session memory is short-term context used during one conversation or task.
It may include:
  • Earlier user messages
  • Previous model responses
  • Tool results
  • Temporary preferences
  • The current task’s progress
  • State needed to recover from an interruption
Amazon Bedrock Session Management APIs can store interaction history and state checkpoints, including text and images. An application can retrieve that state later and continue the session without asking the user to start again.
Ending and deleting a session are different actions. EndSession closes the session so no more information can be added, but its content can still be retrieved. DeleteSession removes the session and its stored data.  Amazon Bedrock Session Management 
Session memory should usually disappear when the task is finished or after a reasonable period of inactivity. A temporary support conversation does not automatically need to become a permanent customer profile.

Long-term memory follows the user across sessions

Long-term memory stores information that may remain useful after the current conversation ends.
Instead of loading an entire conversation every time, an application may save selected insights such as:
  • User preferences
  • Important facts
  • Conversation summaries
  • Previous decisions
  • Completed tasks
  • Relevant past experiences
Amazon Bedrock AgentCore Memory separates short-term events from long-term memory records. Short-term memory stores raw interactions. Configured memory strategies can process those events and extract structured information for long-term use.
For example, a long conversation may be reduced to one durable memory: the user prefers email communication.
This can improve personalization, but it also creates risk. The extracted information could be sensitive, outdated, misunderstood or no longer relevant.  AgentCore memory types 

Remembering everything is not the goal

More memory does not always produce a better assistant.
Too much memory can:
  • Increase privacy exposure
  • Bring irrelevant history into new conversations
  • Preserve incorrect assumptions
  • Make responses feel intrusive
  • Increase storage and retrieval costs
  • Allow one user’s information to appear in another user’s session
  • Make deletion harder to complete
A better rule is to remember only information that has a clear future purpose.
Before saving something, ask:
  1. Will this information improve a future interaction?
  1. Did the user reasonably expect it to be saved?
  1. Is it safe and necessary to retain?
  1. When should it expire?
  1. How can the user view, correct or delete it?

Retention should be a deliberate setting

Memory should not remain indefinitely simply because nobody created a deletion policy.
When creating an AgentCore Memory resource, raw short-term events can be assigned a retention period of up to 365 days. The expiration setting is applied to each event when it is written.
Changing the retention setting later affects new events, not events that were already stored. Existing events keep the expiration assigned when they were created.  Creating an AgentCore Memory 
Long-term records need their own lifecycle decisions. A raw conversation may expire while an extracted preference or summary continues to exist.
Your retention policy should therefore cover both:
  • Raw session events
  • Information extracted into long-term memory

Deletion must remove more than the conversation

Suppose a user asks the application to forget a previous conversation.
Deleting the visible chat may not be enough if the system has already extracted facts from it into long-term memory.
AgentCore Memory provides separate operations for deleting individual short-term events and deleting individual long-term memory records. Applications should connect these capabilities to a clear user-facing deletion process.  Delete an event  and  delete a memory record 
A complete deletion workflow may need to remove:
  • The original session
  • Raw conversation events
  • Extracted preferences and summaries
  • Application database records
  • Cached copies
  • Search indexes or downstream replicas
Do not assume that deleting one layer automatically removes every derived copy.

Keep each user’s memory separate

Every memory request must be connected to an authenticated user.
AgentCore Memory organizes events by identifiers such as actorId and sessionId, while long-term records can be organized using namespaces. Amazon Bedrock Agents can associate stored session summaries with a memoryId.
These identifiers help organize memory, but they do not replace authorization. The application must verify that the signed-in user is allowed to access the requested memory.
Never trust a user-supplied memory identifier without checking ownership.

Protect the memory itself

Memory may contain more sensitive information than a single prompt because it can reveal patterns across many conversations.
Use least-privilege IAM permissions, encryption and careful logging. Amazon Bedrock Sessions supports customer-managed AWS KMS keys for an additional layer of encryption.
Avoid storing passwords, access keys, authentication tokens or information that the application does not genuinely need.
Users should also know when memory is enabled, what may be remembered and how they can remove it.

Final takeaway

AI memory should make users repeat themselves less not make them wonder how much the application knows about them.
Use session memory for temporary continuity. Use long-term memory only for selected information with a clear future purpose. Set retention intentionally, keep every user’s data isolated and build deletion across both raw conversations and extracted memories.
The best AI memory is not the one that remembers everything. It is the one that knows what is useful to keep and what it should forget.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article