MemorySync
Getting Started

CAMEL-AI Memory

A lossless storage backend plus a drop-in AgentMemory for CAMEL’s ChatAgent: verbatim history, scored semantic recall injected after the system prompt under a hard budget, and zero client-side embeddings. Install camel-memorysync from PyPI.

What installs

pip install camel-memorysync

CAMEL ships a Mem0 storage inside its own repo — the only other memory SaaS in the ecosystem. Verified against its source:

Mem0 (`Mem0Storage`, in-repo)ZepSupermemoryMemorySync
History round-tripbrokenload() returns extracted facts, not your messages— nothing at all— nothing at all✓ byte-exact: from_dict reconstructs every record
Message rolesevery record hardcoded `role=USER` — OpenAI alternation breaks✓ preserved exactly
clear() blast radius✗ calls `client.delete_users()` — the entire user entity✓ local window only; remote wipes are explicit and scoped
agent_id filter✗ silently overwritten by the user_id filter✓ both preserved per record
Failures✗ every exception swallowed — callers never know✓ conversation always works, failures logged loudly; explicit deletes raise
Multimodalimage_list/video_bytes silently discarded✓ full media round-trip (base64)
Recall latency guard✗ none✓ 1.2s hard budget, fails open to history-only
Client-side embeddingsn/a✓ none needed (CAMEL’s own VectorDBMemory defaults to OpenAIEmbedding() + a vector DB you operate)

How recall enters the context

CAMEL’s ScoreBasedContextCreator sorts records by timestamp. The recall block is ONE SYSTEM-role record with timestamp=0.0, so it lands right after the system prompt — your history is never reordered, rewritten, or role-swapped. An anti-echo filter drops any match already present verbatim in the live context, so the question the user just asked can never come back as a “memory”.

[system] You are a helpful travel assistant.
[system] Relevant long-term memories about this user:
- Prefers window seats on long flights
[user] which seat should I book for the Oslo flight?

Memories created by other MemorySync surfaces — LangChain, the CLI, voice agents, coding agents — are recallable inside CAMEL too. That is the point of memory-as-a-service.

Deletion — designed against data loss

CallWhat happens
clear()Resets the LOCAL conversation window only — remote memories survive
forget_session()Deletes THIS session’s mirrored turns (loud — failures raise)
forget_user()Deletes all camel-surface rows for this user; other surfaces’ memories survive

Configuration

ParameterDefaultMeaning
user_id— (required)End user the memories belong to
session_iddefaultTranscript scope: camel::<session>
top_k5Memories per recall
recall_timeout1.2Hard recall budget in seconds
min_query_chars8Skip recall for trivial topics
extractionTrueMirror user/assistant turns to MemorySync
context_creatorScoreBased / 2048 tokensAny BaseContextCreator

Dependency note: camel-ai 0.2.x crashes at import under mcp 2.0 (FastMCP moved), so this package pins mcp<2 until CAMEL supports it.

Supported versions

SurfaceRequiresVerified on
camel-memorysync 1.0.0camel-ai 0.2.60+ (Python 3.10–3.14)29 CI checks against the latest camel-ai: REAL ChatAgent turns via CAMEL’s own StubModel — the byte-exact round-trip including a PIL image, role preservation, local-only clear with explicit scoped forgets, the anti-echo filter, timestamp-0 placement through the real ScoreBasedContextCreator, the 1.2s budget, seed idempotency, and both monthly-quota server modes

Where to go next

Was this page helpful?