Skip to main content
agentscope-extensions-mem0 integrates Mem0 as the long-term memory store, combining vector search with LLM-based memory extraction. It supports the Mem0 SaaS platform, self-hosted deployments, and local stand-alone setups.

When to use

  • You want cross-session factual memory in your Agent (user preferences, prior decisions).
  • You need multi-tenant isolation via three metadata layers: agentId / userId / runId.
  • You want to filter memory at retrieval time using custom metadata, e.g. category=travel.

Add the dependency

Quickstart

Deployment modes

Mem0ApiType chooses the URL conventions and auth scheme:

Multi-tenant isolation

agentName / userId / runName are the three identifier layers Mem0 uses to organize memory:
At least one of the three must be provided; otherwise build() throws IllegalArgumentException. Retrieval only returns memories whose metadata matches.

Custom metadata filtering

metadata(...) is applied to both writes and reads — it is persisted with each memory and injected as a filter when retrieving.
Useful when slicing knowledge by project or business line. If you only need per-user separation, userId alone is enough.

Builder reference

At least one of agentName / userId / runName must be set, otherwise build() throws IllegalArgumentException.