必须通过aionclaw的task编排机制显式定义执行顺序、输入传递与错误跳转;需先创建task容器,再挂载skills并配置数据流,最后设置失败处理策略并验证流程连贯性。
☞☞☞AI 智能聊天, 问答助手, AI 智能搜索, 多模态理解力帮你轻松跨越从0到1的创作门槛☜☜☜

要让多个AionClaw Skills串联成一个可自动执行的完整任务,必须通过AionClaw的Task编排机制显式定义执行顺序、输入传递与错误跳转,不能仅靠依次调用函数实现。
创建空Task容器
打开AionClaw CLI,执行 aionclaw task create --name "data-process-pipeline",生成带唯一ID的空白Task结构。
这一步不可跳过——所有Skills只有挂载到Task下才能被调度器识别为原子任务单元;直接运行Skills只会返回结果,不产生任务上下文。
按序挂载Skills并配置数据流
方法一:命令行链式注入(推荐用于3个以内Skills)
执行:aionclaw task add-skill data-process-pipeline --skill "fetch_raw_data" --input '{"url": "https://api.example.com/v1/logs"}' --next "parse_json"→
aionclaw task add-skill data-process-pipeline --skill "parse_json" --input '{"encoding": "utf-8"}' --next "filter_errors"→
aionclaw task add-skill data-process-pipeline --skill "filter_errors" --input '{"threshold": 0.95}'
注意:--next参数值必须严格匹配下一个Skill的名称,大小写敏感;输错会导致执行中断在该节点且无报错提示。
方法二:YAML文件批量声明(适合5+ Skills或需复用场景)
新建 pipeline.yaml,写入:
skills:
- name: fetch_raw_data
input: {url: "https://api.example.com/v1/logs"}
next: parse_json
- name: parse_json
input: {encoding: "utf-8"}
next: filter_errors
- name: filter_errors
input: {threshold: 0.95}
next: save_to_s3
然后运行:aionclaw task load data-process-pipeline --file pipeline.yaml
YAML中每个skill块的next字段若指向不存在的Skill名,加载时会直接失败并退出,不会静默忽略。
设置任务级失败处理策略
执行:aionclaw task set-fallback data-process-pipeline --on-error "notify_slack" --retry 2
这一步决定整个任务的健壮性:--retry设为2表示任一Skill失败后最多重试2次;若省略此步,任何Skill抛异常都会导致任务终止,且不会触发通知。
【notify_slack必须已在AionClaw环境中预注册为可用Skill】
触发执行并验证流程连贯性
第一步:提交任务实例
aionclaw task run data-process-pipeline
第二步:实时查看执行轨迹
aionclaw task logs data-process-pipeline --follow,观察输出是否按fetch_raw_data→parse_json→filter_errors顺序逐行打印“STARTED”“COMPLETED”状态。
第三步:检查最终输出
执行:aionclaw task output data-process-pipeline,确认返回的是filter_errors Skill的输出结构,而非中间某个Skill的原始返回值。











