What is Memory?
A Memory in Marvin is a specialized module that:- Stores information in a vector database for efficient retrieval
- Allows agents to remember facts, preferences, and knowledge
- Can be shared between different agents or kept private
- Persists across multiple conversations and program executions
Memory vs. Thread
It’s important to understand the difference between Memory and Thread:Feature | Thread | Memory |
---|---|---|
Persistence | Temporary (session) | Long-term (across sessions) |
Storage | SQLite database | Vector database |
Scope | All messages in a conversation | Specific information to remember |
Retrieval | Sequential access | Semantic search |
Purpose | Maintain conversation flow | Store specific knowledge |
Creating and Using Memory
Basic Memory Creation
To create a memory module:key
: A unique identifier for this memory (alphanumeric and underscores only)instructions
: Guidance for how the memory should be used
Attaching Memory to Agents
Memory modules are attached to agents:Sharing Memory Between Agents
Multiple agents can share the same memory:Memory Operations
Adding Information
Memory is typically populated through agent interactions, but you can also add information programmatically:Searching Memory
You can search memory directly:Deleting Memory
To remove specific memories:Memory Configuration
Memory Providers
Marvin uses a memory provider to handle the storage and retrieval of memories. By default, it uses a SQLite-based provider, but you can configure others:Auto-Use Memory
You can configure a memory to be automatically used before each agent interaction:Best Practices
- Specific Instructions: Provide clear instructions about what should be stored in each memory
- Descriptive Keys: Use meaningful keys that describe the memory’s purpose
- Memory Separation: Create separate memories for different types of information
- Selective Storage: Don’t store everything - focus on important information that needs to be remembered
- Regular Maintenance: Periodically review and clean up memories that are no longer needed