Skill: cinience/aliyun-fc-agentrun (version 1.0.0)

--- name: aliyun-fc-agentrun description: Use when managing Function Compute AgentRun resources via OpenAPI (runtime, sandbox, model, memory, credentials), including creating runtimes/endpoints, querying status, and troubleshooting AgentRun workflows. version: 1.0.0 --- Category: service # Function Compute AgentRun (OpenAPI) Use AgentRun OpenAPI (ROA) to manage runtimes, sandboxes, model services, memory, and credentials. ## Prerequisites - AccessKey via RAM user (least privilege). - Select the correct regional endpoint (see `references/endpoints.md`). If unsure, choose the most reasonable region for the task or ask the user. - Use OpenAPI Explorer or official SDK to avoid manual signing (ROA requires SignatureV1). ## Workflow 1) Choose region endpoint (`agentrun.cn-<region>.aliyuncs.com`). 2) Create runtime → publish version → create runtime endpoint. 3) Create sandbox/template if needed. 4) Configure credentials and model services as required. 5) Query resources for troubleshooting. ## API Groups See `references/api_overview.md` for the full API list and grouping. ## Script quickstart ```bash python skills/compute/fc/aliyun-fc-agentrun/scripts/quickstart.py ``` Environment variables: - `AGENTRUN_ENDPOINT` - `ALICLOUD_ACCESS_KEY_ID` - `ALICLOUD_ACCESS_KEY_SECRET` - `OUTPUT_DIR` (optional) ## Runtime flow script ```bash AGENTRUN_RUNTIME_NAME="my-runtime" \\ AGENTRUN_RUNTIME_ENDPOINT_NAME="my-runtime-endpoint" \\ python skills/compute/fc/aliyun-fc-agentrun/scripts/runtime_flow.py ``` Environment variables: - `AGENTRUN_ENDPOINT` - `ALICLOUD_ACCESS_KEY_ID` - `ALICLOUD_ACCESS_KEY_SECRET` - `AGENTRUN_RUNTIME_NAME` - `AGENTRUN_RUNTIME_ENDPOINT_NAME` - `AGENTRUN_RUNTIME_DESC` (optional) - `OUTPUT_DIR` (optional) ## Cleanup script ```bash AGENTRUN_RUNTIME_ID="runtime-id" \\ AGENTRUN_RUNTIME_ENDPOINT_ID="endpoint-id" \\ python skills/compute/fc/aliyun-fc-agentrun/scripts/cleanup_runtime.py ``` Environment variables: - `AGENTRUN_ENDPOINT` - `ALICLOUD_ACCESS_KEY_ID` - `ALICLOUD_ACCESS_KEY_SECRET` - `AGENTRUN_RUNTIME_ID` - `AGENTRUN_RUNTIME_ENDPOINT_ID` - `OUTPUT_DIR` (optional) ## SDK Notes See `references/sdk.md` for SDK acquisition guidance. ## Output Policy If you store any generated files or responses, write them under: `output/compute-fc-agentrun/`. ## Validation ```bash mkdir -p output/aliyun-fc-agentrun for f in skills/compute/fc/aliyun-fc-agentrun/scripts/*.py; do python3 -m py_compile "$f" done echo "py_compile_ok" > output/aliyun-fc-agentrun/validate.txt ``` Pass criteria: command exits 0 and `output/aliyun-fc-agentrun/validate.txt` is generated. ## Output And Evidence - Save artifacts, command outputs, and API response summaries under `output/aliyun-fc-agentrun/`. - Include key parameters (region/resource id/time range) in evidence files for reproducibility. ## References - API overview and operation list: `references/api_overview.md` - Regional endpoints: `references/endpoints.md` - SDK guidance: `references/sdk.md` - Source list: `references/sources.md`

path: agents/openai.yaml
content: interface:
  display_name: "Alibaba Cloud Compute FC Agentrun"
  short_description: "FC AgentRun runtime and endpoint ops"
  default_prompt: "Use $alicloud-compute-fc-agentrun to complete this compute/fc task on Alibaba Cloud."


path: references/api_overview.md
content: # AgentRun OpenAPI 概览

以下操作来自 AgentRun OpenAPI 概览页，按功能分组。

## Agent 运行时

- CreateAgentRuntime
- GetAgentRuntime
- UpdateAgentRuntime
- DeleteAgentRuntime
- ListAgentRuntimes
- CreateAgentRuntimeEndpoint
- ListAgentRuntimeEndpoints
- GetAgentRuntimeEndpoint
- UpdateAgentRuntimeEndpoint
- DeleteAgentRuntimeEndpoint
- PublishRuntimeVersion
- ListAgentRuntimeVersions

## Sandbox 沙箱

沙箱模板管理：
- CreateTemplate
- GetTemplate
- ListTemplates
- UpdateTemplate
- DeleteTemplate
- StopTemplateMCP
- ActivateTemplateMCP

沙箱实例管理：
- CreateSandbox
- GetSandbox
- ListSandboxes
- StopSandbox
- DeleteSandbox

## 模型管理

- CreateModelService
- UpdateModelService
- GetModelService
- DeleteModelService
- ListModelServices
- CreateModelProxy
- UpdateModelProxy
- GetModelProxy
- DeleteModelProxy
- ListModelProxies

## 记忆存储

- GetMemoryCollection
- UpdateMemoryCollection
- DeleteMemoryCollection
- CreateMemoryCollection
- ListMemoryCollections

## 其他

- GetCredential
- UpdateCredential
- ListCredentials
- CreateCredential
- DeleteCredential
- GetAccessToken
- CreateKnowledgeBase
- UpdateKnowledgeBase
- DeleteKnowledgeBase
- GetKnowledgeBase
- ListKnowledgeBases
- ListModelProviders
- DeleteCustomDomain
- ListCustomDomains
- CreateCustomDomain
- GetCustomDomain
- UpdateCustomDomain

## 待下线

浏览器沙箱：
- CreateBrowser
- ListBrowsers
- GetBrowser
- DeleteBrowser

代码解释器：
- CreateCodeInterpreter
- ListCodeInterpreters
- GetCodeInterpreter
- DeleteCodeInterpreter


path: references/endpoints.md
content: # AgentRun OpenAPI 服务地址

来自官方文档的 AgentRun OpenAPI 服务地址（公网与 VPC）：

| Endpoint | Region Id |
| --- | --- |
| agentrun.cn-beijing.aliyuncs.com | cn-beijing |
| agentrun.cn-shanghai.aliyuncs.com | cn-shanghai |
| agentrun.cn-hangzhou.aliyuncs.com | cn-hangzhou |
| agentrun.cn-shenzhen.aliyuncs.com | cn-shenzhen |
| agentrun.ap-southeast-1.aliyuncs.com | ap-southeast-1 |
| agentrun-vpc.cn-beijing.aliyuncs.com | cn-beijing (VPC) |
| agentrun-vpc.cn-shanghai.aliyuncs.com | cn-shanghai (VPC) |
| agentrun-vpc.cn-hangzhou.aliyuncs.com | cn-hangzhou (VPC) |
| agentrun-vpc.cn-shenzhen.aliyuncs.com | cn-shenzhen (VPC) |
| agentrun-vpc.ap-southeast-1.aliyuncs.com | ap-southeast-1 (VPC) |


path: references/sdk.md
content: # AgentRun SDK 说明

- 建议使用 OpenAPI Explorer 生成 SDK 或示例代码。
- 通过 Explorer 选择接口后可下载多语言 SDK 调用示例。


path: references/sources.md
content: 官方文档来源（用于后续更新）
============================

- （暂无外部文档链接）


path: scripts/cleanup_runtime.py
content: import os
import sys
import json
from pathlib import Path


def get_env(name: str, default: str | None = None) -> str:
    value = os.getenv(name, default)
    if not value:
        print(f"Missing env var: {name}", file=sys.stderr)
        sys.exit(1)
    return value


def main() -> None:
    """Delete runtime endpoint then delete runtime."""
    try:
        from alibabacloud_agentrun20250910.client import Client as AgentRunClient
        from alibabacloud_agentrun20250910 import models as agentrun_models
        from alibabacloud_tea_openapi import models as open_api_models
    except Exception:
        print(
            "Missing AgentRun SDK. Generate or install SDK from OpenAPI Explorer.",
            file=sys.stderr,
        )
        sys.exit(1)

    endpoint = get_env("AGENTRUN_ENDPOINT")
    [REDACTED_SECRET]"ALICLOUD_ACCESS_KEY_ID")
    [REDACTED_SECRET]"ALICLOUD_ACCESS_KEY_SECRET")
    security_token = os.getenv("ALICLOUD_SECURITY_TOKEN") or os.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")

    config = open_api_models.Config(
        [REDACTED_SECRET],
        [REDACTED_SECRET],
        endpoint=endpoint,
    )
    if security_token:
        config.security_token = security_token
    client = AgentRunClient(config)

    runtime_id = get_env("AGENTRUN_RUNTIME_ID")
    runtime_endpoint_id = get_env("AGENTRUN_RUNTIME_ENDPOINT_ID")

    delete_endpoint_req = agentrun_models.DeleteAgentRuntimeEndpointRequest(
        runtime_id=runtime_id,
        endpoint_id=runtime_endpoint_id,
    )
    delete_endpoint_resp = client.delete_agent_runtime_endpoint(delete_endpoint_req)

    delete_runtime_req = agentrun_models.DeleteAgentRuntimeRequest(runtime_id=runtime_id)
    delete_runtime_resp = client.delete_agent_runtime(delete_runtime_req)

    output_dir = Path(os.getenv("OUTPUT_DIR", "output")) / "compute-fc-agentrun" / "responses"
    output_dir.mkdir(parents=True, exist_ok=True)
    out_file = output_dir / "cleanup_runtime.json"

    payload = {
        "delete_endpoint": delete_endpoint_resp.to_map(),
        "delete_runtime": delete_runtime_resp.to_map(),
    }

    with out_file.open("w", encoding="utf-8") as f:
        json.dump(payload, f, ensure_ascii=False, indent=2)

    print(f"Saved: {out_file}")


if __name__ == "__main__":
    main()


path: scripts/quickstart.py
content: import os
import sys
from pathlib import Path
import json


def get_env(name: str, default: str | None = None) -> str:
    value = os.getenv(name, default)
    if not value:
        print(f"Missing env var: {name}", file=sys.stderr)
        sys.exit(1)
    return value


def main() -> None:
    """Quickstart for AgentRun OpenAPI (ListAgentRuntimes)."""
    try:
        from alibabacloud_agentrun20250910.client import Client as AgentRunClient
        from alibabacloud_agentrun20250910 import models as agentrun_models
        from alibabacloud_tea_openapi import models as open_api_models
    except Exception:
        print(
            "Missing AgentRun SDK. Generate or install SDK from OpenAPI Explorer "
            "or install the package if available.",
            file=sys.stderr,
        )
        sys.exit(1)

    endpoint = get_env("AGENTRUN_ENDPOINT")
    [REDACTED_SECRET]"ALICLOUD_ACCESS_KEY_ID")
    [REDACTED_SECRET]"ALICLOUD_ACCESS_KEY_SECRET")
    security_token = os.getenv("ALICLOUD_SECURITY_TOKEN") or os.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")

    config = open_api_models.Config(
        [REDACTED_SECRET],
        [REDACTED_SECRET],
        endpoint=endpoint,
    )
    if security_token:
        config.security_token = security_token
    client = AgentRunClient(config)

    request = agentrun_models.ListAgentRuntimesRequest()
    response = client.list_agent_runtimes(request)

    output_dir = Path(os.getenv("OUTPUT_DIR", "output")) / "compute-fc-agentrun" / "responses"
    output_dir.mkdir(parents=True, exist_ok=True)
    out_file = output_dir / "list_agent_runtimes.json"

    with out_file.open("w", encoding="utf-8") as f:
        json.dump(response.to_map(), f, ensure_ascii=False, indent=2)

    print(f"Saved: {out_file}")


if __name__ == "__main__":
    main()


path: scripts/runtime_flow.py
content: import os
import sys
import json
from pathlib import Path


def get_env(name: str, default: str | None = None) -> str:
    value = os.getenv(name, default)
    if not value:
        print(f"Missing env var: {name}", file=sys.stderr)
        sys.exit(1)
    return value


def main() -> None:
    """Create runtime -> publish version -> create endpoint."""
    try:
        from alibabacloud_agentrun20250910.client import Client as AgentRunClient
        from alibabacloud_agentrun20250910 import models as agentrun_models
        from alibabacloud_tea_openapi import models as open_api_models
    except Exception:
        print(
            "Missing AgentRun SDK. Generate or install SDK from OpenAPI Explorer.",
            file=sys.stderr,
        )
        sys.exit(1)

    endpoint = get_env("AGENTRUN_ENDPOINT")
    [REDACTED_SECRET]"ALICLOUD_ACCESS_KEY_ID")
    [REDACTED_SECRET]"ALICLOUD_ACCESS_KEY_SECRET")
    security_token = os.getenv("ALICLOUD_SECURITY_TOKEN") or os.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")

    config = open_api_models.Config(
        [REDACTED_SECRET],
        [REDACTED_SECRET],
        endpoint=endpoint,
    )
    if security_token:
        config.security_token = security_token
    client = AgentRunClient(config)

    runtime_name = get_env("AGENTRUN_RUNTIME_NAME")
    runtime_desc = os.getenv("AGENTRUN_RUNTIME_DESC", "created-by-skill")
    runtime_endpoint_name = get_env("AGENTRUN_RUNTIME_ENDPOINT_NAME")

    # Create runtime
    create_runtime_req = agentrun_models.CreateAgentRuntimeRequest(
        name=runtime_name,
        description=runtime_desc,
    )
    create_runtime_resp = client.create_agent_runtime(create_runtime_req)
    runtime_id = create_runtime_resp.body.runtime_id

    # Publish runtime version
    publish_req = agentrun_models.PublishRuntimeVersionRequest(
        runtime_id=runtime_id,
        description="initial",
    )
    publish_resp = client.publish_runtime_version(publish_req)
    version_id = publish_resp.body.version_id

    # Create runtime endpoint
    create_endpoint_req = agentrun_models.CreateAgentRuntimeEndpointRequest(
        runtime_id=runtime_id,
        version_id=version_id,
        name=runtime_endpoint_name,
    )
    create_endpoint_resp = client.create_agent_runtime_endpoint(create_endpoint_req)

    output_dir = Path(os.getenv("OUTPUT_DIR", "output")) / "compute-fc-agentrun" / "responses"
    output_dir.mkdir(parents=True, exist_ok=True)
    out_file = output_dir / "runtime_flow.json"

    payload = {
        "create_runtime": create_runtime_resp.to_map(),
        "publish_version": publish_resp.to_map(),
        "create_endpoint": create_endpoint_resp.to_map(),
    }

    with out_file.open("w", encoding="utf-8") as f:
        json.dump(payload, f, ensure_ascii=False, indent=2)

    print(f"Saved: {out_file}")


if __name__ == "__main__":
    main()


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)