A lightweight, PostgreSQL-backed memory management system for AI agents and chatbots
Project description
MemSuite
A lightweight, PostgreSQL-backed memory management system for AI agents and chatbots. MemSuite provides structured storage and retrieval of conversation history, agent interactions, and contextual data.
🚀 Current Status: Phase 1 (Complete)
✅ Phase 1: Core Memory Storage & Retrieval
A fully functional memory system with:
- SQLAlchemy-based persistence - PostgreSQL database integration with connection pooling
- Memory Store API - Simple write/read interface for agent memory operations
- UUID-based indexing - Efficient querying by user, session, and agent IDs
- Flexible memory types - Support for different categories of memories (conversation, facts, preferences, etc.)
- Metadata support - JSON-based metadata storage for extensible memory attributes
Core Components
MemoryStore- High-level API for writing and reading memoriesSQLMemoryDB- Database layer with connection management and query buildingMemorymodel - SQLAlchemy ORM model with indexed fields for fast retrieval
Quick Start
import os
from uuid import uuid4
from dotenv import load_dotenv
from memsuite.store import MemoryStore
# Load environment variables
load_dotenv()
# Initialize with your PostgreSQL connection string from environment
store = MemoryStore(os.getenv("DB_URL"))
user_id = uuid4()
session_id = uuid4()
# Write a memory
store.write(
user_id=user_id,
session_id=session_id,
agent_id="chatbot",
content="User prefers concise responses",
memory_type="preference",
metadata={"importance": "high"}
)
# Read memories
memories = store.read(
user_id=user_id,
session_id=session_id,
memory_type="preference"
)
🗺️ Roadmap
Phase 2: Context Building & Token Budgeting
- Smart context window management
- Automatic memory prioritization and selection
- Token counting and budget enforcement
- Sliding window strategies for long conversations
Phase 3: Long-term Memory (Embeddings)
- Vector embeddings for semantic search
- Similarity-based memory retrieval
- Integration with embedding models (OpenAI, local models)
- Hybrid search (keyword + semantic)
Phase 4: Multi-agent Policies
- Agent-specific memory isolation and sharing
- Memory access control and permissions
- Cross-agent memory coordination
- Agent collaboration patterns
Phase 5: Dashboard & Hosted Options
- Web-based memory visualization dashboard
- Real-time memory analytics
- Cloud-hosted SaaS offering
- API gateway and authentication
📦 Installation
pip install memsuite
Or with UV:
uv pip install memsuite
⚙️ Configuration
-
Copy
.env.exampleto.env:cp .env.example .env
-
Set your database URL in
.env:DB_URL=postgresql://user:password@host:port/database
-
Never commit
.envto version control - it's already in.gitignore
🛠️ Requirements
- Python >= 3.10
- PostgreSQL database
- Dependencies: SQLAlchemy, FastAPI, psycopg2-binary
📝 Example Usage
See examples/simple_chat_backend.py for a complete chatbot integration example.
🤝 Contributing
Contributions are welcome! This project is in active development.
📄 License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memsuite-0.1.0.tar.gz.
File metadata
- Download URL: memsuite-0.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd8b393660be4f37cacf823b82d7cfde8d394d8934e73938f138129ed778e586
|
|
| MD5 |
a8cb6ce9b94c735560646289409d6aeb
|
|
| BLAKE2b-256 |
672d473ae883865a60ebafeb409cdcb29fc96fb2f431afd8f82de731ab9b42db
|
File details
Details for the file memsuite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memsuite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f1fec78784eaa3947c70a6930dc85b3c8eb21eab5dc27554eef35ca518f4e84
|
|
| MD5 |
6a68ebc19eb4ddc259f864e6da5e75dc
|
|
| BLAKE2b-256 |
6e3b145f11d23807bbf2a1ea2c574ab0ebfcd5ed8ec47016764b8c22fa573cc3
|