Memory Storage
Agent memory can be stored in different backends depending on the requirements for speed, persistence, and capacity.
Storage Options
In-memory (Python dict/list):
- Fastest access
- Lost on restart
- No capacity limit except available RAM
- Use for temporary task state
File system (JSON files):
- Persists across restarts
- Slower than in-memory
- Good for development and small-scale use
- Not suitable for concurrent access by multiple agents
Relational database (SQLite, PostgreSQL):
- Full ACID compliance — reliable writes
- Supports concurrent access from multiple agents
- SQL queries for filtering and aggregation
- Use for production persistent state
Key-value store (Redis):
- Very fast read/write
- Supports automatic expiry of keys
- Excellent for session state and caching
- Use for conversation state and rate limiting
Vector database (Pinecone, Chroma):
- Stores text as embeddings for semantic search
- Agents can retrieve memories by meaning, not just exact key
- Use for long-term memory and knowledge bases