Skip to main content

A lightweight, PostgreSQL-backed memory management system for AI agents and chatbots

Project description

MemSuite

PyPI version Python License: MIT

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

  1. Create a .env file in your project root:
DB_URL=postgresql://user:password@host:port/database
  1. Load environment variables with python-dotenv or 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 scoped to a specific user and session.

Parameter Type Description
user_id UUID Required. User identifier
session_id UUID Required. Session identifier
memory_type str (optional) Filter by memory type

Note: Both user_id and session_id are mandatory. Global reads without these identifiers are not supported.

Phase 1 Limitations

The current release provides foundational memory storage with the following constraints:

  • Explicit writes only — Memories are stored only when write() is called explicitly. There is no implicit or automatic memory capture.
  • No context logic — Retrieval is a direct database query. Token-aware context building, prioritization, and memory selection are planned for Phase 2.
  • No auto-memory — The system does not automatically extract or infer memories from conversations.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memsuite-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memsuite-0.1.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file memsuite-0.1.2.tar.gz.

File metadata

  • Download URL: memsuite-0.1.2.tar.gz
  • Upload date:
  • Size: 6.4 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

Hashes for memsuite-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dcbdf956d48ac37363cff946c44b7e946f9032675ab532ea8b229ca5f0cc96fa
MD5 fff24025fa4ea466d1e6e7359d579e02
BLAKE2b-256 a50af9e64fb849fc0c4e4c226cb5915b5a4e7a19556b0b5286d935af9cf7733e

See more details on using hashes here.

File details

Details for the file memsuite-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: memsuite-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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

Hashes for memsuite-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2627c984b1beac1561f5aed5e6306b67f13534b05a45b5c2fb3ff82a0f5b5d88
MD5 e628c901443d30febb6c1856f6881f22
BLAKE2b-256 73bdbc44674455564b64ec95a3a2c469fb72a6c69e618a2729863df7c96c9b4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page