Skip to main content
Migration Guide

Migrate from Mem0 to StremAI

Switch in under 10 minutes. This guide maps every Mem0 API call to its StremAI equivalent.

Step 1: Install

Replace the Mem0 package:

# Remove Mem0
pip uninstall mem0ai

# Install StremAI
pip install agentbay
Step 2: Initialize

Mem0 (before)

from mem0 import Memory

m = Memory()
# or with API key:
m = Memory.from_config({
    "api_key": "m0-xxx"
})

StremAI (after)

from agentbay import AgentBay

ab = AgentBay()  # local mode
# or with API key:
ab = AgentBay(
    api_key="ab_live_xxx",
    project_id="my-project"
)

StremAI with no arguments starts in local mode (SQLite). No signup needed to get started.

Step 3: Store Memories

Mem0

m.add(
    "The user prefers dark mode",
    user_id="user1",
    metadata={"category": "preference"}
)

StremAI

# Drop-in (Mem0-compatible)
ab.add(
    "The user prefers dark mode",
    user_id="user1"
)

# Or structured, for better search
ab.store(
    "The user prefers dark mode",
    title="User prefers dark mode",
    type="PATTERN",
    tags=["preference", "ui"]
)

ab.add() is a drop-in replacement for m.add() — it auto-detects the type and extracts a title. ab.store() lets you set title, type (PATTERN, PITFALL, DECISION, etc.), and tags explicitly. Both return a dict: {'id': '...', 'deduplicated': False}.

Step 4: Recall Memories

Mem0

results = m.search(
    "dark mode",
    user_id="user1"
)
for r in results:
    print(r["memory"])

StremAI

results = ab.recall("dark mode")
# or drop-in: ab.search("dark mode", user_id="user1")

for entry in results:
    print(f"{entry['title']}: {entry['content']}")
    print(f"  confidence: {entry['confidence']}")

ab.recall() returns a plain list of dicts with confidence scores (computed at query time with decay). ab.search() is a Mem0-compatible alias with the same user_id scoping.

Step 5: Auto-Memory Chat

Mem0

# Mem0 doesn't have a built-in
# chat wrapper. You must manually:
# 1. Search for relevant memories
# 2. Inject into system prompt
# 3. Call your LLM
# 4. Store the response

StremAI

reply = ab.chat(
    [{"role": "user", "content": "How does auth work?"}],
    provider="openai",   # or "auto" / "anthropic" / "ollama" ...
    model="gpt-4o",
)
# Auto: recall → inject → LLM → store
# Returns the raw provider response object
print(reply.choices[0].message.content)
Full API Mapping
Mem0StremAINotes
m.add(text, user_id)ab.add(text, user_id)Drop-in; or ab.store(content, title=, type=)
m.search(query, user_id)ab.search(query, user_id)Drop-in alias for ab.recall(query)
m.get_all(user_id)ab.health() / LocalMemory().export()Health stats, or a full local dump
m.delete(memory_id)ab.forget(id)Soft delete (archived, recoverable)
m.update(memory_id, data)ab.store(...)Auto-dedup updates the existing entry
m.history(memory_id)Brain time machine (MCP / cloud)Snapshots + rollback
(no equivalent)ab.verify(id)Reset confidence decay
(no equivalent)memory_compact (MCP tool)Archive stale, merge dupes
(no equivalent)ab.chat(messages)Auto-memory LLM wrapper
What You Gain by Switching
  • Better search: 4-strategy RRF fusion instead of vector-only
  • Confidence decay: Old memories fade, frequently-used ones stay strong
  • Poison detection: 20+ patterns block prompt injection in stored memories
  • Local mode: Work offline, sync to cloud when ready
  • brain.chat(): Auto-memory wrapping for any LLM in one line
  • Memory tiers: Working (24h) → episodic → semantic → procedural (365d)
  • Multi-agent teams: Shared knowledge with role-based permissions
  • MCP tools: Works with Claude Code, Codex, Cursor, any MCP client (tool count varies by transport)

Questions about migrating?

Start with local mode to test without commitment.