█

AI/TLDR

Buy me a coffee
Buy me a coffee

MemEngine

A unified, modular library for building advanced memory in LLM-based agents

Agent MemoryOpen source
Language
Python
$conda create -n memengine_env python=3.9
IN SHORT

What is MemEngine?

MemEngine is a Python library for developing the memory layer of LLM-based agents. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in Python. To get started: install from source (recommended).

Overview

MemEngine is a Python library for developing the memory layer of LLM-based agents. It brings together memory models from recent research papers and implements them under one unified, modular framework, so you can use a single interface instead of reimplementing each design from scratch.

It is aimed at researchers and engineers who want to add memory to agents and compare different approaches. Memory modules organize their logic into hierarchical levels where higher-level modules reuse lower-level ones, and a configuration module lets you adjust hyper-parameters and prompts without rewriting code.

Within the agent-memory space, MemEngine focuses on being pluggable. Its memory modules expose common operations like store and recall, can be dropped into existing agent frameworks, and support local use as a Python package or remote use as a service behind a port.

What it does

  • Unified, modular framework with three hierarchical levels where higher-level modules reuse lower-level ones
  • Many published agent-memory models implemented under one interface, so you can switch and test them with different configs
  • Configuration module for adjusting hyper-parameters and prompts at different levels
  • Pluggable memory modules with simple store and recall operations that work across agent frameworks
  • Default, configurable, and automatic memory usage modes
  • Local deployment as a Python library or remote deployment as a service via uvicorn and FastAPI

Getting started

Install MemEngine into a Python 3.9+ environment, then create a memory module and use its store and recall operations inside your agent.

Install from source (recommended)

The maintainers recommend installing from source to get the latest version. Create a Python 3.9 environment, clone the repo, and install in editable mode.

bashbash
conda create -n memengine_env python=3.9
git clone https://github.com/nuster1128/MemEngine.git
cd MemEngine
pip install -e .

Or install from pip

If you prefer a packaged release, install from PyPI. Note this may not be the latest version.

bashbash
conda create -n memengine_env python=3.9
pip install memengine

Create a memory module and use it

Import a memory model such as FUMemory with its config, then call recall to fetch context and store to save new observations. This mirrors the dialogue-agent example from the README.

pythonpython
from memengine.config.Config import MemoryConfig
from memengine.memory.FUMemory import FUMemory

memory = FUMemory(MemoryConfig(DialogueAgentMemoryConfig))

# fetch relevant context for the current input
context = memory.recall(observation)

# save a new turn into memory
memory.store('%s: %s' % (role, response))

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Adding persistent memory to a conversational agent so it can recall earlier turns
  • Comparing several published memory models on the same task by switching configs
  • Prototyping a new memory model by extending the library's operations and functions
  • Running memory as a shared service behind a port for multiple agents to use

How MemEngine compares

MemEngine alongside other open-source agent memory tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Claude-Mem★ 121kPersistent memory layer for coding agents: it captures what an agent does during a session, compresses it into semantic summaries, and injects the relevant parts back into later sessions.
Mem0★ 69.7kA memory layer that you add to existing LLM agents to extract, store, and recall user facts and preferences across sessions using vector, graph, and key-value backends.
Hindsight★ 64.3kAn agent memory server that stores facts and experiences, consolidates them into observations and mental models, and serves them back through retain, recall, and reflect operations.
MemPalace★ 60.8kLocal-first agent memory that stores conversations verbatim instead of summarising them, with a structured palace index, pluggable vector backends and an MCP server.
OpenViking★ 43.1kA context database that stores an agent's memories, resources, and skills as one browsable viking:// filesystem with three-tier (abstract/overview/details) on-demand loading.
Cognee★ 33.7kA graph-native memory engine that turns raw documents and conversations into a queryable knowledge graph for agents that need to build lasting knowledge.
Graphiti★ 33.2kA library that builds a temporal knowledge graph from an agent's conversations and data so facts can be tracked and queried as they change over time.
MemEngine★ 117A unified, modular library for building advanced memory in LLM-based agents