The memory feature provides intelligent applications with persistent, personalized memory capabilities. By creating and managing Memory Spaces, you can capture information such as user preferences and historical context from conversations, and quickly retrieve it via intelligent search in subsequent interactions. This enhances the accuracy and continuity of application responses. The memory feature is currently free and is expected to become commercially available in the second half of 2026.
Overview
The AI memory feature provides intelligent applications with persistent, personalized memory capabilities. By structuring and storing information such as user preferences, behavioral habits, and historical context from conversations into memory, applications can leverage semantic search to quickly retrieve relevant information during later interactions, delivering more precise and continuous personalized responses.
The memory feature uses Memory Spaces as its basic management unit. Each memory space has a globally unique Space ID, and data is completely isolated between spaces. You can create independent memory spaces for different business scenarios, user groups, or applications to ensure that memory data does not interfere with each other. When integrating an application, you need to specify the target memory space's Space ID to write conversation messages to that space and retrieve stored memories.
On the Memory page of the AI services, you can perform the following operations:
Create a memory space: Allocate independent memory containers for different business scenarios or user groups.
Manage a memory space: View, edit, and delete an existing memory space, and view the creation time and identifier of each space.
View memory data: Enter a specified memory space to view the stored personalized memory content.
Integrate into an application: Obtain API key configuration, sample code for accessing the memory space, and sample code for intelligent search through Integration Examples.
Usage monitoring: View the resource consumption of the memory feature or a specified memory space.
Prerequisites
You have activated the AI services and entered its page.
You have created a valid API key. For specific operations, see Manage AI API keys.
Access the memory space page
Log in to the OceanBase Cloud console.
In the left navigation pane, click AI Services to go to the AI services page.
In the left menu of the AI services, click Memory to go to the memory space list page.
Create a memory space
On the memory space page, click Create Memory Space in the upper-right corner.
In the Create Memory Space dialog box, enter the following information:
FieldRequiredDescriptionName Yes The display name of the memory space, up to 128 characters. Description No A description of the purpose of the space, up to 512 characters. Click OK to complete the creation. The new memory space will be displayed as a card in the list.
Note
A memory space card displays the memory space name, description, identifier, and creation time, making it easy for you to quickly identify and manage memory spaces.
Manage a memory space
View the memory space list
The memory space page displays all memory spaces in a grid of cards. Each card contains:
Name: The name of the memory space.
Description: The description entered during creation (if any).
Space ID: The unique identifier of the memory space.
Created At: The creation time of the memory space.
View integration examples
In the ··· menu on the memory space card, select Integration Examples to view the access examples for that memory space.
View usage monitoring
In the ··· menu on the memory space card, select Usage Monitoring to view the resource consumption of the memory space.
Edit a memory space
In the upper-right corner of the target memory space card, click ···.
Select Edit.
In the dialog box, modify the name or description, and click OK to save.
Delete a memory space
In the upper-right corner of the target memory space card, click ···.
Select Delete.
Complete the deletion operation as prompted on the page.
Note
After a memory space is deleted, the memory data within it cannot be restored, and application integrations that depend on this Space ID will become invalid. Please ensure no business is using this memory space before deleting it.
View memory space details
In the memory space list, click the target memory space card to go to its details page.
In the upper-left corner of the page, use the Memory Space drop-down list to switch to the desired space.
On the Memory tab, view the accumulated memory data of the current space.
The following actions are available in the upper-right corner of the details page:
View Usage: View the usage information of the current memory space.
Refresh: Refresh the memory data list on the current page.
Integration Examples: Open the integration example panel to obtain the access code.
Integration Examples
You can open the integration example panel by clicking the Integration Examples button on the page (in the upper-right corner of the list page, or in the menu of a card), and follow these steps to integrate the memory capability into your application.
Obtain the API key
In the Step 1: Obtain API Key section, select the API key from the drop-down list for the call.
If the list displays it as a masked form, go to the Manage AI API keys page, save the full key during creation, and replace the placeholder in the command below with the complete API key.
API_KEY="sk_ba2cc287-******8b86c"
Note
If the current key is displayed as a mask, copy the command and fill it with the full key saved during API key creation; otherwise, authentication will not complete successfully.
Integrate a memory space
In the Step 2: Integrate Memory Space section, select the memory space to integrate into the application from the drop-down list.
Record the Space ID displayed on the page (for example,
1dbbd82b553a4299a2e60e84c9837631), and replace{sid}with this value in your code.Refer to the Python example provided on the page to initialize the client and write a message:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ OBCloud memory · Write to memory POST /spaces/{spaceId}/memories """ import json import urllib.request # ====== Configuration ====== # Obtain the API key and fill it in below. API_KEY = "sk_xxxxxx" # Click the organization name in the upper-left corner of the page, and then copy the project ID of the current project from the project list. PROJECT_ID = "xxxxxxx" # In the lower-left corner of the space, click Copy Complete Space ID to obtain the SPACE_ID. SPACE_ID = "xxxxxc" BASE_URL = "https://ai-api-g.oceanbase.com/api/v1/memory" # ================== body = { "content": "User Zhang San lives in Beijing, loves playing basketball, and prefers latte as his coffee flavor.", "metadata": {"userId": "user_001", "category": "personal_info"}, } req = urllib.request.Request( f"{BASE_URL}/spaces/{SPACE_ID}/memories", data=json.dumps(body, ensure_ascii=False).encode("utf-8"), method="POST", headers={ "Authorization": f"Bearer {API_KEY}", "X-OB-Project-ID": PROJECT_ID, "Content-Type": "application/json", }, ) with urllib.request.urlopen(req, timeout=30) as resp: print(json.dumps(json.loads(resp.read()), ensure_ascii=False, indent=2))
Each memory space has independent personalized memories. Ensure you use the memory space and its Space ID that match your business scenario in the application.
Experience intelligent search
The memory feature includes built-in intelligent search capabilities to help applications understand user needs more accurately. Refer to the following example to continue to write information and perform a search:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
OBCloud memory · Retrieve memory
POST /spaces/{spaceId}/memories/search
"""
import json
import urllib.request
# ====== Configuration ======
# Obtain the API key and fill it in below.
API_KEY = "sk_xxxxxx"
# Click the organization name in the upper-left corner of the page, and then copy the project ID of the current project from the project list.
PROJECT_ID = "xxxxxx"
# In the lower-left corner of the space, click Copy Complete Space ID to obtain the SPACE_ID.
SPACE_ID = "xxxxx"
BASE_URL = "https://ai-api-g.oceanbase.com/api/v1/memory"
# ==================
body = {
"query": "What kind of coffee does Zhang San usually like to drink?",
}
req = urllib.request.Request(
f"{BASE_URL}/spaces/{SPACE_ID}/memories/search",
data=json.dumps(body, ensure_ascii=False).encode("utf-8"),
method="POST",
headers={
"Authorization": f"Bearer {API_KEY}",
"X-OB-Project-ID": PROJECT_ID,
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req, timeout=30) as resp:
print(json.dumps(json.loads(resp.read()), ensure_ascii=False, indent=2))
