Integration
Tutorial
April 13, 2026
REM Labs Python SDK: Complete Guide
The REM Labs Python SDK makes it easy to add persistent AI memory to any Python application. Three methods -- remember, recall, forget -- cover most use cases. This guide walks through installation, core usage, async support, and advanced patterns like namespaces and tag filtering.
Installation
pip install remlabs
Quick Start
from remlabs import RemLabs
client = RemLabs(api_key="your-api-key")
# Store a memory
client.remember(
content="The user prefers dark mode and vim keybindings",
tags=["preferences", "ui"],
namespace="my-app"
)
# Search memories
results = client.recall(
query="user interface preferences",
namespace="my-app",
limit=5
)
for memory in results:
print(memory["content"])
# Delete a specific memory
client.forget(memory_id=results[0]["id"])
The remember() Method
client.remember(
content="string", # Required: the memory content
tags=["tag1", "tag2"], # Optional: categorization tags
namespace="project-x", # Optional: isolate memories
metadata={"key": "val"} # Optional: structured metadata
)
The content is automatically indexed for semantic search, full-text search, and entity extraction. You do not need to manage embeddings or search indexes.
The recall() Method
results = client.recall(
query="string", # Required: search query
namespace="project-x", # Optional: scope to namespace
limit=10, # Optional: max results (default 10)
tags=["architecture"], # Optional: filter by tags
threshold=0.5 # Optional: minimum relevance score
)
# Each result contains:
# {
# "id": "mem_abc123",
# "content": "The memory text...",
# "tags": ["tag1"],
# "score": 0.92,
# "created_at": "2026-04-13T..."
# }
Recall uses multi-signal fusion -- vector similarity, full-text matching, and entity graph traversal run in parallel. Results are fused and reranked for maximum relevance.
The forget() Method
# Delete by ID
client.forget(memory_id="mem_abc123")
# Delete by namespace (careful!)
client.forget(namespace="old-project")
# Delete by tag
client.forget(tags=["temporary"])
Async Support
For async applications (FastAPI, aiohttp, etc.), use the async client:
from remlabs import AsyncRemLabs
client = AsyncRemLabs(api_key="your-api-key")
async def handler():
await client.remember(
content="User completed onboarding",
namespace="my-app"
)
results = await client.recall(
query="onboarding status",
namespace="my-app"
)
FastAPI Integration Example
from fastapi import FastAPI
from remlabs import AsyncRemLabs
app = FastAPI()
memory = AsyncRemLabs(api_key="your-api-key")
@app.post("/chat")
async def chat(user_id: str, message: str):
# Recall context for this user
context = await memory.recall(
query=message,
namespace=f"user-{user_id}",
limit=5
)
# ... generate response with LLM ...
# Store the exchange
await memory.remember(
content=f"User: {message}\nBot: {response}",
namespace=f"user-{user_id}"
)
return {"response": response}
Environment Variables
The SDK reads REMLABS_API_KEY from the environment if no key is passed explicitly:
export REMLABS_API_KEY="your-api-key"
# Then in Python:
client = RemLabs() # auto-reads from env
Type hints: The SDK is fully typed with Python type hints and works with mypy, Pyright, and VS Code IntelliSense out of the box.
Add memory to your Python app
pip install remlabs. Free tier. Three methods. Full async support.
Get started free →