# Agentmemory: Give Your LLM Agents a Long-Term Memory
You know how frustrating it is when your AI agent forgets what it was doing two conversations ago? That's exactly the problem Agentmemory solves. It's a lightweight Python library that lets your LLM-powered apps remember things across sessions — think of it as a tiny memory layer for your agents.
Unlike complex vector databases or full-blown RAG pipelines, Agentmemory focuses on being simple, embeddable, and easy to debug. You don't need a PhD in ML to give your bot a working memory.
## What It Does
Agentmemory works by storing conversation snippets, facts, or any text data as "memories." It uses embeddings (via OpenAI or local models) to index these memories, so your agent can later query them using natural language.
For example:
- Store a user's preference: "User likes short code examples"
- Query later: "What does this user prefer?" → returns the stored memory
The library handles:
- **Storage**: Memories are saved locally (SQLite by default, no external services)
- **Retrieval**: Semantic search over memories using cosine similarity
- **Forgetting**: Automatic decay or manual deletion of old memories
- **Namespacing**: Separate memory stores for different users or sessions
It's essentially a drop-in `memory` object you can attach to your LangChain, AutoGPT, or custom agent.
## Why It's Cool
1. **No infrastructure needed** – Just `pip install`, no cloud database setup
2. **Flexible embedding backends** – Use OpenAI, HuggingFace, or even a local Sentence Transformers model
3. **Built-in memory management** – Forgets old stuff automatically to prevent bloat
4. **Developer-friendly defaults** – Works with 3 lines of code, but you can customize everything
5. **Debugging built-in** – You can inspect and iterate on memories easily (no black box)
This is particularly useful for:
- Building personal assistants that remember your name after you close the app
- Chatbots that don't repeat the same info every session
- AI tools that learn your preferences over time without needing fine-tuning
## How to Try It
Get started in under a minute:
```bash
pip install agentmemory
Then in Python:
from agentmemory import create_memory, query_memory
# Store a memory
create_memory("user_preferences", "Likes short code examples and Python")
# Query it later
memories = query_memory("user_preferences", "What does this user like?")
print(memories[0]) # Returns the stored memory text
For the full example with OpenAI embeddings and automatic forgetting, check the repo's README.
Final Thoughts
If you're tired of your LLM agents acting like they have goldfish amnesia, Agentmemory is a practical fix. It's not trying to replace Pinecone or Chroma – it's for when you want a simple memory that works out of the box, without the overhead. The creator clearly thought about developer pain points: easy install, clear defaults, and inspectable state.
Try it on a personal project or a prototype. You'll probably want to add memory to everything after this.
Repository: https://github.com/rohitg00/agentmemory