Skip to main content
The opensearch backend uses OpenSearch as the vector store. Memory text is embedded by an embedding model, written to OpenSearch with a per-user index (the actual index name is {index}_{user_id}), and retrieved by similarity. It is the default backend for LongTermMemory.

When to use

  • You already run an OpenSearch cluster and want self-hosted vector search;
  • You need persistence, sharing across processes and instances, and full control over indexing and retrieval.

Dependencies

Usage

You can also pass connection and embedding config explicitly via backend_config:

Parameters

Constructor parameters

backend_config supports the following settings:

OpenSearch connection config

opensearch_config is an OpensearchConfig with env prefix DATABASE_OPENSEARCH_:

Embedding config

embedding_config is an EmbeddingModelConfig with env prefix MODEL_EMBEDDING_:

Environment variables

index must follow OpenSearch naming rules: all lowercase, only a-z0-9_-., and not starting with _ or -; otherwise initialization fails. In production, set cert_path to enable certificate verification and avoid security risks.
Last modified on September 19, 2026