An exploration of agentic memory strategies
AI agents managing their own memory is a crucial architectural shift that transforms stateless LLMs into stateful, autonomous agents capable of learning, recalling events, and maintaining continuity across long-term tasks. By giving agents read/write access to a dedicated memory storage, they can decide when to store, update, or retrieve information, mimicking a human's ability to take notes and learn from experience.
In this work, we experiment with three types of agentic memory strategies such as:
- RAG-based,
- graph-based,
- pictorial-based.
- https://filedn.com/lIFJC8ES6odhW7qS8AxmmHY/memento.mp4
- https://filedn.com/lIFJC8ES6odhW7qS8AxmmHY/RAG_example.mp4
- Create the environment:
conda env create -f environment.yml - Activate the environment:
conda activate memento - Install the package in editable mode.
pip install -e .. This command needs to be run only once (or each timepyproject.tomlis modified). - If you want to use an openAI server, add the needed environment variables to your system (and restart your terminal):
CHATUIT_BASE_URLCHATUIT_API_KEY
- Alternatively, start LM studio server and load whatever model. The expected URL is
http://127.0.0.1:1234/v1.
The graph memory backend uses a local Neo4j database. Each contributor runs their own instance.
-
Install Neo4j Desktop from Webpage.
-
Create a local instance named
memento(any name works, but the rest of these instructions assumememento).- The default username is
neo4j. - Note the password you set.
- The default username is
-
Start the instance in Neo4j Desktop and confirm it shows as RUNNING.
-
Set the connection environment variables in your shell config (e.g.
~/.zshrcor~/.bashrc):export NEO4J_URI="neo4j://127.0.0.1:7687" export NEO4J_USER="neo4j" export NEO4J_PASSWORD="your-password"
Then reload the shell: source ~/.zshrc.
- Initialize the schema:
conda env update -f environment.yml --prune
conda activate memento
python scripts/init_neo4j.pyThe script is idempotent and prints a summary of the constraints and indexes that were applied. It is safe to re-run after pulling schema changes.
Error 08N09: Connection exception - database unavailable (or Python equivalent).
The Neo4j instance is running but the neo4j database inside it has been stopped. The
instance and the databases inside it are managed separately. Desktop's UI does not always
expose database start/stop controls clearly, so use Neo4j Browser instead:
- In Desktop, click Query to open Neo4j Browser.
- At the top of the query view, switch the active database from
neo4jtosystem(thesystemdatabase manages database lifecycle). - Run:
START DATABASE neo4j- Switch back to
neo4jand confirm withRETURN 1.
Three helper scripts in scripts/ for development:
python scripts/test_graph_memory.py— populate the graph with 4 sample messages underagent_id="TestAgent".python scripts/test_graph_retrieval.py— run sample queries againstTestAgent. Requires runningtest_graph_memory.pyfirst.python scripts/clear_graph.py --agent-id TestAgent— clear data for one agent.python scripts/clear_graph.py --all— clear everything (asks for typedyesconfirmation).
Schema is preserved across clears.
A Streamlit + pyvis demo for chatting with the graph-memory agent and watching its Neo4j subgraph update turn-by-turn. Launch:
conda activate memento
streamlit run chatGraph.pyOpens at http://localhost:8501. The left pane is a chat interface; the
right pane renders the agent's entity-relation graph (orange circles
are entities, light-blue boxes are messages, blue edges are
extractor-written, red edges are linker-written). The right-side
filter panel lets you toggle node types, edge sources, and the
"recent N" entity view. Each session runs under its own
ui_<timestamp> agent_id so it does not collide with other agents
in Neo4j.
Streamlit and pyvis are installed by environment.yml. If you pulled
the branch before they were added, run conda env update -f environment.yml --prune
to get them.
- Don't forget:
conda activate memento - Run
python converse_with_flash_agent.py, which is an example of running a conversation between a human and an AI agents.
In case a package added by another contributor to environment.yml is missing on your machine, simply run:
conda env update -f environment.yml --prune- Then:
conda activate memento