Skip to main content
The mem0 backend uses Mem0 as long-term storage. It is a managed service where Mem0 handles memory extraction, storage, and retrieval, requiring no self-hosted vector store or local embedding — recommended for production.

When to use

  • Production needing a managed memory service;
  • You want Mem0 to automatically extract and manage memories;
  • You have a Mem0 account and API key, or can auto-fetch one via Volcengine credentials.

Dependencies

Usage

The install command includes the official Mem0 Python package, mem0ai>=1.0.0,<2. Set DATABASE_MEM0_API_KEY and DATABASE_MEM0_BASE_URL first. Use https://api.mem0.ai for public Mem0 without a /v1 suffix. Volcengine credential exchange applies only to its corresponding managed memory service, not arbitrary Mem0 accounts
You can also pass config explicitly via backend_config:

Parameters

LongTermMemory parameters

Constructor parameters

backend_config supports the following settings:

Mem0 config

mem0_config is a Mem0Config with env prefix DATABASE_MEM0_:

API key resolution order

If api_key is provided directly, it is used as is; otherwise VeADK tries to fetch the API key via api_key_id or project_id; initialization fails if neither is set.

Environment variables

If api_key is not provided directly, VeADK tries to obtain it via api_key_id or project_id; an error is raised if neither is set.

Verify writes and retrieval

After configuring the dependencies and credentials on this page, run this standalone example. It saves user text and searches for that user directly without calling a conversation model
Results should contain the saved language preference. Managed services may extract memories asynchronously, so a completed write does not guarantee immediate retrieval. An empty result can also indicate permission, network, or service failure; check error logs and service records. The save method does not return a success Boolean index is not sent in Mem0 save or search requests and does not create a separate project. Within one service and credential scope, the runtime user_id distinguishes memory. Use application-specific credentials or stable application-and-user identifiers when sharing a service. Saving uses asynchronous extraction, so searches can initially return no results
Last modified on September 19, 2026