An AgentStorage instance is an instance-level resource container for knowledge storage and memory storage. Before you create a knowledge base or memory store, you must first create an AgentStorage instance in the target region. Subsequently, SDKs and data plane APIs use the instance name and HTTPS endpoint to locate resources.
Resource hierarchy
Alibaba Cloud account
└── Region
└── AgentStorage instance
├── Knowledge base
│ ├── Documents
│ └── Chunks and indexes
└── Memory store
├── Long-term memory, short-term messages, and tasks
├── Files, file versions, and Dreams
└── Agent Wiki (knowledge graph) and pages
Knowledge base names and memory store names are managed within the AgentStorage instance that owns them. The instance determines the region, access entry, network boundary, and instance-level access control policies used by these resources.
Management plane and data plane
|
Plane |
Managed objects |
Access entry |
Authentication |
|
Management plane |
AgentStorage instances, VPC bindings, and instance-level access control policies |
|
AccessKey signature |
|
Data plane |
Knowledge bases, memory stores, and their sub-resources |
AgentStorage HTTPS endpoint |
API Key or AccessKey |
Management plane fields use PascalCase, for example AgentStorageName. The knowledge and memory data plane primarily uses camelCase, for example knowledgeBaseName and memoryStoreName.
Create an instance
When you create an instance, you must specify at least AgentStorageName. You can also specify a description, resource group, tags, allowed network types, and access control policies.
Recommended process:
-
Call Create an AgentStorage instance in the target region.
-
Use List AgentStorage instances to query the status.
-
Wait until
AgentStorageStatuschanges tonormal. -
Obtain the endpoint of the instance and, in the SDK, set the AgentStorage name to the instance name.
Console
-
Log on to the AgentStorage console and select the target region from the region drop-down list at the top of the page. China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Hong Kong), and Singapore are currently supported. Resources are not displayed across regions.
-
In the left-side navigation pane, click AgentStorage Management. Then, in the upper-right corner of the page, click Create AgentStorage.
-
In the Create AgentStorage dialog box, configure the following parameters and click OK.
Parameter
Description
Name
Required. The name must be 3 to 16 characters in length and must start with a letter. It can contain only letters, digits, and hyphens, and cannot end with a hyphen. The name must be unique within the same region.
Description
Optional. Describes the business scenario of the instance. It can be up to 128 characters in length.
Resource Group
Optional. Used to manage resources and permissions in a centralized manner.
-
After the instance is created, it appears in the AgentStorage Management list. When the Status column changes to Available, the instance is ready.
-
Click the instance name or click Details in the Actions column to view and copy the endpoint of the instance, which is used to locate the instance in SDKs and data plane APIs. Click Enter AgentStorage in the Actions column to enter the instance and manage knowledge bases and memory stores.
SDK
Instance management belongs to the management plane OpenAPI (Tablestore/2020-12-09) and uses AccessKey signature authentication. The following example uses the Python management plane SDK alibabacloud_tablestore20201209 to create an instance and wait until it is ready.
import os
import time
from alibabacloud_tablestore20201209.client import Client
from alibabacloud_tablestore20201209 import models as tablestore_models
from alibabacloud_tea_openapi import models as open_api_models
# Initialize the client with a management plane AccessKey. The endpoint is automatically resolved from region_id (for example, tablestore.cn-hangzhou.aliyuncs.com).
config = open_api_models.Config(
access_key_id=os.environ["ALIBABA_CLOUD_ACCESS_KEY_ID"],
access_key_secret=os.environ["ALIBABA_CLOUD_ACCESS_KEY_SECRET"],
region_id="cn-hangzhou",
)
client = Client(config)
# 1. Create an AgentStorage instance
client.create_agent_storage(
tablestore_models.CreateAgentStorageRequest(
agent_storage_name="agent-prod",
agent_storage_description="Knowledge and memory storage for AI agents",
)
)
# 2. Poll the instance status until AgentStorageStatus changes to normal
get_request = tablestore_models.GetAgentStorageRequest(agent_storage_name="agent-prod")
while client.get_agent_storage(get_request).body.agent_storage_status != "normal":
time.sleep(2)
print("AgentStorage is ready. You can now create knowledge bases and memory stores.")Delete an instance
Console
-
Log on to the AgentStorage console, select the region of the instance at the top of the page, and then click AgentStorage Management in the left-side navigation pane.
-
In the Actions column of the row that contains the target instance, click More and then click Delete.
-
In the Delete AgentStorage dialog box, verify the instance name and then click Confirm Delete. The deletion cannot be undone.
SDK
Deletion is also performed by calling DeleteAgentStorage through the management plane SDK alibabacloud_tablestore20201209.
import os
from alibabacloud_tablestore20201209.client import Client
from alibabacloud_tablestore20201209 import models as tablestore_models
from alibabacloud_tea_openapi import models as open_api_models
config = open_api_models.Config(
access_key_id=os.environ["ALIBABA_CLOUD_ACCESS_KEY_ID"],
access_key_secret=os.environ["ALIBABA_CLOUD_ACCESS_KEY_SECRET"],
region_id="cn-hangzhou",
)
client = Client(config)
# Delete the AgentStorage instance. After deletion, the tables, table data, and related indexes in the instance cannot be recovered.
client.delete_agent_storage(
tablestore_models.DeleteAgentStorageRequest(agent_storage_name="agent-test")
)-
Stop writing data to the knowledge bases and memory stores in the instance.
-
Confirm that applications that depend on the endpoint, API key, and VPC address of the instance have been migrated.
-
Export or back up any data that you still need to retain.
-
Do not create an AgentStorage instance with the same name immediately after deletion, to avoid conflicts with the background release process.
The deletion cannot be undone and makes the tables, table data, and related indexes in the instance unavailable.
Limits
-
A single Alibaba Cloud account can create up to 10 AgentStorage instances.
-
An AgentStorage name must be unique within its region and must be 3 to 16 characters in length.
-
The name must start with a letter and can contain only letters, digits, and hyphens. It must not end with a hyphen.
-
The name is case-insensitive and must not contain
ali,ay,ots,taobao, oradmin.