Summary
Add Mem0 as a new memory store type alongside the existing simple, file, and blackboard stores. Mem0 provides cloud-managed semantic search and graph-based memory, enabling agents to remember user preferences and past interactions across sessions without requiring local embedding computation or persistence.
Motivation
Currently, all memory stores are local — they reset between runs (simple), require local disk and embeddings (file), or are append-only within a session (blackboard). There is no option for persistent, cloud-managed memory that works across sessions and devices.
Mem0 fills this gap by providing:
- Semantic search over stored memories (server-side embeddings)
- Graph relationships between entities for richer retrieval
- Cross-session persistence without local file management
- Sub-50ms retrieval latency
Proposed Changes
- Add
Mem0MemoryConfig dataclass following the existing BaseConfig pattern with FIELD_SPECS for UI generation
- Add
Mem0Memory(MemoryBase) implementation using the mem0ai Python SDK with lazy imports
- Register
mem0 as a new store type via the existing plugin registry in builtin_stores.py
- Add
mem0ai as a dependency
- Add unit tests and a YAML example workflow
Key Design Decisions
- Uses
mem0ai Python SDK — not raw API calls
- Lazy import —
mem0ai is only imported when a Mem0 store is actually instantiated, not at startup
- Correct entity scoping —
user_id and agent_id use filters dict for search (with OR filter when both are configured) and top-level kwargs for add
- Agent memories use
role: "assistant" — matches Mem0's entity-scoped memory model
load()/save() are no-ops — Mem0 manages persistence server-side
Configuration Example
memory_stores:
- name: agent_memory
type: mem0
config:
api_key: ${MEM0_API_KEY}
agent_id: my-agent
Summary
Add Mem0 as a new memory store type alongside the existing
simple,file, andblackboardstores. Mem0 provides cloud-managed semantic search and graph-based memory, enabling agents to remember user preferences and past interactions across sessions without requiring local embedding computation or persistence.Motivation
Currently, all memory stores are local — they reset between runs (
simple), require local disk and embeddings (file), or are append-only within a session (blackboard). There is no option for persistent, cloud-managed memory that works across sessions and devices.Mem0 fills this gap by providing:
Proposed Changes
Mem0MemoryConfigdataclass following the existingBaseConfigpattern withFIELD_SPECSfor UI generationMem0Memory(MemoryBase)implementation using themem0aiPython SDK with lazy importsmem0as a new store type via the existing plugin registry inbuiltin_stores.pymem0aias a dependencyKey Design Decisions
mem0aiPython SDK — not raw API callsmem0aiis only imported when a Mem0 store is actually instantiated, not at startupuser_idandagent_idusefiltersdict for search (with OR filter when both are configured) and top-level kwargs for addrole: "assistant"— matches Mem0's entity-scoped memory modelload()/save()are no-ops — Mem0 manages persistence server-sideConfiguration Example