Agent Memory

Agent memory is the mechanism by which an agent persists information across sessions or beyond the scope of a single context window, allowing it to recall prior interactions, learned facts, or user preferences in future runs.

Details

Memory is distinct from context (which is assembled per request): memory is written to a durable store (database, file, vector database, or dedicated memory service) during one session and retrieved into context during a later session. The agent runtime typically manages memory read/write operations, and context engineering determines how recalled memories are selected, ranked, and formatted before injection into the prompt.

Because memory persists across sessions and is typically treated as trusted input, it is a specific attack surface for context poisoning (an attacker writes malicious entries that influence future agent behavior) and persistence attacks (compromised memory survives session resets). Mitigations include input validation before writes, periodic auditing of memory stores, and treating recalled memories as untrusted content.

Examples

  • An agent that stores a summary of each conversation and loads relevant summaries at the start of new sessions.
  • A coding agent that remembers project-specific conventions and preferences across work sessions.
  • A customer-support agent that recalls a user's prior issues and resolutions.

Synonyms

long-term memory, persisted memory, agent persistence