Skip to main content

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.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/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!

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)

Source distribution for mem-llm 2.5.1
File Size Uploaded
mem_llm-2.5.1.tar.gz 149.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mem-llm 2.5.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

2.5.1 This release

2 release files

2.5.0

2 release files

2.4.8

2 release files

2.4.6

2 release files

2.4.5

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.8

2 release files

2.3.7

2 release files

2.3.6

2 release files

2.3.5

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

1 release file

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page