G-Memory: Tracing Hierarchical Memory for Multi-Agent Systems
June 10, 2025 ยท View on GitHub
๐ Introduction
This repo is the official implementation of G-Memory: Tracing Hierarchical Memory for Multi-Agent Systems.
Our method, G-Memory, empowers multi-agent systems with a hierarchical memory architecture that continuously evolves through interaction. Inspired by organizational memory theory, G-Memory captures generalizable insights and agent-specific collaboration trajectories across tasks using a structured graph-based design. When a new task arrives, it retrieves relevant past experiences and distilled knowledge to inform agent behavior and coordination. As agents complete tasks, G-Memory updates its memory hierarchy with new interactions, enabling teams to adapt and improve over time.

๐ Setup
conda create -n GMemory python=3.12
conda activate GMemory
pip install -r requirements.txt
๐ Quick Start
๐ณ Environments
Please download the ALFWorld, PDDL, FEVER datasets and place it in the data folder.
The file structure should be organized as follows:
data
โโโ alfworld
โโโ alfworld_tasks_suffix.json
โโโ pddl
โโโ test.json
โโโ fever
โโโ fever_dev.jsonl
๐ Add API keys in template.env and change its name to .env
OPENAI_API_BASE = "" # the BASE_URL of OpenAI LLM backend
OPENAI_API_KEY = "" # for OpenAI LLM backend
๐ Choices Overview
- Available memories: Empty, ChatDev, MetaGPT, Voyager, Generative, MemoryBank, G-Memory
- Available MAS: AutoGen, DyLAN, MacNet
โถ๏ธ How to Run
- Option 1: Run with Shell Script. Simply execute the following script:
./run_mas.sh - Option 2: Run with Python Command. You can also launch specific tasks via command-line:
python tasks/run.py --task alfworld --reasoning io --mas_memory g-memory --max_trials 30 --mas_type autogen --model <your model here> python tasks/run.py --task pddl --reasoning io --mas_memory g-memory --max_trials 30 --mas_type autogen --model <your model here> python tasks/run.py --task fever --reasoning io --mas_memory g-memory --mas_trials 15 --mas_type autogen --model <your model here>
๐ซก Citation
If you find this repository helpful, a citation to our paper would be greatly appreciated:
@article{zhang2025g-memory,
title={G-Memory: Tracing Hierarchical Memory for Multi-Agent Systems},
author={Zhang, Guibin and Fu, Muxin and Wan, Guancheng and Yu, Miao and Wang, Kun and Yan, Shuicheng},
journal={arXiv preprint arXiv:2506.07398},
year={2025}
}
๐ Acknowledgement
- We sincerely thank ExpeL for providing their prompt designs.
- We also extend our heartfelt thanks to AgentSquare for their dataset environments and baseline implementations.