← 返回 Skills 市场
sdk-team

Alibabacloud Sls Data Agent

作者 alibabacloud-skills-team · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ✓ 安全检测通过
44
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alibabacloud-sls-data-agent
功能描述
Invoke SLS DataAgent to autonomously perform data acquisition, processing, analysis, and visualization for Alibaba Cloud SLS (Simple Log Service). Acts as a...
使用说明 (SKILL.md)

SLS DataAgent

SLS DataAgent is an AI assistant that autonomously understands natural language and automatically completes data acquisition, processing, analysis, and visualization. It acts as your "fully automated data analyst": you ask a question in natural language, and it fetches, cleans, analyzes the data, and returns conclusions and visualizations.

It is invoked through the SLS DataAgent OpenAPI; the session streams the analysis process and conclusions back over SSE.

Capabilities

  • Natural language understanding: turn colloquial data questions into well-defined analysis tasks.
  • Data acquisition: automatically locate and pull relevant data (logs, metrics, etc.) within the SLS project.
  • Data processing: cleaning, aggregation, transformation.
  • Data analysis: statistics, trends, comparisons, anomalies / insights.
  • Visualization: generate charts and structured conclusion reports.

Digital Employee (agentId)

A session is handled by a "digital employee" (digital employee / agentId).

  • Generic and customizable: --digital-employee \x3Cname> > SLS_DATA_AGENT_EMPLOYEE env var > script default apsara-ops.
  • The console assistantId is the digital employee in use.

Built-in Skill (capability routing)

Use --skill to select a DataAgent built-in skill; omit it to use the general capability.

Skill ID Description
builtin.sls.sls-sql-generation SQL generation
builtin.sls.spl-generation SPL generation
builtin.sls.sls-loongcollector LoongCollector ingestion ops
builtin.sls.sls-visualization Dashboard assistant

Logstore context

Use --logstore to specify the target logstore, giving the analysis an explicit data source scope.

Environment Variables

Variable Required Description
SLS_DATA_AGENT_PROJECT Yes SLS project name (the scope; can also be passed via --project).
SLS_DATA_AGENT_REGION Yes Region where the SLS project resides (e.g. cn-shanghai, cn-beijing).
SLS_DATA_AGENT_EMPLOYEE No Digital employee name (default apsara-ops).
SLS_DATA_AGENT_LOGSTORE No Default target logstore (can also be passed via --logstore).
SLS_DATA_AGENT_SKILL No Built-in skill ID (e.g. builtin.sls.sls-sql-generation). Omit to use the general capability.

Credentials — uses the Alibaba Cloud Credentials SDK default chain (STS / RAM role / CLI profile ~/.aliyun/config.json / env vars ALIBABA_CLOUD_ACCESS_KEY_ID+ALIBABA_CLOUD_ACCESS_KEY_SECRET).

Pre-flight check:

missing=""
[ -z "$SLS_DATA_AGENT_PROJECT" ] && missing="$missing SLS_DATA_AGENT_PROJECT"
[ -z "$SLS_DATA_AGENT_REGION" ]  && missing="$missing SLS_DATA_AGENT_REGION"
if [ -n "$missing" ]; then echo "ERROR: Missing required environment variables:$missing" >&2; exit 1; fi
echo "OK: PROJECT=$SLS_DATA_AGENT_PROJECT REGION=$SLS_DATA_AGENT_REGION"

If a required value is empty, stop and ask the user; do not substitute a placeholder such as example-project.

Invocation

--pipe is mandatory: it guarantees stdout emits the THREAD line and the === DATA AGENT ANSWER BEGIN/END === delimiters, so downstream can parse reliably.

pip3 install -r scripts/requirements.txt

# First question (auto-creates a session; most queries need --logstore)
python3 scripts/call_sls_data_agent.py \
  --logstore my_logstore \
  --question "\x3Cfull data-analysis request>" --pipe

# Follow-up (reuse the THREAD ID from the previous step to keep context)
python3 scripts/call_sls_data_agent.py \
  --thread "\x3Cthread_id>" --question "\x3Cfollow-up>" --pipe

# Specify a built-in skill
python3 scripts/call_sls_data_agent.py \
  --skill builtin.sls.sls-sql-generation \
  --logstore my_logstore \
  --question "number of error logs in the last 5 minutes" --pipe

Example output (pipe):

THREAD: thread-abc123-xyz
DATA_AGENT_URL: https://starops.console.aliyun.com/chat?threadId=thread-abc123-xyz&assistantId=apsara-ops
=== DATA AGENT ANSWER BEGIN ===
(analysis conclusion / visualization description)
=== DATA AGENT ANSWER END ===

Behavioral Notes

  1. A DataAgent call is a long task: a single session may trigger multi-step internal analysis and take several minutes; the default timeout is 30 minutes.
  2. Provide the full context in one go: SLS project, time range, target logstore/fields, the metrics to analyze, and the expected chart/conclusion form.
  3. Always reuse --thread for follow-ups, otherwise context and intermediate results are lost.
  4. Always pass --pipe: tool status and intermediate progress go to stderr; stdout keeps only the reusable thread id and the final answer.
  5. Conclusions must be based on the real return between the BEGIN / END delimiters: cite concrete data points, do not fabricate. If the answer is empty, retry once with the same --thread; if still empty, state plainly that DataAgent returned no valid data.

Troubleshooting

  1. HTTP 401/403 — credentials did not resolve to an authorized identity. Confirm the default chain resolves valid credentials and that the identity is allowed to call the SLS DataAgent OpenAPI. See references/ram-policies.md.
  2. HTTP 404 — the digital employee (--digital-employee, default apsara-ops) or the SLS project (SLS_DATA_AGENT_PROJECT) does not exist. Verify both.
  3. ConfigError: Missing required SLS DataAgent configuration — one of SLS_DATA_AGENT_PROJECT / SLS_DATA_AGENT_REGION is empty.
  4. CredentialError — the default chain found no valid credential source.
  5. Idle timeout — no SSE event within --idle-timeout seconds. Increase the value if needed, or retry with the same --thread.
  6. ModuleNotFoundError — run pip3 install -r scripts/requirements.txt first.

API Surface

The script calls the SLS DataAgent OpenAPI directly (ACS3-HMAC-SHA256 signing); the endpoint defaults to starops.cn-beijing.aliyuncs.com and can be overridden via SLS_DATA_AGENT_ENDPOINT:

  • Create a session (thread)
  • Start a conversation and stream the analysis process and conclusions (SSE)

See references/api-reference.md and references/ram-policies.md for details.

Observability

Every HTTP request carries a user-agent header for tracing:

AlibabaCloud-Agent-Skills/alibabacloud-sls-data-agent/{session-id}
  • alibabacloud-sls-data-agent — fixed skill identifier (matches the name field).
  • {session-id} — a 32-character hex string, read from the SKILL_SESSION_ID environment variable. If the env var is not set, the script falls back to generating uuid.uuid4().hex. The same session-id is shared across all requests in a single invocation (CreateThread + CreateChat), enabling correlation of API calls in server-side logs.
安全使用建议
Install this only if you intend to use Alibaba Cloud SLS DataAgent. Use least-privilege Alibaba Cloud credentials limited to the needed DataAgent actions and SLS scope, confirm the project/logstore before each analysis, and do not include secrets, regulated data, or unrelated local/private content in questions sent through the skill.
能力评估
Purpose & Capability
The documented purpose is remote SLS data analysis and visualization, and the code implements that by creating DataAgent threads and streaming chat results from Alibaba Cloud.
Instruction Scope
Most instructions are SLS-specific and require project and region scoping, but the activation terms include generic phrases like data analysis and charts, so users should invoke it only for Alibaba Cloud SLS work.
Install Mechanism
Installation uses a small Python script with pinned dependencies for Alibaba Cloud credentials and requests; no installer persistence, hidden downloaders, or extra package mutation were found.
Credentials
Network access, project/logstore context, natural-language prompts, and Alibaba Cloud default-chain credentials are proportionate for this integration and are documented, though they may expose sensitive operational context to Alibaba Cloud.
Persistence & Privilege
The skill creates remote DataAgent threads and reuses thread IDs for follow-ups, but it does not create local background workers, local persistence, or directly mutate cloud resources.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-sls-data-agent
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-sls-data-agent 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1
alibabacloud-sls-data-agent 0.0.1 initial release - Introduces an autonomous assistant for Alibaba Cloud SLS that processes, analyzes, and visualizes data from natural language questions. - Supports automatic data acquisition, cleaning, analysis, and chart generation via SLS DataAgent OpenAPI. - Includes environment variable controls for SLS project, region, logstore, and digital employee. - Allows selection of built-in skills for SQL/SPL/Dashboard/LoongCollector operations. - Provides session management, context handling, and reliable output parsing using mandatory `--pipe` mode. - Outlines troubleshooting steps, API references, and observability via traceable user-agent headers.
元数据
Slug alibabacloud-sls-data-agent
版本 0.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Alibabacloud Sls Data Agent 是什么?

Invoke SLS DataAgent to autonomously perform data acquisition, processing, analysis, and visualization for Alibaba Cloud SLS (Simple Log Service). Acts as a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 44 次。

如何安装 Alibabacloud Sls Data Agent?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install alibabacloud-sls-data-agent」即可一键安装,无需额外配置。

Alibabacloud Sls Data Agent 是免费的吗?

是的,Alibabacloud Sls Data Agent 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Alibabacloud Sls Data Agent 支持哪些平台?

Alibabacloud Sls Data Agent 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Alibabacloud Sls Data Agent?

由 alibabacloud-skills-team(@sdk-team)开发并维护,当前版本 v0.0.1。

💬 留言讨论