Skip to main content

Privacy-first, memory-enabled AI assistant with workflow engine, knowledge graph, multi-agent systems, multi-backend LLM support (Ollama, LM Studio), vector search, and analytics - 100% local and production-ready

Project description

Mem-LLM 🧠💻

PyPI version Python 3.8+ License: MIT

Mem-LLM is a privacy-first, local Python framework for building memory-enabled AI assistants. By running entirely on your local machine, it combines persistent multi-user conversation history with configurable knowledge bases, robust storage backends, and seamless multi-model support.

Perfect for privacy-first, production-ready workflows!

🔗 Quick Links


What's New in v2.5.0

This release expands local backend support and upgrades long-term memory:

  • OpenAI-Compatible Backends: Use any /v1/chat/completions compatible server.
  • llama.cpp Support: Connect directly to llama-server with backend="llamacpp".
  • MemoryRouter: Unified core memory, archival memory, recall, graph context, and KB retrieval.
  • Temporal Graph Memory: Track current facts and historical facts with validity windows.
  • Cleanup: Reduced duplicated backend alias and chat context-building logic.

✨ Core Highlights

  • Persistent Multi-User Memory: Keep context across sessions. Supports lightweight JSON or robust SQLite databases.
  • Advanced Tool Calling: Endow your agent with superpowers! Use built-in tools or easily create your own with the @tool decorator.
  • Multi-Backend Flexible Support: Switch between Ollama, LM Studio, OpenAI-compatible APIs, and llama.cpp.
  • Long-Term Memory Routing: Combine core memory, archival memory, recall, knowledge base, and graph context.
  • Temporal Graph Memory: Preserve changing facts without losing history.
  • Knowledge Base (RAG) & Vector Stores: Empower your agent with your own documents and databases organically.
  • Conversation Analytics: Track interactions, model performance, and agent behavior systematically.
  • REST API + Web UI: Deploy your local agent instantly with the built-in, ready-to-use API server and slick web interface.
  • Real-Time Streaming: Stream chat responses chunk by chunk for ultra-low latency experiences.

📦 Installation

Get up and running in seconds.

pip install mem-llm

Optional Power-ups:

# Add API server dependencies (FastAPI, Uvicorn)
pip install mem-llm[api]

# Add advanced database support
pip install mem-llm[databases]

⚡ Quick Start

Using Ollama 🦙

Make sure your Ollama instance is running, then try this simple example:

from mem_llm import MemAgent

# Initialize the agent
agent = MemAgent(backend="ollama", model="granite4:3b")

# Set the active user (memory will be uniquely tied to this ID)
agent.set_user("alice")

# Chat and watch it remember!
print(agent.chat("Hi! My name is Alice and I am a Software Engineer."))
print(agent.chat("What was my name and what do I do?")) 

Using LM Studio 🛠️

Ensure LM Studio's local server is running on its default port:

from mem_llm import MemAgent

agent = MemAgent(backend="lmstudio", model="qwen3.5-2b")
agent.set_user("bob")

print(agent.chat("Explain Python memory management in 2 sentences."))

Using llama.cpp

Start llama-server with an OpenAI-compatible endpoint:

llama-server.exe -m C:\path\to\model.gguf --alias local-model --host 127.0.0.1 --port 8080

Connect Mem-LLM:

from mem_llm import MemAgent

agent = MemAgent(
    backend="llamacpp",
    model="local-model",
    base_url="http://localhost:8080",
)
agent.set_user("carol")

print(agent.chat("Remember that I prefer concise answers."))

📄 License

Mem-LLM is proudly open-source and released under the MIT License. Build away!

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

mem_llm-2.5.0.tar.gz (148.9 kB view details)

Uploaded Source

Built Distribution

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

mem_llm-2.5.0-py3-none-any.whl (152.6 kB view details)

Uploaded Python 3

File details

Details for the file mem_llm-2.5.0.tar.gz.

File metadata

  • Download URL: mem_llm-2.5.0.tar.gz
  • Upload date:
  • Size: 148.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for mem_llm-2.5.0.tar.gz
Algorithm Hash digest
SHA256 40efe3bea790ac47e6e25b6ac4387c70ae843a589cda8bc1252a08b84781be47
MD5 8b49374f3d22dd1bcdb2f1d338b930ee
BLAKE2b-256 aa16954687b03081feebcad3ca275740421c969b5b894d02d519ef62da6c248b

See more details on using hashes here.

File details

Details for the file mem_llm-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: mem_llm-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 152.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for mem_llm-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 635b8fed669ab2e996f158ac44e4cdf5629789a9562b59283406aa1e6bfa7cf9
MD5 9d00cf05e6f6c5050645f193fd567b82
BLAKE2b-256 49083c549ef756e6cda05b6ed5319dd6b4038a8caf126220ec07b864798422a2

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