Long-Term Memory
A component of the Agent memory mechanism referring to information persisted across sessions, such as user preferences and historical interaction patterns. It is typically stored in external databases or vector stores and dynamically retrieved into context to support personalized service.
Core Facts
An Agent's memory mechanism is typically divided into two categories: short-term memory and long-term memory, with long-term memory requiring external persistent storage such as vector databases, relational databases, and graph databases.
An agent's long-term memory can be subdivided into three categories: episodic memory, semantic memory, and procedural memory.
长期记忆Agent通常基于RAG(检索增强生成)技术构建,通过向量数据库将信息转化为高维向量并持久化存储
Timeline (last 90 days)
Adaptive agents require long-term memory to persist work traces and learned skills and to support efficient retrieval and updating.
For developers, the emergence of Muse suggests that task automation and long-term memory are current hot directions in AI applications.
Long-term memory and KV cache solve problems at different levels: KV cache is a short-term computational optimization during inference, and the cache becomes invalid once the conversation is reset; long-term memory, by contrast, must decide which information is worth writing to persistent storage, in what structure to organize it, and how to retrieve it and inject it into context in subsequent conversations.
Long-term memory is stored in separate storage, shared across sessions, and can be recalled at any time in any conversation.
Long-term memory involves compliance issues around privacy and data retention periods, an unavoidable constraint in product design.
The technical keys to companionship-type AI hardware include long-term memory, emotionally expressive speech synthesis, and the strategy design for proactively initiating interactions.
Common practices for isolating long-term memory by user include metadata filtering by user ID in a vector database, creating a separate collection for each user, or enforcing tenant constraints at the retrieval layer.
A complete memory module operates in three stages: before the task starts, read memory and inject it into the System Prompt; during task execution, use short-term memory to append to the message sequence; after the task ends, write new information back to persistent storage and clear the short-term memory.
Information worth persisting typically includes three categories: user preferences and habits, key conclusions and decisions in tasks, and external knowledge; what is not worth writing into long-term memory includes intermediate reasoning processes, the raw logs returned by tools, and small-talk content.
Two default practices for long-term memory: extraction should be placed asynchronously outside the reply path (because the facts of this conversation are already in this session's history); take a snapshot of memory at the start of each conversation (the memory block is placed before the history, and updating it midway would break the cache).
27 more timeline events
All Facts (20)
An Agent's memory mechanism is typically divided into two categories: short-term memory and long-term memory, with long-term memory requiring external persistent storage such as vector databases, relational databases, and graph databases.
90%VerifiedAn agent's long-term memory can be subdivided into three categories: episodic memory, semantic memory, and procedural memory.
80%Verified长期记忆Agent通常基于RAG(检索增强生成)技术构建,通过向量数据库将信息转化为高维向量并持久化存储
80%VerifiedLong-term memory is typically implemented with the help of vector databases (such as Chroma, Pinecone, Weaviate, Milvus, etc.) to enable semantic retrieval.
80%VerifiedEnterprise-grade Agent systems typically introduce external memory modules (such as vector databases) to store long-term memory, in order to overcome context window limitations.
80%VerifiedAgent Skills 具备上下文感知、可组合性和自描述性三个关键特征
80%VerifiedMemory poisoning is an evolved form of prompt injection attack, in which an attacker induces an AI to write false information into long-term memory storage, thereby influencing the system's subsequent interactions with all users.
75%VerifiedConversational recall benchmarks such as LoCoMo and LongMemEval measure question-answering ability over conversation history, rather than whether memory has changed the actual behavior of tool-using agents.
75%VerifiedLangGraph supports two storage modes: short-term memory (single-session context) and long-term memory (cross-session persistent storage).
75%VerifiedRAG(检索增强生成)是一种结合信息检索与生成式大模型的架构范式,模型生成答案前先根据用户查询从外部知识库检索最相关的文档片段,再将其作为上下文注入模型
70%VerifiedLarge models lack true long-term memory; every conversation starts from scratch, and they can only compensate by relying on external databases such as RAG (Retrieval-Augmented Generation).
70%VerifiedTwo default practices for long-term memory: extraction should be placed asynchronously outside the reply path (because the facts of this conversation are already in this session's history); take a snapshot of memory at the start of each conversation (the memory block is placed before the history, and updating it midway would break the cache).
65%VerifiedThere are generally two approaches to implementing persistent memory: writing information as structured text to an external file and reading it back each round, or using a vector database for semantic retrieval.
65%VerifiedLong-term memory stores persistent facts that must survive across sessions and runs, such as project decisions, environment configurations, and edge cases.
65%VerifiedConversational memory is stored in the form of memory summaries, which can become skewed as conversations grow, whereas global personalization instructions are hard-coded into the system prompt of every request and are not affected by memory degradation.
65%VerifiedAn Agent's short-term memory is typically the large model's context window, which has limited capacity and will be truncated or compressed as the number of conversation turns increases.
65%VerifiedThe author built a custom Memory Layer to handle short-term and long-term memory and continuously optimizes the CRUD algorithms.
65%VerifiedIncorrect memory retrieval can be worse than having no memory at all.
65%VerifiedIf persistently stored context data is leaked, it could expose a user's complete work history and sensitive information, posing a privacy risk.
65%VerifiedAI has no true long-term memory; every conversation starts fresh, and this can only be addressed by connecting an external database.
65%