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 with minimal configuration.
Features
- PostgreSQL persistence with SQLAlchemy ORM and connection pooling
- Simple API for reading and writing agent memories
- UUID-based indexing for efficient queries by user, session, and agent
- Flexible memory types to categorize memories (conversation, facts, preferences, etc.)
- Metadata support via JSON for extensible memory attributes
Installation
pip install memsuite
Using UV:
uv pip install memsuite
Quick Start
import os
from uuid import uuid4
from dotenv import load_dotenv
from memsuite import MemoryStore
load_dotenv()
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="assistant",
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"
)
Configuration
- Create a
.envfile in your project root:
DB_URL=postgresql://user:password@host:port/database
- Load environment variables with
python-dotenvor your preferred method.
Requirements
- Python >= 3.10
- PostgreSQL database
- SQLAlchemy, psycopg2-binary, pydantic, python-dotenv
API Reference
MemoryStore
The primary interface for memory operations.
from memsuite import MemoryStore
store = MemoryStore(database_url)
write()
Store a memory record.
| Parameter | Type | Description |
|---|---|---|
user_id |
UUID |
Unique identifier for the user |
session_id |
UUID |
Unique identifier for the session |
agent_id |
str |
Identifier for the agent |
content |
str |
The memory content |
memory_type |
str |
Category of the memory |
metadata |
dict (optional) |
Additional key-value metadata |
read()
Retrieve memory records with optional filters.
| Parameter | Type | Description |
|---|---|---|
user_id |
UUID (optional) |
Filter by user |
session_id |
UUID (optional) |
Filter by session |
memory_type |
str (optional) |
Filter by memory type |
Examples
See examples/simple_chat_backend.py for a complete integration example.
Roadmap
Phase 2: Context Building
- Token-aware context window management
- Automatic memory prioritization and selection
Phase 3: Long-term Memory
- Vector embeddings for semantic search
- Hybrid retrieval (keyword + semantic)
Phase 4: Multi-agent Support
- Memory isolation and sharing policies
- Cross-agent coordination
Phase 5: Management Dashboard
- Web-based memory visualization
- Usage analytics and monitoring
Contributing
Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.
License
MIT License. See LICENSE for details.
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.1.tar.gz.
File metadata
- Download URL: memsuite-0.1.1.tar.gz
- Upload date:
- Size: 6.0 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 |
88365d37f5c0213ae446fa89bac68bbe090ba4614ea5cf69a87f7381cf9162b2
|
|
| MD5 |
140d4b0e1ec570c0c4944c52d9c111c5
|
|
| BLAKE2b-256 |
b51b908949ed339659f63cfec11ed23b4064b73bac25e3ed9e2a8ba0812b72af
|
File details
Details for the file memsuite-0.1.1-py3-none-any.whl.
File metadata
- Download URL: memsuite-0.1.1-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 |
5b1c5534625092660f745326649e84cfc5851a9c7f6b8cf7dcb1ec8ed39a58ad
|
|
| MD5 |
1659498e535cbb3b878b348e62ee643e
|
|
| BLAKE2b-256 |
4bb1bc1df0a9818785984e22412a6ae56b9da4bf41da30118f830ad5db4c0163
|