Skip to content

Feat: Add Mem0 as a memory store plugin #597

@kartik-mem0

Description

@kartik-mem0

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 importmem0ai is only imported when a Mem0 store is actually instantiated, not at startup
  • Correct entity scopinguser_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                                                                                                                                                                           

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions