Agent Engineering
Long-term Memory: Vector Retrieval
Let the Agent remember last month: through vector retrieval, inject user preferences, project config, and historical bugs into the current conversation.
An Analogy
Short-term Memory = Your Desk
The context window — limited space for information
→
Long-term Memory = Your Filing Cabinet
Vector database — retrieve relevant files onto the desk when needed
The desk can't hold everything, but you can pull the most relevant files from the cabinet at any time
Interactive Demo: Click a Question to Observe the Retrieval Process
🗄 记忆库
8 memory entries
Click to simulate different user queries
🔍 Vector Retrieval Process
—
Three Design Decisions
📌 Design Decision ①
What information should be stored in long-term memory? User preferences, project config, historical bugs, frequently used operations — these determine the Agent's level of personalization.
What information should be stored in long-term memory? User preferences, project config, historical bugs, frequently used operations — these determine the Agent's level of personalization.
📌 Design Decision ②
Retrieval quality depends on the Embedding model. "Fix the login API" and "login API returning 500 under concurrent load" — can the model match both to the same memory entry?
Retrieval quality depends on the Embedding model. "Fix the login API" and "login API returning 500 under concurrent load" — can the model match both to the same memory entry?
📌 Design Decision ③
Too many memories is also a problem: topK=5 means at most 5 entries are recalled each time. How do you ensure the most important memories rank first?
Too many memories is also a problem: topK=5 means at most 5 entries are recalled each time. How do you ensure the most important memories rank first?
Takeaway
Takeaway Short-term memory (context window) lets the Agent remember the current conversation; long-term memory (vector retrieval) lets the Agent remember last month. Together they allow the Agent to behave like a real assistant: understanding what you're doing now while also remembering your past preferences.