The Tablestore Agent Storage SDK is designed for AI agent storage scenarios. It provides a unified wrapper for memory store, file memory, and knowledge base interfaces, and is available in Python and TypeScript. It also supports API Key authentication to simplify service API authentication. For authentication and usage examples in each language, see Python and TypeScript.
Differences from the Tablestore SDK
The Agent Storage SDK is a standalone SDK separate from the Tablestore SDK and focuses on agent storage scenarios. The main differences between the two SDKs are as follows.
|
Dimension |
Tablestore SDK |
Agent Storage SDK |
|
Package name |
Python: |
Python: |
|
Client class |
|
|
|
Capabilities |
All Tablestore interfaces, including memory store interfaces |
Agent storage service interfaces (memory store, file memory, and knowledge base) |
|
Authentication |
AccessKey (AK/SK) |
API Key or AccessKey (AK/SK) |
Installation and configuration
Prerequisites
-
Tablestore is activated and an instance is created. Obtain the HTTPS endpoint and instance name of the instance.
-
If you use API Key authentication: an API Key has been created on the target instance, and the RAM sub-account bound to the API Key is granted the
ots:CallWithBearerTokenpermission. The API Key inherits the interface permissions from the RAM policy of the sub-account. -
If you use knowledge base capabilities: Alibaba Cloud Object Storage Service (OSS) is activated and a bucket is created to store original documents. When you upload documents, the SDK requires OSS access credentials (AccessKey). When you initialize the client, you must pass in the
oss_endpointandoss_bucketparameters.
Authentication methods
The Agent Storage SDK supports two authentication methods. The comparison is as follows.
|
Authentication method |
Applicable scenario |
Supported interfaces |
Transport requirement |
|
AccessKey (AK/SK) |
Full-feature access, including table management and data operations |
All Tablestore interfaces |
HTTP / HTTPS |
|
API Key |
Lightweight access for AI scenarios, without managing AccessKey ID/Secret |
Agent storage service interfaces |
HTTPS required |
For more information about how to create and authorize an API Key, see API Key management.
Initialize the client
We recommend that you use API Key authentication. If you need knowledge base upload or other Tablestore interfaces, you must also provide an AccessKey and OSS configuration. For initialization code and complete usage examples in each language, see Python and TypeScript.