← 返回 Skills 市场
sdk-team

Alibabacloud Starops Chat

作者 alibabacloud-skills-team · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ⚠ pending
119
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install alibabacloud-starops-chat
功能描述
Alibaba Cloud STAROps Agent AIOps diagnostic skill. Use this skill to help users diagnose service errors, analyze root causes, query workspace/service topolo...
使用说明 (SKILL.md)

Alibaba Cloud STAROps Agent

Call the Alibaba Cloud STAROps Agent through STAROps OpenAPI and receive a streaming diagnostic answer.

Scenario Description

Use this skill when the user wants to:

  • Diagnose service errors or exceptions (root cause analysis)
  • Query workspace topology, service lists, or service metrics
  • Analyze APM traces, error rates, latency, or request volume
  • Triage alerts or investigate incidents
  • Ask questions about their STAROps workspace or services

Environment Variables

The script reads the following environment variables. They are typically pre-configured by the execution platform — verify they are set before running; do not overwrite them with placeholder values.

Variable Required Description How to obtain
STAROPS_AGENT_EMPLOYEE Yes Digital employee name in STAROps STAROps console → Digital Employee list → name column
STAROPS_AGENT_WORKSPACE Yes Workspace identifier STAROps console → Workspace settings → workspace name
STAROPS_AGENT_UID Yes Alibaba Cloud account UID that owns the workspace Alibaba Cloud console → Account Management → Account ID
STAROPS_AGENT_ENDPOINT No API endpoint (default: starops.\x3Cregion>.aliyuncs.com) Use default unless a private or custom endpoint is required
STAROPS_AGENT_REGION No Region (default: cn-beijing) STAROps is centrally deployed; use cn-beijing for all regions

Environment Setup

If the variables are not pre-configured by the platform, set them manually before running the script:

export STAROPS_AGENT_EMPLOYEE="\x3Cyour-digital-employee-name>"
export STAROPS_AGENT_WORKSPACE="\x3Cyour-workspace-name>"
export STAROPS_AGENT_UID="\x3Cyour-alibaba-cloud-account-uid>"

Credentials — The script uses the Alibaba Cloud Credentials SDK default chain. Configure one of the following (in priority order):

  1. STS token — Recommended for CI/sandbox. The platform injects STS credentials via ~/.aliyun/config.json or environment.
  2. RAM role — For ECS/container workloads with instance metadata.
  3. CLI profile — Run aliyun configure to create a profile in ~/.aliyun/config.json.
  4. Environment variables — Set ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET (least preferred; avoid in production).

Do not define skill-specific AccessKey variables; the credential SDK handles resolution automatically.

Pre-flight check — run this before invoking the script to confirm the variables are set:

missing=""
[ -z "$STAROPS_AGENT_EMPLOYEE" ] && missing="$missing STAROPS_AGENT_EMPLOYEE"
[ -z "$STAROPS_AGENT_WORKSPACE" ] && missing="$missing STAROPS_AGENT_WORKSPACE"
[ -z "$STAROPS_AGENT_UID" ] && missing="$missing STAROPS_AGENT_UID"
if [ -n "$missing" ]; then echo "ERROR: Missing required environment variables:$missing" >&2; exit 1; fi
echo "OK: EMPLOYEE=$STAROPS_AGENT_EMPLOYEE WORKSPACE=$STAROPS_AGENT_WORKSPACE UID=$STAROPS_AGENT_UID"

If any required variable is empty, stop and ask the user to provide the value. Never substitute placeholder strings like example-employee.

The STAROps console link uses the same digital employee ID as assistantId.

Invocation

IMPORTANT: The --pipe flag is MANDATORY for all invocations. It ensures structured output with THREAD ID, STAROPS_URL, and delimited answer blocks that downstream agents can reliably parse. Never omit --pipe.

Install dependencies and run from this skill's root directory:

pip3 install -r scripts/requirements.txt

# First call - creates a new thread automatically
python3 scripts/call_starops_agent.py --question "\x3Ccomplete user context>" --pipe

# Follow-up calls - MUST reuse the thread ID from previous response
python3 scripts/call_starops_agent.py --thread "\x3Cthread_id>" --question "\x3Cfollow-up question>" --pipe

Thread Management:

  • Extract thread ID from output
  • Use the printed STAROPS_URL when the user needs to inspect the same thread in the STAROps console
  • Always pass --thread "\x3Cid>" for related follow-up questions to preserve context

Example workflow:

# Query 1: Creates new thread
$ python3 scripts/call_starops_agent.py --question "Query TOP 5 error applications" --pipe
THREAD: thread-abc123-xyz
STAROPS_URL: https://starops.console.aliyun.com/chat?threadId=thread-abc123-xyz&assistantId=apsara-ops
=== STAROPS ANSWER BEGIN ===
...

# Query 2: MUST reuse thread for context
$ python3 scripts/call_starops_agent.py --thread "thread-abc123-xyz" --question "Deep dive into notification app errors" --pipe

Behavioral Notes

  1. STAROps Agent calls are long-running by design. A single CreateChat stream may start multiple internal diagnostic steps and take minutes; the default timeout is 30 minutes.
  2. Provide complete context in one question: cloud account or workspace context, time range, service or application names, alert text, SLS project/logstore, UModel object, region, and what decision the user needs.
  3. CRITICAL: Always reuse --thread for follow-ups in the same investigation. Starting a new thread discards all prior context and findings.
  4. Use this skill for Agent reasoning and diagnosis, not direct resource management. For direct ECS, OSS, RDS, SLS, or RAM mutations, use the corresponding official CLI, SDK, or specialized skill.
  5. MANDATORY: Always pass --pipe. Tool-call status and streaming diagnosis-report chunks are written to stderr, while stdout keeps the reusable thread ID and final answer easy to parse. Omitting --pipe will produce unstructured output that cannot be reliably evaluated.
  6. If no SSE event arrives for a while, the script fails with a clear idle-timeout error instead of silently waiting for the full task timeout. Increase --idle-timeout only when the investigation is expected to be quiet for long periods.
  7. Output integrity rule: Your final report MUST be based on the actual content returned between === STAROPS ANSWER BEGIN === and === STAROPS ANSWER END ===. Specifically:
    • Quote or paraphrase concrete data points from the STAROps response (HTTP status codes, service names, error paths, metrics).
    • Do NOT infer or fabricate diagnostic conclusions that are not supported by the STAROps output.
    • If the STAROps answer is empty ((No assistant answer was returned.)), incomplete, or only contains generic text, retry once using the same --thread. If the retry still yields no actionable data, report honestly: "STAROps 未返回有效诊断数据,请确认 workspace 中是否存在相关服务和时间范围内的数据。"
    • Never substitute your own prior knowledge for missing STAROps evidence. For example, do not claim "database connection pool exhaustion" if STAROps did not mention it.

Troubleshooting

When the script exits with an error, check the following in order:

  1. HTTP 401 Unauthorized — The credential chain did not resolve to a valid identity with STAROps permissions. Verify that the Alibaba Cloud Credentials default chain can resolve a valid credential (STS token, RAM role, CLI profile, or instance metadata) and that the identity has cms:CreateThread and cms:CreateChat permissions. See references/ram-policies.md.
  2. HTTP 404 Not Found — The digital employee name (STAROPS_AGENT_EMPLOYEE) or workspace (STAROPS_AGENT_WORKSPACE) does not exist, or the UID (STAROPS_AGENT_UID) does not match the owning account. Double-check all three environment variables.
  3. ConfigError: Missing required STAROps environment variables — One or more of STAROPS_AGENT_EMPLOYEE, STAROPS_AGENT_WORKSPACE, STAROPS_AGENT_UID is empty or unset.
  4. CredentialError — The Alibaba Cloud Credentials SDK could not find any valid credential source. Ensure at least one credential provider is configured (environment variables, ~/.aliyun/config.json, STS, RAM role, or instance metadata).
  5. Idle timeout — No SSE event was received within --idle-timeout seconds (default 60). The STAROps Agent may be stalled. Retry with the same --thread if a THREAD line was printed, or increase --idle-timeout for investigations expected to be quiet.
  6. Stream interruption / network error — The HTTPS connection was reset or timed out. Retry the same request with --thread to resume context.
  7. ModuleNotFoundError — Python dependency not installed. Run pip3 install -r scripts/requirements.txt before invoking the script.

API Surface

This skill directly calls STAROps OpenAPI:

  • CreateThread: POST /digitalEmployee/{name}/thread
  • CreateChat: POST /chat

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

如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-starops-chat
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-starops-chat 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1
Initial release of alibabacloud-starops-chat: - Provides diagnostic capability for Alibaba Cloud STAROps: root cause analysis, service error investigation, topology queries, and APM metrics inspection. - Uses STAROps Agent OpenAPI with mandatory streaming output (`--pipe`) and strict thread management for context preservation. - Requires pre-configured environment variables for employee, workspace, and account UID; enforces credential chain best practices. - Ensures output integrity by quoting/paraphrasing only STAROps-generated data and forbids fabrication or unsupported conclusions. - Includes troubleshooting steps for common configuration and authentication errors.
v0.0.1-beta.1
Initial beta release of Alibaba Cloud STAROps Agent diagnostic skill. - Enables users to diagnose service errors, analyze root causes, and troubleshoot incidents using STAROps Agent via OpenAPI. - Supports querying workspace/service topology, APM metrics, traces, and triaging alerts. - Requires specific environment variables for execution (employee, workspace, UID), using Alibaba Cloud Credentials SDK for authentication. - Includes detailed setup, invocation instructions, thread management, and output integrity rules. - Emphasizes mandatory use of `--pipe` flag for structured output and reliable downstream parsing. - Provides troubleshooting guidance for common configuration and permission issues.
元数据
Slug alibabacloud-starops-chat
版本 0.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Alibabacloud Starops Chat 是什么?

Alibaba Cloud STAROps Agent AIOps diagnostic skill. Use this skill to help users diagnose service errors, analyze root causes, query workspace/service topolo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 119 次。

如何安装 Alibabacloud Starops Chat?

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

Alibabacloud Starops Chat 是免费的吗?

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

Alibabacloud Starops Chat 支持哪些平台?

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

谁开发了 Alibabacloud Starops Chat?

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

💬 留言讨论