ReMe (Remember Me, Refine Me)
ReMe (Remember Me, Refine Me) is a Python library designed for managing and refining an AI agent's long-term memory. It provides functionalities for summarization, retrieval, and contextual awareness, enabling agents to learn and adapt over time. The library is actively maintained with frequent minor releases (multiple per month) to introduce new features, fix bugs, and refine existing memory mechanisms.
Warnings
- gotcha Before v0.3.1.8, attempting to use `chromadb`-backed memory without `chromadb` installed could lead to import errors. While the library now handles this gracefully, users leveraging ChromaDB features must explicitly install `chromadb` (`pip install chromadb`).
- gotcha ReMe relies on external LLM services (e.g., OpenAI, LiteLLM) for key functionalities like summarization and retrieval. Ensure required API keys (e.g., `OPENAI_API_KEY`) are set in environment variables or `*.env` files for `ReMe` to function correctly. Without these, LLM-dependent operations will fail.
- breaking In v0.3.1.4, core text truncation utilities were refactored and replaced with a new marker system. Custom integrations or logic that directly interacted with or relied on previous internal truncation methods might require review and adaptation.
- gotcha From v0.3.1.5 onwards, `summarize` and `retrieve` operations are designed to surface failures more explicitly instead of masking them. If your application previously relied on silent failures for these operations, it might now encounter exceptions for operations that fail.
- gotcha The changelog for v0.3.1.3 states `litellm` was moved to dev dependencies. However, `litellm` is still listed in the `requirements.txt` for v0.3.1.8, implying it remains a core dependency. Users should rely on `pip install reme-ai` to ensure all necessary dependencies are installed.
Install
-
pip install reme-ai
Imports
- ReMe
from reme import ReMe
Quickstart
import os
from reme import ReMe
# Ensure your OpenAI API key is set as an environment variable
# e.g., export OPENAI_API_KEY='sk-...'
openai_api_key = os.environ.get('OPENAI_API_KEY', '')
if not openai_api_key:
print("WARNING: OPENAI_API_KEY is not set. ReMe operations requiring an LLM will fail.")
# Initialize ReMe with a unique agent ID. This creates a local memory store.
re_me = ReMe(agent_id="my_first_agent")
# Add experiences to the agent's memory
re_me.add_experience("I met a new colleague today named Sarah. She works on the frontend team.")
re_me.add_experience("Sarah is quite good at React and uses TypeScript.")
re_me.add_experience("She mentioned she loves to hike and explore national parks.")
# Retrieve relevant memories based on a query
query = "Tell me about Sarah."
retrieved_memories = re_me.retrieve(query)
print(f"\nRetrieved memories for '{query}':")
for mem in retrieved_memories:
print(f"- {mem}")
# Summarize memories (requires LLM interaction)
try:
summarized_memory = re_me.summarize_memories(
query="What do I know about Sarah's work and hobbies?",
count=3
)
print(f"\nSummarized memory: {summarized_memory}")
except Exception as e:
print(f"\nFailed to summarize memories (API key likely missing/invalid): {e}")
# To clear the agent's memory store (optional)
# re_me.clear_memory()