A memory-based, continual-learning framework that helps LLM agents improve from experience without updating model weights.
Planner–Executor Architecture • Case-Based Reasoning • MCP Tooling • Memory-Augmented Learning
Memento vs. Baselines on GAIA validation and test sets.
|
Ablation study of Memento across benchmarks.
|
Continual learning curves across memory designs.
|
Memento’s accuracy improvement on OOD datasets.
|
server/ai_crawler.py for web crawling and query-aware content compression to reduce token cost.Learn from experiences, not gradients. Memento logs successful & failed trajectories into a Case Bank and retrieves by value to steer planning and execution—enabling low-cost, transferable, and online continual learning.
📖 For detailed installation instructions, see INSTALL.md
# Clone repository
git clone https://github.com/Agent-on-the-Fly/Memento
cd Memento
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Sync dependencies and create virtual environment automatically
uv sync
# Activate the virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Clone repository
git clone https://github.com/Agent-on-the-Fly/Memento
cd Memento
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
For GPU support (Recommended for Parametric Memory):
# CUDA 11.8
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# CUDA 12.1
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# CPU only
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
For more PyTorch installation options, visit: https://pytorch.org/get-started/locally/
FFmpeg is required for video processing functionality. The ffmpeg-python package in our dependencies requires a system-level FFmpeg binary.
Windows:
# Option 1: Using Conda (Recommended for isolated environment)
conda install -c conda-forge ffmpeg
# Option 2: Download from official website
# Visit https://ffmpeg.org/download.html and add to PATH
macOS:
# Using Homebrew
brew install ffmpeg
Linux:
# Debian/Ubuntu
sudo apt-get update && sudo apt-get install ffmpeg
# Install and setup crawl4ai
crawl4ai-setup
crawl4ai-doctor
# Install playwright browsers
playwright install
After creating the .env file, you need to configure the following API keys and service endpoints:
#===========================================
# OpenAI API Configuration
#===========================================
USE_AZURE_OPENAI=False
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_BASE_URL=https://api.openai.com/v1 # or your custom endpoint
AZURE_OPENAI_API_KEY=your_azure_openai_api_key_here
AZURE_OPENAI_API_VERSION=your_azure_openai_api_version_here
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint_here
#===========================================
# Tools & Services API
#===========================================
# Chunkr API (https://chunkr.ai/)
CHUNKR_API_KEY=your_chunkr_api_key_here
# Jina API
JINA_API_KEY=your_jina_api_key_here
# ASSEMBLYAI API
ASSEMBLYAI_API_KEY=your_assemblyai_api_key_here
Note: Replace your_*_api_key_here with your actual API keys. Some services are optional depending on which tools you plan to use.
For web search capabilities, set up SearxNG: You can follow https://github.com/searxng/searxng-docker/ to set the docker and use our setting.
# In a new terminal
cd ./Memento/searxng-docker
docker compose up -d
python client/agent.py
Parametric Memory enables the agent to learn from past experiences using a trained neural retriever model.
Step 1: Train the Memory Retriever
First, you need to train the retriever model with initial training data:
cd memory
# Train the retriever model
python train_memory_retriever.py \
--train training_data.jsonl \
--output_dir ./ckpts/retriever \
--use_plan \
--val_ratio 0.1 \
--batch_size 32 \
--lr 2e-5 \
--epochs 10 \
--save_best
Step 2: Configure Environment Variables
Add the following to your .env file:
# Memory Configuration
MEMORY_JSONL_PATH=../memory/memory.jsonl
TRAINING_DATA_PATH=../memory/training_data.jsonl
RETRIEVER_MODEL_PATH=../memory/ckpts/retriever/best.pt
MEMORY_TOP_K=8
MEMORY_MAX_POS_EXAMPLES=8
MEMORY_MAX_NEG_EXAMPLES=8
Step 3: Run Parametric Memory Agent
cd client
python parametric_memory.py
gpt-4.1 for task decompositiono3 for task executionMemento/
├── client/ # Main agent implementation
│ ├── agent.py # Hierarchical client with planner–executor
│ ├── no_parametric_cbr.py # Non-parametric case-based reasoning
│ ├── parametric_memory.py # Parametric memory with neural retriever
│ ├── run_parametric.sh # Convenience script for parametric mode
│ └── PARAMETRIC_MEMORY_GUIDE.md # Detailed parametric memory guide
├── server/ # MCP tool servers
│ ├── code_agent.py # Code execution & workspace management
│ ├── search_tool.py # Web search via SearxNG
│ ├── serp_search.py # SERP-based search tool
│ ├── documents_tool.py # Multi-format document processing
│ ├── image_tool.py # Image analysis & captioning
│ ├── video_tool.py # Video processing & narration
│ ├── excel_tool.py # Spreadsheet processing
│ ├── math_tool.py # Mathematical computations
│ ├── craw_page.py # Web page crawling
│ └── ai_crawler.py # Query-aware compression crawler
├── interpreters/ # Code execution backends
│ ├── docker_interpreter.py
│ ├── e2b_interpreter.py
│ ├── internal_python_interpreter.py
│ └── subprocess_interpreter.py
├── memory/ # Memory components / data
│ ├── parametric_memory.py # Case retriever for inference
│ ├── train_memory_retriever.py # Retriever training script
│ ├── np_memory.py # Non-parametric memory utilities
│ ├── retrain.sh # Convenience script for retraining
│ ├── memory.jsonl # Memory pool (cases with labels)
│ ├── training_data.jsonl # Training data for retriever
│ └── ckpts/ # Model checkpoints
│ └── retriever/
│ ├── best.pt # Best performing model
│ └── last.pt # Last epoch model
├── data/ # Sample data / cases
├── searxng-docker/ # SearxNG Docker setup
├── Figure/ # Figures for README/paper
├── README.md
├── requirements.txt
├── pyproject.toml
└── LICENSE
server/ directoryagent.pyExtend the interpreters/ module to add new execution backends:
from interpreters.base import BaseInterpreter
class CustomInterpreter(BaseInterpreter):
async def execute(self, code: str) -> str:
# Your custom execution logic
pass
If Memento helps your work, please cite:
```bibtex @article{zhou2025mementofinetuningllmagents, title={Memento: Fine-tuning LLM Agents without Fine-tuning LLMs}, author={Hu
$ claude mcp add Memento \
-- python -m otcore.mcp_server <graph>