Memory
Give your agents persistent memory across conversations.
While threads maintain conversation history within a single interaction, Marvin’s memory feature allows agents to store and recall information across multiple conversations. This is useful for:
- Remembering user preferences across sessions
- Building up knowledge bases over time
- Sharing information between different agents
- Maintaining context across multiple interactions
- Creating more personalized user experiences
How Memory Works
Marvin memories are implemented as vector stores that allow agents to store and retrieve information using natural language. Each memory has a unique key
that identifies it and instructions that guide how it should be used.
Creating Memory Modules
To create a memory module, you need to provide a key
and instructions
:
Memory Keys
The key
uniquely identifies a memory module and must be consistent across uses to access the same stored information. Choose descriptive, unique keys for different types of information:
Memory Instructions
The instructions
tell agents how to use the memory - what to store, when to access it, and how to format information:
Using Memories
With Tasks
Attach memories to tasks to provide context:
With Agents
Give agents persistent memory across all their tasks:
Example: Weather Tracking
Here’s a complete example of using memory to track weather information:
Memory Providers
Marvin supports several vector store backends for memory storage:
ChromaDB (Default)
ChromaDB is the default provider, offering a simple, file-based vector store:
LanceDB
LanceDB provides a fast, efficient vector store with columnar storage:
Configure LanceDB:
PostgreSQL
Use PostgreSQL with pgvector for scalable, production-ready vector storage:
Configure PostgreSQL:
All Providers
Install all memory providers at once: