From 57fdc680aaf9563be109af15eaae08014f00b53a Mon Sep 17 00:00:00 2001 From: Huawei Date: Thu, 9 Jul 2026 15:10:30 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20suites-help/=E7=A4=BA=E4=BE=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81/Hello-World.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- suites-help/示例代码/Hello-World.md | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 suites-help/示例代码/Hello-World.md diff --git a/suites-help/示例代码/Hello-World.md b/suites-help/示例代码/Hello-World.md new file mode 100644 index 0000000..2607f6e --- /dev/null +++ b/suites-help/示例代码/Hello-World.md @@ -0,0 +1,67 @@ +# Hello World 套件 + +## 完整代码 + +最小的可工作套件,接收一个文本参数并输出。 + +### 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!" +``` + +### 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 +# 打包 +tar czf scripts.tar.gz workflow.yaml scripts/ + +# 发布后执行 +agc run --inputs '{"message": "你好,AgentGIS!"}' +``` + +完整代码参考:`SuiteHub/hello-world-suite`