Install
openclaw skills install alibabacloud-pai-feature-store-featuredb-usage-queryQuery FeatureDB read/write usage data from PAI-FeatureStore. Use for analyzing consumption, usage trends, and cost estimation by official pricing. Supports date range queries with breakdowns. Triggers: "FeatureDB read/write volume", "PAI-FeatureStore usage", "FeatureDB usage", "FeatureDB statistics", "Feature View usage", "PAI-FeatureStore billing"
openclaw skills install alibabacloud-pai-feature-store-featuredb-usage-queryArchitecture: PAI-FeatureStore Instance → FeatureDB Datasource → Feature Views → Usage Statistics
cn-beijing, cn-hangzhou, cn-shanghai, cn-shenzhen, cn-hongkong, ap-southeast-1, ap-southeast-5, us-west-1, eu-central-1
Pre-check: Aliyun CLI >= 3.3.3 required
Run
aliyun versionto verify >= 3.3.3. If not installed or version too low, runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto update, or seereferences/cli-installation-guide.mdfor installation instructions.Then [MUST] run
aliyun configure set --auto-plugin-install trueto enable automatic plugin installation. [MUST] runaliyun plugin updateto ensure that any existing plugins on your local machine are always up-to-date.
[MUST] CLI User-Agent — Every aliyun CLI command invocation must include:
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
The PAI-FeatureStore CLI plugin will be automatically installed when first used if auto-plugin-install is enabled.
Timeout: Default 10s is sufficient for all API calls.
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- NEVER output any string resembling a key (e.g.,
LTAI5t***,AccessKeyId: xxx,ak-***)- ONLY use
aliyun configure listto check credential statusaliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks, passwords, domain names, resource specifications, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
| Parameter Name | Required/Optional | Description | Default Value |
|---|---|---|---|
| RegionId | Required | Alibaba Cloud region ID. Must be one of the supported regions listed above. | None |
| WorkspaceId | Optional* | PAI workspace ID (numeric, e.g., 12345). Required if DatasourceId is not provided. | None |
| DatasourceId | Optional* | FeatureDB datasource ID (numeric, e.g., 67890). Required if WorkspaceId is not provided. | None |
| StartDate | Optional | Query start date in yyyy-MM-dd format. | 30 days ago (for total usage) or 7 days ago (for project/feature view) |
| EndDate | Optional | Query end date in yyyy-MM-dd format. | Yesterday |
| ProjectName | Optional | Project name (required for project-level and feature view queries). | None |
| FeatureViewName | Optional | Feature view name (required for feature view trend queries). | None |
| SortBy | Optional | Sort field: ReadCount or WriteCount | ReadCount |
| Order | Optional | Sort order: ASC or DESC | DESC |
Note: Either WorkspaceId or DatasourceId must be provided. If neither is provided, the skill will list all available FeatureDB datasources for user selection.
This skill requires the following RAM permissions. See references/ram-policies.md for detailed policy configuration.
Required Actions:
paifeaturestore:ListInstancespaifeaturestore:GetDatasourcepaifeaturestore:ListDatasourcespaifeaturestore:ListDatasourceFeatureViewsThis skill ONLY supports querying FeatureDB read/write usage statistics. Any requests outside of "querying historical read/write counts or costs" are out of scope and must be politely declined with a list of supported features.
[MUST] If request is out of scope, reject politely and list supported features:
"Sorry, this Skill only supports querying FeatureDB read/write usage statistics, not [user request]. Supported features: 1) Daily read/write totals 2) Feature view details 3) Usage trends 4) Cost calculation"
Which features to execute depends on user's request:
| Scenario | Action |
|---|---|
| Request out of scope or unsupported | Reject and list supported features (see above) |
| User specifies supported feature(s) | Execute the specified feature(s) |
| User doesn't specify any feature | Execute default behavior (see below) |
Use descriptive names instead of function numbers when prompting, because "Function 3" is meaningless to users who haven't read this document.
aliyun paifeaturestore list-instances \
--region <RegionId> \
--status Running \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Expected Output: A list of running instances with their InstanceIds.
Error Handling (if no running instances found — STOP, do NOT guess InstanceId):
No running PAI-FeatureStore instances found in this region. Please verify:
- Is the RegionId correct?
- Do you need to switch to a different region?
- To activate PAI-FeatureStore, visit the console
Case A: User provided WorkspaceId
aliyun paifeaturestore list-datasources \
--region <RegionId> \
--instance-id <InstanceId> \
--type FeatureDB \
--workspace-id <WorkspaceId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Case B: User provided DatasourceId
[MUST] When user provides DatasourceId, you MUST call GetDatasource or ListDatasources to verify the datasource type is
FeatureDB. Do NOT skip this validation step.
aliyun paifeaturestore get-datasource \
--region <RegionId> \
--instance-id <InstanceId> \
--datasource-id <DatasourceId> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Validation: Check the Type field in the response. If Type is NOT FeatureDB, stop and inform the user that this datasource is not a FeatureDB datasource.
Case C: Neither WorkspaceId nor DatasourceId provided
aliyun paifeaturestore list-datasources \
--region <RegionId> \
--instance-id <InstanceId> \
--type FeatureDB \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Note: This API is paginated. Calculate total pages from TotalCount and PageSize, then fetch all pages.
Example pagination logic:
# First call to get TotalCount
FIRST_RESPONSE=$(aliyun paifeaturestore list-datasources \
--region <RegionId> \
--instance-id <InstanceId> \
--type FeatureDB \
--page-number 1 \
--page-size 10 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query)
# Extract TotalCount and calculate total pages
# Then iterate through all pages
for page in {1..total_pages}; do
aliyun paifeaturestore list-datasources \
--region <RegionId> \
--instance-id <InstanceId> \
--type FeatureDB \
--page-number $page \
--page-size 10 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
done
Present all FeatureDB datasources to the user. If only ONE datasource exists, use it directly.
When MULTIPLE datasources exist, behavior depends on query type:
| Query Type | User Confirmation Required |
|---|---|
| Total usage (Function 1) | Ask: "Query aggregated usage for all N datasources, or select a specific one?" Then proceed based on user's choice. |
| Feature view details / Project / Trends (Function 2/3/4) | Must select ONE datasource. These queries are datasource-specific and cannot span multiple datasources. |
Error Handling:
Date Validation (before API call):
yyyy-MM-dd (e.g., 2024-03-15). If user provides other formats (e.g., 3/15, 2024.03.15), convert to correct format.EndDate - StartDate must be ≤ 30 days. If exceeded, ask user to narrow the range or split into multiple queries.EndDate ≤ today; StartDate ≤ EndDate.Relative Date Ranges ("last 7 days", "last 30 days"): Calculate StartDate = N days ago, EndDate = yesterday. Run date command separately first, then use the literal result in --start-date/--end-date. NEVER embed $(...) in CLI commands.
Execute queries based on user requirements:
Query daily totals from StartDate to EndDate (default: last 30 days).
aliyun paifeaturestore list-datasource-feature-views \
--region <RegionId> \
--instance-id <InstanceId> \
--datasource-id <DatasourceId> \
--start-date <StartDate> \
--end-date <EndDate> \
--verbose false \
--show-storage-usage false \
--page-size 1 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Output: Extract TotalUsageStatistics from the response.
Query all feature views' read/write counts on a specific date, with sorting.
aliyun paifeaturestore list-datasource-feature-views \
--region <RegionId> \
--instance-id <InstanceId> \
--datasource-id <DatasourceId> \
--start-date <TargetDate> \
--end-date <TargetDate> \
--verbose true \
--show-storage-usage false \
--all true \
--sort-by <ReadCount|WriteCount> \
--order <ASC|DESC> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Output: Extract FeatureViews array from the response.
Query daily totals for a specific project from StartDate to EndDate (default: last 7 days).
aliyun paifeaturestore list-datasource-feature-views \
--region <RegionId> \
--instance-id <InstanceId> \
--datasource-id <DatasourceId> \
--start-date <StartDate> \
--end-date <EndDate> \
--verbose false \
--show-storage-usage false \
--page-size 1 \
--project-name <ProjectName> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Output: Extract TotalUsageStatistics from the response.
Error Handling:
Query daily trends for a specific feature view from StartDate to EndDate (default: last 7 days).
aliyun paifeaturestore list-datasource-feature-views \
--region <RegionId> \
--instance-id <InstanceId> \
--datasource-id <DatasourceId> \
--start-date <StartDate> \
--end-date <EndDate> \
--verbose true \
--show-storage-usage false \
--all true \
--project-name <ProjectName> \
--name <FeatureViewName> \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-pai-feature-store-featuredb-usage-query
Output: Extract the matching feature view from the FeatureViews array.
Error Handling:
Based on user requirements:
| Region | Write Cost | Read Cost |
|---|---|---|
| Beijing, Shanghai, Hangzhou, Shenzhen | ¥0.151 | ¥0.0755 |
| Hong Kong, Singapore, Silicon Valley, Frankfurt, Jakarta | ¥0.2651 | ¥0.1326 |
Present insights:
Offer next steps:
The skill execution is successful if:
For detailed verification steps, see references/verification-method.md.
This skill performs read-only operations and does not create any resources. No cleanup is required.
| Reference | Description |
|---|---|
| RAM Policies | Required RAM permissions and policy configuration |
| Related APIs | Complete list of APIs and CLI commands used |
| Verification Method | Detailed verification steps for each operation |
| CLI Installation Guide | Aliyun CLI installation and setup instructions |
| Acceptance Criteria | Testing patterns and validation criteria |