Mem-LLM 🧠💻
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
- GitHub Repository: github.com/emredeveloper/Mem-LLM
- PyPI Package: pypi.org/project/mem-llm/
- Issue Tracker: Report a Bug or Request a Feature
What's New in v2.5.1
Dependency fixes. Graph memory needs pydantic and the API server's upload endpoint needs
python-multipart; neither was declared, so on a clean install graph memory silently degraded
to a no-op and pip install mem-llm[api] could not import the API server. Both are now
declared, so a plain pip install mem-llm gets working graph memory.
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/completionscompatible server. - llama.cpp Support: Connect directly to
llama-serverwithbackend="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
@tooldecorator. - 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!
Release files for mem-llm 2.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mem_llm-2.5.1.tar.gz | 149.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mem_llm-2.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 300.9 kB
Release files / mem_llm-2.5.1.tar.gz
| Download URL | mem_llm-2.5.1.tar.gz |
|---|---|
| Size | 149.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f593aa61fb10af75a2ad396e7a70855f422accd9cdb020fdd604290af6bfe67a
|
|
BLAKE2b-256 checksum How to use checksums |
b2f7f53e042cd0a40779258786b80deacf684a390122d778ba187786edd9ddef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / mem_llm-2.5.1-py3-none-any.whl
| Download URL | mem_llm-2.5.1-py3-none-any.whl |
|---|---|
| Size | 151.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33c7edc323a2be4a5791167685aaff7a2eccbe40fc97d779df9b650e621f541a
|
|
BLAKE2b-256 checksum How to use checksums |
c3423629928c7aec841f22f22dd444c312e8688f73d944542a5c872df368824d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|