179 questions
No questions match those filters.
How do you implement persistent memory for an agent acr...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansAn agent has no memory across sessions unless something outside the model gives it one — every new session starts from nothing. The standard pattern:
- At the end of a session, have the model itself summarize what’s worth remembering — key facts, preferences, decisions — rather than storing the raw transcript.
- Embed that summary and store it in a vector database, alongside a structured record for anything that’s an exact fact rather than a fuzzy preference (a user’s plan tier belongs in a normal database field, not a vector search).
- At the start of the next session, embed the new query and retrieve the relevant stored memories by similarity.
- Inject the retrieved memories into the system prompt so the agent opens the conversation already knowing the relevant history.
Two things matter beyond the happy path. First, memory staleness — without some recency weighting, a three-month-old preference can outrank something the user said yesterday, so retrieval should bias toward recent memories rather than pure similarity. Second, and often skipped until it’s a compliance problem: a deletion path. If memories are personal data, there needs to be a way to delete a specific user’s stored memories entirely, not just stop writing new ones.