Operate Alibaba Cloud AgentLoop Dataset resources with aliyun CLI and the AgentLoop API version 2026-05-20. Use when requests concern AgentLoop datasets, dat...
---
name: alibabacloud-agentloop-dataset
description: Operate Alibaba Cloud AgentLoop Dataset resources with aliyun CLI and the AgentLoop API version 2026-05-20. Use when requests concern AgentLoop datasets, data rows, Dataset schemas, embedding fields, semantic search, ExecuteQuery, AgentSpace data, 数据集, 数据写入, 数据查询, 语义检索, or ask to create/list/get/update AgentLoop datasets, append structured rows, run read-only SQL or SearchExpr queries, inspect query results, or debug aliyun agentloop Dataset commands.
---
# AgentLoop Dataset Skill
## Scenario
Operate the public AgentLoop Dataset surface through `aliyun agentloop`:
- Manage Dataset resources and schemas.
- Append typed structured rows without constructing INSERT SQL.
- Query data with read-only `execute-query`.
- Run full-text, semantic, SQL, or search-pipe-SQL retrieval.
Do not expose or operate service deployment, database, cache, or other internal implementation details. Do not manage AgentSpaces unless the user separately requests that scope.
Treat commands and parameters exposed by the installed public AgentLoop CLI plugin as the external capability boundary. Do not expose a capability found only in backend development code until it appears in the published CLI help or public API contract.
## CLI Prerequisites
**Require Aliyun CLI 3.3.3 or later.**
```bash
aliyun version
```
**Require the AgentLoop plugin 0.7.1 or later.** This version exposes all Dataset commands used by this skill, including `add-dataset-data` and the extended `execute-query` parameters.
```bash
aliyun plugin show --name agentloop
```
If the AgentLoop plugin is missing or older than 0.7.1, install it through the configured Aliyun CLI plugin source, then verify it before continuing:
```bash
aliyun plugin install --names agentloop
aliyun plugin show --name agentloop
```
Use the plugin ID `agentloop` for installation; successful output identifies the installed package as `aliyun-cli-agentloop`. If the Aliyun CLI itself is missing or below 3.3.3, stop and ask the user to upgrade the CLI through their organization-approved process outside this session. Do not download or install CLI binaries from this Skill.
## Authentication
Use an existing Aliyun CLI profile, Alibaba Cloud environment credentials, STS, OAuth, or an instance RAM role.
Security rules:
- Never read, echo, print, or paste AccessKey IDs, AccessKey secrets, security tokens, or other credentials.
- Never ask the user to pass literal credentials in a command or conversation.
- Never run `aliyun configure set` with literal credential values.
- Use only `aliyun configure list` to check whether a usable identity and region are configured.
```bash
aliyun configure list
```
If no valid identity is available, stop and ask the user to configure credentials outside this session. Do not continue to a Dataset request.
## RAM Permissions
Dataset operations use the six concrete RAM actions listed in `references/ram-policies.md` and support Dataset resource ARNs. Do not use a wildcard action pattern in a policy.
On any permission failure:
1. Capture the API action, denied RAM action, and request ID without exposing credentials.
2. Read `references/ram-policies.md`.
3. If `ram-permission-diagnose` is installed, invoke it. Otherwise show the missing action and the least-privilege policy template.
4. Pause until the user confirms that permission was granted before retrying.
## Parameter Confirmation
Confirm user-customizable values before executing a cloud request. Reuse explicit values already supplied by the user; do not ask again.
| Parameter | Required for | Rule |
| --- | --- | --- |
| `--region` | All operations when the configured region is not explicitly accepted | Dataset and AgentSpace must be in this region. |
| `--agent-space` | All commands | Confirm the exact AgentSpace name. |
| `--dataset-name` | All Dataset commands in this skill | Use 4-63 ASCII characters matching `^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$`; do not use uppercase letters, hyphens, spaces, or leading, trailing, or consecutive underscores. |
| `--description` | Optional create/update description | Keep the UTF-8 encoded value at 255 bytes or fewer. |
| `--schema` | Create; optional update | Confirm field names, types, Chinese tokenization, JSON keys, and embedding use. The only supported public embedding model value is `agentloop-embedding-v4`. |
| `--data-array` | Structured writes | Confirm the rows or the source from which they are constructed. |
| `--query` | `execute-query` | This Skill permits only read-only SELECT or SearchExpr query text. The public API accepts one raw query string and exposes no bind-parameter option; the default query-text cap is 10 MiB. |
| `--from`, `--to` | Optional SELECT time window | Use non-negative Unix seconds over `__time__`; `to` is exclusive and, when both are non-zero, `from` must be less than `to`. |
| `--offset`, `--length` | Optional SELECT result window | Use non-negative integers only for SELECT; `length` cannot exceed the configured SELECT maximum, which defaults to 100,000. |
| `--max-output-length` | Optional SELECT truncation | `0` or omitted returns full values. |
| `--biz-version` | Optional SELECT against an existing snapshot | This CLI flag serializes to the request-body field `version`; confirm the exact version and omit it for current data. |
| `--client-token` | Optional create/update/write idempotency | Generate one non-secret UUID and reuse it for retries of the same logical request. |
## Observability
Generate one session ID before the first AgentLoop API request in a skill session. Generate it once, require exactly 32 lowercase hexadecimal characters, and reuse it for the entire session:
```bash
SESSION_ID="$(openssl rand -hex 16)"
USER_AGENT="AlibabaCloud-Agent-Skills/alibabacloud-agentloop-dataset/${SESSION_ID}"
```
The canonical CLI template is:
```bash
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-agentloop-dataset/{session-id}"
```
Observability rules:
- Append `--user-agent "${USER_AGENT}"` to every `aliyun agentloop` invocation, including dry runs, retries, mutations, and verification calls. Command examples omit this repeated global flag for readability; add it before execution.
- Never generate a new session ID for an individual command or retry.
- If one workflow also uses an Alibaba Cloud SDK or Terraform, propagate the same session ID through that client's custom user-agent mechanism. Keep one session ID across CLI, SDK, and Terraform calls in the same session.
- Treat the session ID as non-secret correlation metadata. Do not substitute a request ID, account ID, AccessKey ID, or client token.
- Do not mutate global Aliyun CLI configuration to set the user agent; pass the session-scoped user agent explicitly on each request.
## Core Workflow
Execute the workflow:
1. Classify the intent: Dataset management, schema change, structured write, read-only SQL/search, or verification.
2. Confirm the target region, AgentSpace, Dataset, and operation-specific inputs.
3. Run CLI, plugin, and credential checks. Stop if any prerequisite fails.
4. Read the relevant reference:
- Dataset CRUD and schemas: `references/dataset-management.md`
- Structured writes and data mutations: `references/data-operations.md`
- Search and SELECT syntax: `references/query-syntax.md`
5. For complex JSON, run the same command with `--cli-dry-run` first and inspect the serialized URL, query parameters, and body.
6. Execute the approved command.
7. Verify the result using `references/verification-method.md`.
8. Report the request ID and verification evidence without exposing credentials or secret values.
## Dataset and Schema Rules
- Treat Dataset names as unique within the target AgentSpace. A duplicate create is rejected.
- Respect the AgentSpace Dataset quota. The service fallback is 100 Datasets per AgentSpace, but the AgentSpace may supply a different quota.
- Keep create/update request bodies at 1 MiB or less.
- Require a non-empty schema.
- Use only `text`, `long`, `double`, and `json` field types.
- Use `chn` for text tokenization. It has no useful effect on non-text fields.
- Use `embedding` only on `text` or `json` fields. When present, its value must be exactly `agentloop-embedding-v4`; do not use an internal backend model name or invent another alias.
- Use `jsonKeys` only under a top-level `json` field. Each indexed child uses `type` and optional `chn`; do not add child `embedding` or another `jsonKeys` level unless current CLI help explicitly exposes those fields.
- Keep each top-level field name non-empty and at 50 UTF-8 bytes or fewer. The backend does not impose the Dataset-name pattern on fields, but prefer `lower_snake_case` to simplify SQL and case-insensitive structured writes.
- Never define reserved fields: `id`, `__time__`, `__dataset_seq`, `__effective_seq`, or `__expired_seq`.
- Keep the effective column budget within 300: three service columns plus one per top-level field plus one per generated embedding column.
- Treat schema updates as add-only. Omitted existing fields remain; changing or removing an existing definition is rejected. Fetch the current schema before constructing an update.
## Structured Write Rules
Prefer `add-dataset-data` for row appends. It avoids SQL quoting errors and validates values against the Dataset schema.
- `dataArray` must be non-empty and every entry must be an object.
- Field matching is case-insensitive, but do not send duplicate case variants.
- Unknown fields fail the request; omitted schema fields become `null`.
- `text` values must be strings, `long` values integers, `double` values finite numbers, and `json` values valid JSON.
- Omit `id` to generate one. If supplied, it must be a UUID string.
- Omit `__time__` to use the current time. If supplied, it must be a non-null, non-negative Unix timestamp in seconds.
- Never send `__dataset_seq`.
- One request is atomic: either all rows commit or none do. The request-body limit is 100 MiB; there is no separate fixed row-count limit for `add-dataset-data`.
## Query Safety
- Always pass `--type SQL`; it is the only supported statement type.
- This Skill uses `execute-query` only for read-only SELECT or SearchExpr queries. Never send INSERT, UPDATE, DELETE, DDL, or multiple statements through this command.
- The public `execute-query` contract carries raw query text and has no bind-parameter field. Do not compose SQL from untrusted text; use `add-dataset-data` for user-provided values whenever it can express the write.
- The `agentloop:ExecuteQuery` RAM action is not statement-level read-only. This Skill's SELECT-only boundary is an instruction, not a service-side control.
- Keep the `execute-query` body within the default 100 MiB cap and the query text within the default 10 MiB cap.
- Use single-dataset statements. Do not assume cross-Dataset queries or joins are supported.
- Prefer explicit columns and explicit result limits. A SELECT without a limit defaults to 1,000 rows; the configured maximum defaults to 100,000 for SQL `LIMIT` and `--length`.
- Use `columns` with each `rows` entry by position; the response is row-based, not an array of objects.
- Use `semantic_distance(field, 'query', 'l2')` with an explicit distance type. The field must have embedding enabled.
- Keep SearchExpr `similarity()` thresholds in `[0, 1]` and `topk()` values as integers from 1 through 100,000.
- Do not insert user-provided values into SQL. Use `add-dataset-data` for writes.
## Command Index
All public Dataset CLI commands, parameters, and help checks are in `references/related-commands.md`.
## Common Mistakes
| Wrong | Right | Reason |
| --- | --- | --- |
| `aliyun cms ... dataset ...` | `aliyun agentloop ...` | This skill uses the AgentLoop 2026-05-20 public API. |
| `--type sql` without checking | `--type SQL` | The service currently requires `SQL`. |
| Create with an empty schema | Supply at least one typed field | Empty schemas are rejected. |
| Update an existing field type | Add a new top-level field or update description | Schema evolution is add-only. |
| Put JSON in a `text` field | Declare/use a `json` field | Structured writes validate field types. |
| Expect `response.data` | Zip `columns` with each entry in `rows` | Query responses are row-based. |
| Use `execute-query` for a data mutation | Use `add-dataset-data` for row appends | This Skill permits `execute-query` only for read-only queries. |
| `semantic_distance(field, 'q')` | `semantic_distance(field, 'q', 'l2')` | Current Dataset execution requires an explicit distance type. |
| `--version v1` | `--biz-version v1` | Global `--version` selects the OpenAPI version; the Dataset snapshot selector is `--biz-version`. |
| Reuse a new client token on retry | Reuse the original token for the same logical request | Idempotency depends on a stable token. |
## References
| File | Use |
| --- | --- |
| `references/dataset-management.md` | Create, list, get, update, and schema construction. |
| `references/data-operations.md` | Structured row append and typed values. |
| `references/query-syntax.md` | Read-only SQL, SearchExpr, semantic retrieval, windows, and response shape. |
| `references/related-commands.md` | Supported command and parameter inventory. |
| `references/verification-method.md` | Dry-run and post-operation verification. |
| `references/ram-policies.md` | RAM actions, resource ARN, and policy examples. |
don't have the plugin yet? install it then click "run inline in claude" again.
added structured intent, inputs, procedure with step-by-step inputs and outputs, explicit decision points for all common branches and edge cases (schema validation, query safety, permission errors, rate limits, auth expiry), detailed output contract with response shapes and file locations, and outcome signals with verification methods.
manage alibaba cloud agentloop datasets, schemas, and structured data through the public aliyun CLI. use this skill when the user requests dataset crud operations, schema management, row appends via structured writes, read-only sql or searchexpr queries, semantic retrieval, or troubleshooting of agentloop dataset commands. do not expose internal implementation details, service deployments, or database infrastructure. operate only through the public agentloop CLI plugin boundary; do not use backend development code or undocumented apis.
aliyun CLI and AgentLoop plugin
aliyun version)aliyun plugin show --name agentloop)authentication
aliyun configure list; if no valid identity is available, stop and ask the user to configure credentials outside this sessionoperation context
^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$, 4-63 chars, lowercase, no hyphens or uppercase)operation-specific parameters
external connections
classify the intent
confirm target parameters
run prerequisite checks
aliyun version and capture output to verify cli 3.3.3 or lateraliyun plugin show --name agentloop and capture output to verify plugin 0.7.1 or lateraliyun configure list and capture output to verify valid identity and regiongenerate session id and user-agent
openssl rand -hex 16 once per skill session to generate 32 lowercase hex charactersAlibabaCloud-Agent-Skills/alibabacloud-agentloop-dataset/{session-id}read relevant reference documentation
references/dataset-management.mdreferences/data-operations.mdreferences/query-syntax.mdreferences/ram-policies.mdreferences/verification-method.mddry-run for complex operations
--cli-dry-run flag appendedexecute the approved command
--user-agent "${USER_AGENT}" appendedverify the result
references/ram-policies.mdreport results
if aliyun cli or agentloop plugin is missing or outdated
if no valid aliyun cli identity is configured
if the user supplies a dataset name that violates the pattern (not lowercase, contains hyphens, uppercase, spaces, or invalid leading/trailing/consecutive underscores, or is fewer than 4 or more than 63 chars)
^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$if the user requests a schema update that changes or removes an existing field
aliyun agentloop get-dataset and show the user which fields already existif the user requests a schema with an unsupported field type (not text, long, double, or json)
if the user supplies an embedding value that is not exactly agentloop-embedding-v4
if the user supplies embedding on a non-text or non-json field
if the user requests a schema with reserved field names (id, time, __dataset_seq, __effective_seq, __expired_seq)
if the user requests a structured write with an empty dataArray
if the user requests a structured write with non-object entries in dataArray
[{"field1": "value1", "field2": 123}, ...]if the user requests a structured write with duplicate field names (case-insensitive)
if the user requests a structured write with unknown field names (fields not in the dataset schema)
if the user requests an execute-query with a mutation statement (insert, update, delete, ddl, multiple statements)
if the user requests an execute-query that composes sql from untrusted text (e.g., user input directly in where clause)
if the user requests an execute-query without an explicit limit on select
if the user requests a semantic_distance query without an explicit distance type
if the user requests a searchexpr similarity threshold outside [0, 1]
if the user requests a searchexpr topk value outside [1, 100000]
if the api returns a permission error (denied ram action)
references/ram-policies.md to identify the missing permissionif the api returns a network timeout or transient failure
if the api returns a rate-limit error
if the api returns a credential or authentication error
success case (dataset crud, schema management, or structured write)
success case (read-only query)
failure case
file locations
references/ subdirectory relative to this skill (paths: dataset-management.md, data-operations.md, query-syntax.md, related-commands.md, verification-method.md, ram-policies.md)data format
the user knows the skill worked when
for dataset management (create, list, get, update): the response contains the expected dataset name, region, agentspace, schema, or metadata, and the user can verify via aliyun agentloop get-dataset --agent-space <space> --dataset-name <name> or aliyun agentloop list-datasets --agent-space <space>
for schema updates: the schema now contains the new fields without removing existing fields, and the user can verify via aliyun agentloop get-dataset showing the combined schema
for structured writes (add-dataset-data): the response contains requestId and a row count matching the rows submitted, and the user can verify by running a read query aliyun agentloop execute-query --agent-space <space> --dataset-name <name> --query "select count(*) as cnt from <name>" to confirm row count increased
for read-only queries (execute-query): the response contains columns and rows (possibly empty if no matches), the row count matches the query intent (e.g., limit clause), and the data values match the schema field types (text, long, double, or valid json)
for semantic or full-text search: the response contains ranked results in the expected order with distance or similarity scores, and the user can inspect the top result to confirm relevance
for verification failures or permission errors: the skill reports the specific api action, denied ram action, request id, and remediation steps, and the user can take action (grant permission, upgrade credentials, etc.) and retry without re-running the entire workflow
credits: original skill by clawhub; enriched to implexa standards with explicit decision points, edge cases, session tracking, and safety guardrails.