Create memory management

Updated at:

To equip an AI application with long-term memory capabilities, you must first create a memory management application. Before you create the application, prepare an eligible PolarDB for PostgreSQL cluster and database. Then, activate the service on the unified buy page and select the memOS or mem0 memory engine based on your use case.

Prepare the cluster environment

Before you create a memory project, you must prepare a Applicability-compliant PolarDB for PostgreSQL cluster, and create a dedicated database for the cluster.

  1. Prepare a cluster: You can use an existing cluster or purchase a new cluster based on your business requirements.

  2. Create a privileged account: Prepare a privileged account that is used to create the memory management application. If you already have a privileged account, skip this step.

  3. Create a database: Create a logical database (Database) to store the data of the memory project.

  4. Configure an IP whitelist: Set whitelists for a cluster to ensure that your application can securely connect to the database.

Create a memory management application in the console

The overall workflow: go to the PolarDB Mem0 page in the console, configure the application parameters on the buy page, complete the purchase, and then check the application status.

  1. Log on to the PolarDB console. In the left-side navigation pane, click PolarDB Agent Memory.

  2. On the PolarDB Agent Memory page, click Create Memory. The system automatically opens a new tab that displays the buy page.

  3. At the top of the buy page, click the PostgreSQL tab to switch to the parameters of the PostgreSQL engine.

  4. Configure the parameters in the following groups. Fixed and automatically filled parameters do not need to be modified.

    • Billing method: The billing method determines the parameters that you need to configure later.

      • Subscription: A prepaid billing method. You must pay for the service in advance. The longer the subscription duration, the larger the discount. This method is suitable for workloads with stable long-term requirements. If you select this method, you must also configure Quantity, Duration, and Auto-renewal.

      • Pay-as-you-go: A postpaid billing method. You are billed based on the actual usage duration. This method is suitable for workloads with flexible requirements.

    • Cluster and application settings: Specify the region where the application is deployed, the source cluster, and the AI application information.

      Parameter

      Description

      Database Engine

      Fixed to PolarDB.

      Region

      Select the region where the application is deployed.

      Note
      • The region cannot be changed after the application is purchased.

      • The application must reside in the same region as the PolarDB for PostgreSQL cluster. Therefore, select the region where the PolarDB for PostgreSQL cluster is deployed.

      • (Recommended) Create the application in the same region as the Elastic Compute Service (ECS) instance to which the application needs to connect. Otherwise, the application and the ECS instance cannot communicate over the internal network (private network) and can communicate only over the Internet (public network). This prevents the system from delivering optimal performance.

      Source PolarDB Cluster

      Select the PolarDB for PostgreSQL cluster on which you want to create the memory management application. To create a new cluster, click the Create> link to go to the cluster creation page.

      Version

      Automatically filled with the database version of the source PolarDB for PostgreSQL cluster. You do not need to enter it manually.

      AI Application

      Fixed to memory management.

      Authorize SLR

      The system automatically selects this option to grant the AliyunServiceRoleForPolarDB service-linked role. Click View Details to view the role permissions.

      Memory Engine

      • memOS: An open memory operating system based on OpenMem. It provides capabilities such as multi-modal memory, memory governance, and a visual operation interface. For details about its capabilities, see memOS documentation.

      • mem0: A managed memory service based on the open source mem0 framework. It provides capabilities such as memory extraction, memory retrieval, and custom policies.

      Component set

      An AI application can contain multiple resource components. (Recommended) Select at least two components to support high availability.

      AI Application Name

      A custom application name. The name cannot start with http:// or https://, and must be 2 to 256 characters in length.

    • Network settings: Specify how the application connects to a VPC.

      Parameter

      Description

      VPC

      Configure the VPC. (Recommended) Select the same VPC as the PolarDB for PostgreSQL cluster to achieve optimal network performance.

      If none of the existing VPCs meets the requirements, you can create a VPC

      Zone and vSwitch

      Configure the vSwitch of the VPC. (Recommended) Select a vSwitch in the primary zone of the PolarDB for PostgreSQL cluster to achieve optimal network performance.

      If none of the existing vSwitches meets your requirements, you can create a vSwitch.

    • Project settings and account security: Specify the application project and account information.

      Parameter

      Description

      Project name

      An independent memory management unit that corresponds to one AI application. At the database level, each project corresponds to a separate schema, which ensures data isolation.

      Database name

      Enter the name of the database that corresponds to the project.

      LLM

      Select a large language model (LLM). The value cannot be changed after selection.

      Graph LLM

      Select a graph large language model. The value cannot be changed after selection.

      Note

      This parameter is required only when Memory Engine is set to mem0.

      Embedding Model

      Select a text-to-vector embedding model. The value cannot be changed after selection.

      ReRank Model

      Select the model that is used in the memory ReRanker process. The value cannot be changed after selection.

      Note

      This parameter is required only when Memory Engine is set to mem0.

      Number of Memory Shards

      Select the number of memory shards. Default value: 1.

      Note

      This parameter is required only when Memory Engine is set to mem0.

      Vector Dimensions

      Select the number of vector dimensions. Default value: 1024.

      Note

      This parameter is required only when Memory Engine is set to mem0.

      Database Account

      Enter the privileged account of the cluster that you prepared.

      Password

      Enter the password of the privileged account.

      Security group

      Configure the security group of the application.

    • Duration and renewal settings: Configure the following parameters only when Billing method is set to Subscription.

      Parameter

      Description

      Quantity

      Select the number of applications that you want to purchase.

      Note

      Each PolarDB for PostgreSQL cluster supports the purchase of only one AI application of the same type.

      Duration

      Select the subscription duration of the application.

      Auto-renewal

      Specify whether to enable auto-renewal. (Recommended) Enable auto-renewal to avoid service interruptions caused by forgetting to renew.

  5. After you confirm the settings, complete the purchase and return to the PolarDB Agent Memory list page to view the newly created application.

    Note

    The system takes 3 to 5 minutes to create the application. When the Status column displays Running, the memory management application is created.