Mem-LLM is a privacy-first Python framework for building memory-enabled AI assistants that run locally.
- Declared the missing
pydanticdependency, so graph memory works on a clean install instead of silently disabling itself. - Declared the missing
python-multipartdependency for theapiextra, somem_llm.api_serverimports.
- Added OpenAI-compatible and llama.cpp backend support.
- Added MemoryRouter for core memory, archival memory, recall, graph context, and KB retrieval.
- Added temporal graph memory with current and historical graph search.
- Simplified repeated backend and chat context-building code.
pip install mem-llmfrom mem_llm import MemAgent
agent = MemAgent(backend="ollama", model="granite4:3b")
agent.set_user("alice")
print(agent.chat("My name is Alice."))
print(agent.chat("What is my name?"))from mem_llm import MemAgent
agent = MemAgent(backend="lmstudio", model="qwen3.5-2b")
agent.set_user("alice")
print(agent.chat("Summarize Python in one sentence."))Start llama.cpp server with an OpenAI-compatible endpoint:
llama-server.exe -m C:\path\to\model.gguf --alias local-model --host 127.0.0.1 --port 8080Then connect Mem-LLM:
from mem_llm import MemAgent
agent = MemAgent(
backend="llamacpp",
model="local-model",
base_url="http://localhost:8080",
)
agent.set_user("alice")
print(agent.chat("Remember that I prefer concise answers."))- Persistent memory per user (JSON or SQLite)
- Multi-backend support (Ollama, LM Studio, OpenAI-compatible APIs, llama.cpp)
- MemoryRouter with core memory, archival memory, recall, and graph context
- Temporal graph memory with current and historical lookup
- Tool calling system (
@tool, built-in tools, validation) - Streaming responses
- Knowledge base integration
- Conversation analytics
- REST API and Web UI
Memory LLM/- main package source and release filesquickstart/- step-by-step usage examples & tutorials
- PyPI: https://pypi.org/project/mem-llm/
- Documentation: Memory LLM/README.md
- Changelog: Memory LLM/CHANGELOG.md
- Issues: https://github.com/emredeveloper/Mem-LLM/issues
Mem-LLM is released under the MIT License.