1.0 KiB
1.0 KiB
Hello World 套件
完整代码
最小的可工作套件,接收一个文本参数并输出。
workflow.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: run
params:
message: $params.message
scripts/run.py
#!/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))
测试
# 打包
tar czf hello-world.tgz workflow.yaml scripts/
# 通过 API 发布后执行
agc run /tmp/output --suite-id <suite-id> --input message="Hello, AgentGIS!"
完整代码参考:SuiteHub/hello-world-suite