From e167beea02f9c96f0685294f19fcfc04e487d5af Mon Sep 17 00:00:00 2001 From: Huawei Date: Thu, 9 Jul 2026 15:10:26 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20suites-help/=E5=BC=80=E5=8F=91=E8=80=85?= =?UTF-8?q?=E6=8C=87=E5=8D=97/=E5=BF=AB=E9=80=9F=E5=BC=80=E5=A7=8B.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suites-help/开发者指南/快速开始.md | 94 ++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 suites-help/开发者指南/快速开始.md diff --git a/suites-help/开发者指南/快速开始.md b/suites-help/开发者指南/快速开始.md new file mode 100644 index 0000000..c4b0c70 --- /dev/null +++ b/suites-help/开发者指南/快速开始.md @@ -0,0 +1,94 @@ +# 快速开始 — 开发第一个套件 + +## 什么是套件 + +套件(Suite)是平台的可执行单元。一个套件包含: +- **workflow.yaml**:步骤定义(核心) +- **scripts/run.py**:执行脚本 + +## 第一步:创建套件目录 + +```bash +mkdir my-first-suite +cd my-first-suite +``` + +## 第二步:编写 workflow.yaml + +```yaml +name: hello-world +description: 最小示例套件 — 输出用户输入的文本 +version: 1.0.0 +category: utility + +params: + type: object + required: + - message + properties: + message: + type: string + description: 要输出的文本 + +steps: + - id: say-hello + name: 输出信息 + script_id: run + params: + message: "${{inputs.message}}" + +resolved_params: + - step_index: 0 + step_name: 输出信息 + params: + message: "Hello, AgentGIS!" +``` + +## 第三步:编写脚本 + +```bash +mkdir scripts +``` + +`scripts/run.py`: + +```python +#!/usr/bin/env python3 +import json, os + +params_file = os.environ.get("PARAMS_FILE", "/tmp/params.json") +with open(params_file) as f: + params = json.load(f) + +message = params.get("message", "Hello!") +result = {"output": message, "length": len(message)} +print(json.dumps(result)) +``` + +## 第四步:测试 + +```bash +agc run --inputs '{"message": "测试"}' +``` + +或直接提交任务到 API: + +```bash +curl -X POST https://suites.mercator.cn/api/v1/task \ + -H "Authorization: Bearer mk_xxxx" \ + -d '{"skill_id": "...", "inputs": {"message": "测试"}}' +``` + +## 第五步:发布 + +```bash +agc publish ./my-first-suite +``` + +发布后套件会在市场中展示,其他用户可以搜索和使用。 + +## 查看已发布的套件 + +```bash +agc suites list +```