Observed since 20 Oct, 22:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Persistent memory for OpenAI agents — store, recall, and forget.
Persistent memory for your OpenAI agents — store, recall, and forget.
Every OpenAI agent starts from zero. No memory of past conversations, preferences, decisions, or context. Every session is a blank slate.
AgentMemory solves this — giving your agent durable, queryable memory that persists across sessions.
Install dependencies:
pip install openai python-dotenv
Set your OpenAI API key:
# .env
OPENAI_API_KEY=your_key_here
Run your first memory session:
from agentmemory import AgentMemory
memory = AgentMemory(memory_path="agent_memory.json")
# Store memories from any text
memory.remember(
"I am building a RAG application using Python and OpenAI. "
"I prefer concise answers and clean code."
)
# Recall relevant memories
results = memory.recall("What is the user building?")
print(results)
Output:
Found 2 relevant memories:
• [CONTEXT] User is building a RAG application using Python and OpenAI
• [CONTEXT] User prefers concise answers and clean code
memory = AgentMemory(
memory_path="agent_memory.json", # local storage file
model="gpt-4o-mini", # judge model
max_memories=100, # max memories to store
)
memory.remember(text) # extract and store memories from text
memory.recall(query, top_k) # retrieve relevant memories
memory.forget(memory_id) # delete a specific memory
memory.forget_all() # clear all memories
memory.list_all() # return all stored memories
memory.count # total number of memories
| Category | Description |
|---|---|
fact | Factual statements about the user or domain |
preference | User preferences and style choices |
decision | Decisions made during conversations |
context | Project or situational context |
Run the interactive demo locally:
streamlit run app.py
Features:
remember(text) sends the text to GPT-4o-mini which extracts
individual factual claims, preferences, decisions, and context.recall(query) sends the query and all stored memories to
GPT-4o-mini which scores each memory for relevance.All storage is local — no cloud, no database, no infrastructure. Just a JSON file on your machine.
Each remember() call: ~$0.001
Each recall() call: ~$0.001
Both use GPT-4o-mini as the judge.
agentmemory/
├── agentmemory/
│ ├── __init__.py # public API
│ ├── memory.py # AgentMemory core class
│ └── models.py # Memory and MemorySearchResult dataclasses
├── app.py # Streamlit demo
├── example.py # quickstart example
├── requirements.txt
├── .env.example
└── README.md
MIT — free to use, modify, and distribute.
Pull requests are welcome. Please open an issue first to discuss what you would like to change.
Built with OpenAI GPT-4o-mini as the memory extraction and recall judge.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 7 May 2026 | 3 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:ccddcebcfe92ce03dc4565c4eeeda6e27574beba7910f05059b650e44d5f3c16