A Python package for managing agent memory systems with persistence and semantic search capabilities.
AgentMem provides implementations of three core memory types essential for AI agents:
- Semantic Memory: Long-term factual knowledge storage with categories and tags
- Episodic Memory: Storage of specific past events and experiences with timestamps and context
- Procedural Memory: Long-term storage of skills and procedures with steps and domains
This work was inspired by Harrison Chase's course on DeepLearning.AI.
Each memory type supports:
- In-memory storage for quick experimentation
- File-based persistence for long-term storage
- Vector-based semantic search using embeddings (for more powerful similarity-based retrieval)
- Thread-safety for concurrent operations in multi-threaded applications
- Comprehensive logging and monitoring
pip install agentmem
Or install from source:
git clone https://github.com/maxgoff/memory.git
cd memory/agentmem
pip install -e .
from agentmem import SemanticMemory, EpisodicMemory, ProceduralMemory
# Create in-memory instances
semantic_mem = SemanticMemory()
episodic_mem = EpisodicMemory()
procedural_mem = ProceduralMemory()
# Store semantic facts
fact_id = semantic_mem.create(
content="Paris is the capital of France",
category="geography",
tags=["cities", "countries", "europe"]
)
# Store episodic experiences
event_id = episodic_mem.create(
content="User asked about Python file handling",
context={"user_id": "user123", "session": "abc456"},
importance=7
)
# Store procedural knowledge
procedure_id = procedural_mem.create(
content="Creating files in Python",
task="Create a new file",
steps=[
"Use open() with 'w' mode to create a file",
"Write content using the write() method",
"Close the file using close() or with statement"
],
domains=["programming", "python", "file operations"]
)
# Query memories
paris_facts = semantic_mem.query("Paris")
file_procedures = procedural_mem.query("file", domain="python")
recent_questions = episodic_mem.query("asked", min_importance=5)
For detailed documentation, examples, and guides, see the full documentation.
We welcome contributions! Please see our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.