Getting Started
Installation
pip install memorerQuick start
1. Initialize the client
from memorer import Memorer
client = Memorer(api_key="mem_sk_...")You can find your API key in the dashboard settings .
2. Create a user-scoped client
All memory operations are scoped to a user (owner):
user = client.for_user("user-123")3. Store a memory
result = user.remember("The user's name is Alice and she lives in Seattle")
print(result.entities_created) # 2 (Alice, Seattle)
print(result.relationships_created) # 1 (Alice -> lives_in -> Seattle)remember() accepts a string (or list of strings). It automatically extracts entities and relationships from the text and returns an IngestResponse.
4. Recall memories
results = user.recall("Where does Alice live?")
print(results.context)
# "The user's name is Alice and she lives in Seattle"
for result in results:
print(f"{result.content} (relevance: {result.relevance_score:.2f})")5. Forget a memory
user.forget("memory-uuid-here")Full example
from memorer import Memorer
client = Memorer(api_key="mem_sk_...")
user = client.for_user("user-123")
# Store some facts
user.remember("Alice is a software engineer at Acme Corp")
user.remember("Alice prefers Python and uses VS Code")
user.remember("Alice is working on a machine learning project")
# Query with semantic search
results = user.recall("What does Alice do for work?")
print(results.context)
# Use graph reasoning for multi-hop queries
results = user.recall(
"What tools does the engineer at Acme use?",
use_graph_reasoning=True,
)
print(results.context)
# Check memory stats
stats = user.memories.stats()
print(f"Total memories: {stats.total_memories}")
print(f"Direct: {stats.direct_memories}")
print(f"Derived: {stats.derived_memories}")Environment variables
You can set the base URL via environment variable for local development:
export MEMORER_BASE_URL=http://localhost:8000# Uses MEMORER_BASE_URL if set, otherwise defaults to production
client = Memorer(api_key="mem_sk_...")Next steps
- Concepts — Understand memories, entities, and the knowledge graph
- SDK Reference — Full API documentation
- Integrations — Use with OpenAI, Anthropic, or LangChain
Last updated on