General FAQ
Getting Started
What is agent memory and why do I need it?
Agent memory is the system that allows AI agents to retain information across conversations and sessions. Without memory, your agent starts fresh every time, losing valuable context, user preferences, and learned behaviors.
Think of it like the difference between:
- No memory: Every conversation is like meeting a stranger
- With memory: Conversations build on previous interactions, creating continuity
Key benefits:
- Personalized experiences
- Context-aware responses
- Learning from past mistakes
- Building long-term relationships with users
How is agent memory different from just storing chat history?
Chat history storage is linear and passive—it just saves everything. Agent memory is intelligent and active:
Chat History Storage:
User: I like Italian food
Agent: Great! What's your favorite dish?
[Later session]
User: What food do I like?
Agent: I don't have access to our previous conversationAgent Memory System:
User: I like Italian food
Agent: [Stores: User preference - Italian cuisine]
[Later session]
User: What food do I like?
Agent: [Retrieves preference] You mentioned you like Italian food!Key differences:
- Selective storage: Only important information is retained
- Semantic understanding: Concepts, not just text
- Intelligent retrieval: Relevant context is surfaced automatically
- Cross-session continuity: Works across different conversations
What are the main types of agent memory?
There are three primary types, each serving different purposes:
1. Working Memory (Short-term)
- Current conversation context
- Immediate task state
- Temporary variables and calculations
2. Episodic Memory (Events)
- Specific conversations and interactions
- User actions and behaviors
- Timestamped experiences
3. Semantic Memory (Knowledge)
- User preferences and traits
- Learned facts and rules
- General knowledge about domains
Example in practice:
# Working memory: Current task
current_task = "helping with recipe"
# Episodic memory: Specific events
past_cooking_session = {
"date": "2024-01-15",
"recipe": "pasta carbonara",
"user_feedback": "too salty"
}
# Semantic memory: General knowledge
user_profile = {
"dietary_restrictions": ["vegetarian"],
"cooking_skill": "beginner",
"cuisine_preferences": ["Italian", "Mexican"]
}See: The Three Tiers of Memory
When should I implement memory in my agent?
Implement memory when your agent needs to:
Immediate need indicators:
- Maintain context across multiple conversation turns
- Remember user preferences or settings
- Learn from past interactions
- Provide personalized responses
- Avoid repeating failed approaches
Strong indicators:
- Users complain about repetitive questions
- Agent makes the same mistakes repeatedly
- Conversations lack continuity
- User onboarding is repetitive
- Decision-making could benefit from historical context
Start simple: Even basic preference storage can significantly improve user experience.
What’s the difference between memory and search/RAG?
This is a common confusion. Here’s the breakdown:
Search/RAG (Retrieval Augmented Generation):
- Searches static knowledge bases
- Retrieves factual information
- Answers “What is X?” type questions
- Knowledge doesn’t change based on interactions
Agent Memory:
- Stores dynamic, personal information
- Remembers user-specific context
- Learns and adapts over time
- Knowledge grows with each interaction
Example comparison:
RAG Query: "What is the capital of France?"
→ Searches knowledge base → "Paris"
Memory Query: "What cities has this user visited?"
→ Searches user's personal history → "Paris, Tokyo, New York"They work together:
- Use RAG for factual knowledge
- Use memory for personal context
- Combine for powerful, personalized experiences
See: Memory vs Search detailed comparison
Architecture Decisions
Should I use vector databases or traditional databases for memory?
The choice depends on your use case:
Vector Databases (ChromaDB, Pinecone, Weaviate):
- Best for: Semantic similarity search, unstructured data
- Use when: You need to find conceptually similar memories
- Examples: “Find conversations about cooking” (matches pasta, recipes, kitchen)
Traditional Databases (PostgreSQL, MongoDB):
- Best for: Structured data, exact matching, complex queries
- Use when: You have clear schemas and relationships
- Examples: User profiles, preferences, specific facts
Hybrid Approach (Recommended):
# Vector store for semantic search
vector_db.store_memory("User loves spicy food", embedding)
# Traditional DB for structured data
user_db.update_preference("spice_level", "high")
user_db.update_metadata("last_interaction", timestamp)How much memory should I store per user?
Start with these guidelines:
Minimal (Good starting point):
- User preferences (10-50 key-value pairs)
- Last 5-10 significant interactions
- Basic profile information
Moderate (Most applications):
- Detailed preference profiles
- Last 50-100 interactions with summaries
- Learning patterns and behaviors
- Task-specific context
Extensive (Advanced use cases):
- Complete interaction history
- Detailed behavioral analytics
- Multi-modal memory (text, actions, context)
- Complex relationship graphs
Storage estimation:
Minimal: ~1-10 KB per user
Moderate: ~100 KB - 1 MB per user
Extensive: ~10-100 MB per userRemember: More isn’t always better. Focus on memory that improves user experience.
How do I handle memory privacy and data protection?
Essential considerations for responsible memory systems:
Data Minimization:
- Only store what improves user experience
- Regular cleanup of outdated information
- Clear retention policies
User Control:
- Allow users to view their stored memories
- Provide options to edit or delete information
- Transparent about what’s being remembered
Security:
- Encrypt sensitive memory data
- Secure access controls
- Regular security audits
Compliance:
- GDPR “right to be forgotten”
- CCPA data transparency requirements
- Industry-specific regulations
Implementation example:
class MemoryManager:
def get_user_memories(self, user_id):
"""Allow users to see their stored data"""
return self.memory_store.get_all(user_id)
def delete_user_memory(self, user_id, memory_id):
"""Implement right to deletion"""
return self.memory_store.delete(user_id, memory_id)
def anonymize_expired_data(self):
"""Regular cleanup of old data"""
expired = self.memory_store.find_expired()
for memory in expired:
self.memory_store.anonymize(memory.id)See: Privacy & Ethics
Common Misconceptions
”Memory will solve all my context problems”
Reality: Memory is one tool in a larger context management strategy.
Memory helps with:
- Long-term continuity across sessions
- Personal preferences and learned behaviors
- Historical context and patterns
Memory doesn’t solve:
- Long conversation context windows
- Complex multi-step reasoning chains
- Real-time information needs
Better approach: Combine memory with other techniques like conversation summarization and context prioritization.
”More memory always equals better performance”
Reality: Irrelevant or outdated memory can hurt performance.
Quality over quantity:
- Store meaningful, actionable information
- Implement relevance scoring and filtering
- Regular memory cleanup and maintenance
Example of good vs. bad memory storage:
# Bad: Store everything
memory.store("User said: 'um, well, I guess I like, you know, pizza'")
# Good: Store the essence
memory.store("User preference: enjoys pizza", confidence=0.8)“Building memory is too complex for my use case”
Reality: You can start simple and evolve.
Minimum viable memory:
# Simple key-value preference storage
user_prefs = {
"name": "Alex",
"timezone": "PST",
"communication_style": "formal"
}Evolutionary path:
- Start with basic preferences
- Add interaction summaries
- Implement semantic search
- Add learning and adaptation
You don’t need to build everything at once!
Next Steps
I’m convinced! How do I get started?
Phase 1: Basic Preferences
- Identify 3-5 key user preferences to track
- Set up simple storage (even a JSON file works initially)
- Modify your agent to use these preferences
Phase 2: Interaction Memory
- Start storing conversation summaries
- Implement basic retrieval for context
- Add memory to your agent’s prompt
Phase 3: Semantic Understanding
- Upgrade to vector storage for similarity search
- Implement automatic memory updates
- Add memory relevance scoring
Resources to help:
What are the most common beginner mistakes?
1. Storing too much irrelevant data
- Solution: Be selective about what to remember
2. Not implementing memory retrieval
- Solution: Build search/query capabilities from day one
3. Ignoring memory freshness
- Solution: Add timestamps and relevance scoring
4. Over-engineering the first version
- Solution: Start simple, iterate based on real usage
5. Forgetting about user privacy
- Solution: Design with privacy and user control in mind
6. Not testing memory accuracy
- Solution: Implement validation and feedback loops
See detailed guidance: Common Pitfalls
For more specific questions, check out our Technical FAQ and Troubleshooting Guide.