All Products
Search
Document Center

Hologres:Create and use long memory service

Last Updated:Sep 01, 2026

You can create a long memory service instance in the Hologres console and use APIs to add, search, and manage memory data.

Create a service

Note

Each Alibaba Cloud account supports up to five long memory services per region.

  1. Log on to the Hologres console.

  2. In the left-side navigation pane, choose Long Memory Service.

  3. Click Create Memory Service.

  4. On the configuration page, configure the following parameters.

    Parameter

    Description

    Region

    The region in which the service is deployed.

    Zone

    The zone in which the service is deployed.

    Service Type

    The type of the service. Only Mem0 is supported.

    Virtual Private Cloud (VPC)

    The virtual private cloud (VPC) used by the service.

    VPC vSwitch

    The vSwitch used by the service.

    Security Group

    The security group of the service. We recommend that you select the same security group as the Elastic Compute Service (ECS) instance that needs to connect to the service.

    Instance Name

    The name of the long memory service instance.

    Service-linked Role

    When you create a long memory service for the first time, you must create the service-linked role AliyunServiceRoleForHologresOpenMemoryMgt. This role allows the service to access your resources in other Alibaba Cloud services.

  5. Click Create Now.

Obtain connection information

After the service is created, click Service Details in the Actions column of the target service instance to view the following information:

  • Private IP: Used for access within the same VPC. This method provides lower latency.

  • Public IP: Used for cross-VPC or on-premises access.

  • API-KEY: The unique credential for accessing the service. Keep it secure.

Note

The API-KEY can be reset. After the reset, the previous API-KEY immediately becomes invalid. Proceed with caution.

Call long memory service APIs

The following examples demonstrate core long memory service API calls. To obtain the value of <your-endpoint> and the API-KEY, see Obtain connection information. All requests must include the following authentication information in the HTTP header:

Authorization: Token <your-api-key>
Content-Type: application/json

Add a memory

Call POST /v1/memories/ to add a conversation memory. The system automatically analyzes the conversation and extracts structured memories. Example:

curl -X POST "http://<your-endpoint>:80/v1/memories/" \
  -H "Content-Type: application/json" \
  -H "Authorization: Token <your-api-key>" \
  -d '{
    "messages": [
      {"role": "user", "content": "My name is John and I like Sichuan cuisine"},
      {"role": "assistant", "content": "OK, I have noted that your name is John and you like Sichuan cuisine."}
    ],
    "user_id": "user_001",
    "agent_id": "agent_001",
    "run_id": "run_001"
  }'

Sample response:

{
  "results": [
    {
      "id": "mem_abc123",
      "memory": "The user's name is John",
      "event": "User self-introduction"
    },
    {
      "id": "mem_def456",
      "memory": "The user likes Sichuan cuisine",
      "event": "User food preference"
    }
  ]
}

Search memories

Call GET /v1/memories/search/ to retrieve memories related to a user by semantic query. Example:

curl -X GET "http://<your-endpoint>:80/v1/memories/search/?query=What+food+does+John+like%3F&user_id=user_001" \
  -H "Authorization: Token <your-api-key>"

Sample response:

{
  "results": [
    {
      "id": "mem_def456",
      "memory": "The user likes Sichuan cuisine",
      "score": 0.95,
      "metadata": {
        "user_id": "user_001",
        "created_at": "2026-06-15T08:30:00Z"
      }
    }
  ]
}

List memories

Call POST /v2/memories/ to retrieve the complete memory list for a user based on filter conditions. Example:

curl -s -X POST "http://<your-endpoint>:80/v2/memories/" \
  -H "Content-Type: application/json" \
  -H "Authorization: Token <your-api-key>" \
  -d '{"filters":{"user_id":"openclaw-user"}}' | python3 -m json.tool

Sample response:

{
  "results": [
    {
      "id": "mem_abc123",
      "memory": "The user's name is John",
      "metadata": {
        "user_id": "user_001",
        "agent_id": "agent_001",
        "run_id": "run_001",
        "created_at": "2026-06-15T08:30:00Z"
      }
    }
  ]
}

Service security management

Hologres long memory service supports IP whitelist and security group management. Click the service ID of the target instance to go to the service details page, and then click the Service Security tab.

  • IP Whitelist: By default, only the VPC CIDR block is added to the IP whitelist. To access the service by using the public endpoint, you must manually add IP addresses to the whitelist. For quick testing, you can allow all IP addresses by setting the whitelist to 0.0.0.0/0.

  • Security Group: View the security group associated with the service.

Memory sharing

Hologres long memory service lets you share memory data between long memory services in the same region, so that memories accumulated by individuals become team- and organization-level knowledge assets. Click the service ID of the target instance to go to the service details page, and then click the Sharing Configuration tab.

  • Outbound Sharing: Shares the memory data of the current service with other long memory services in the same region. If you turn on Share with all long memory services in the same region, the memory data of the current service becomes visible to every long memory service in the region. You can also click Add Sharing Rule to specify individual target services.

  • Inbound Sharing: Other services share their memory data with the current service. The inbound sharing list is determined by the outbound sharing rules of those services, so you do not need to configure anything in the current service. The list shows the ID, name, and status of each source service.

Note

Memory sharing supports direct sharing only. For example, if service A shares its memory data with service B but not with service C, and service B shares its memory data with service C, service C still cannot retrieve the memory data of service A.

Release a service

Important

After the service is released, all memory data in the service is permanently deleted and cannot be recovered. Proceed with caution.

  1. Log on to the Hologres console.

  2. In the left-side navigation pane, choose Long Memory Service.

  3. Find the target long memory service, and then click Release in the Actions column.

  4. In the dialog box, confirm the release.

API reference

Hologres long memory service is built on the open-source Mem0 V2.0.6. All API requests must include the following authentication information in the HTTP header:

Authorization: Token <your-api-key>
Content-Type: application/json

The following table lists the supported APIs.

Operation

Method

Path

Add a memory

POST

/v1/memories/

Update a memory

PUT

/v1/memories/{memory_id}/

Delete a memory

DELETE

/v1/memories/{memory_id}/

Query a memory

GET

/v1/memories/{memory_id}/

Delete memories by condition

DELETE

/v1/memories/

List memories

POST

/v2/memories/

Search memories

GET

/v2/memories/search/