For AI agents: the complete documentation index is available at https://a3s-lab.github.io/Flow/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/Flow/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/Flow/nodes/child-workflows.md.
  • 简体中文
  • v1.1.0
  • 批量启动子工作流 flow.child-workflows

    批量子工作流节点一次声明多个彼此独立的子运行,并等待整组成员解析。它适合固定数量或已经分窗的并行工作,例如按地区执行审核或按文档启动处理流程。单次最多接受 64 个成员,更大的集合应使用稳定游标拆批,避免一个父运行同时创建无法管理的子项数量。

    成员结构

    children 中每个成员包含 child_idspecinputcancellation_policy。child ID 在父运行内必须唯一,并与图节点 ID 共同形成持久身份。成员列表按声明顺序保存,完成时间不会改变结果顺序。已有运行对应的列表不能根据完成先后重排、删改身份或把同一个 ID 指向新的定义。

    每个 spec 固定工作流名称、版本和运行入口,每个 input 提供独立启动数据。取消策略按成员生效。需要父项统一等待清理时使用 request_cancellation,确有独立所有权的任务才选择 abandon。不同策略混用时,应在设计评审中记录哪些成员可能在父项结束后继续。

    汇总与容量

    全部成员解析后,控制从 completed 继续,outcomes 按声明顺序提供每个终态。父图要逐项检查成功、失败、取消和超时,不能只看数组是否返回。测试应覆盖空列表、重复 ID、部分启动、部分失败、达到 64 个成员、父项取消和进程恢复。任务量大时还要设置宿主并发、队列背压与租户配额,防止批量声明压垮下游。

    用它一次声明多个彼此独立的子工作流。适合父运行需要统一等待并按稳定成员顺序收集结果的场景。

    运行方式

    节点 ID 与每个 child_id 共同绑定成员身份。引擎先校验并保存整批请求,再协调子运行,最多接受 64 个成员。

    节点契约

    类型
    flow.child-workflows
    角色
    持久运行命令
    运行绑定
    start_child_workflows
    持久身份
    图节点 ID 与成员 key

    配置属性

    属性类型与控件默认值规则
    children子工作流列表listA3SFlowChildrenInput[{"child_id":"child-1","spec":{"name":"workflow.child","version":"0.1.0","runtime":{"kind":"native_ts","entrypoint":"workflows/child.ts","export_name":"main"}},"input":{},"cancellation_policy":"request_cancellation"}]每批最多 64 项。每项都要填写固定 ID、工作流定义和输入。必填

    children 成员属性

    属性类型与控件规则
    child_idstring父运行内稳定且唯一的子项身份必填
    specWorkflowSpec名称、版本和运行时入口必填
    inputJsonValue子运行的初始输入必填
    cancellation_policyrequest_cancellation | abandon父运行停止时的子项策略必填

    端口

    方向端口 ID种类数据类型
    输入in进入controlFlowControl
    输出completed全部结束controlFlowControl
    输出outcomes运行结果dataWorkflowTerminalOutcome[]

    节点 JSON 示例

    CLI 会用 manifest 默认值生成同样的节点结构。画布位置、标题和选中状态属于展示数据。

    workflow.json
    {
      "position": {
        "x": 320,
        "y": 160
      },
      "id": "example-flow-child-workflows",
      "data": {
        "children": [
          {
            "child_id": "child-1",
            "spec": {
              "name": "workflow.child",
              "version": "0.1.0",
              "runtime": {
                "kind": "native_ts",
                "entrypoint": "workflows/child.ts",
                "export_name": "main"
              }
            },
            "input": {},
            "cancellation_policy": "request_cancellation"
          }
        ],
        "type": "flow.child-workflows"
      }
    }

    CLI 用法

    先查看当前安装版本的 manifest,再创建节点并验证完整工作流。所有命令输出 JSON。

    Terminal
    a3s-flow node flow.child-workflows --pretty
    a3s-flow new flow.child-workflows --id example-flow-child-workflows --pretty
    a3s-flow validate workflow.json --pretty
    a3s-flow compile workflow.json --pretty
    a3s-flow digest workflow.json --pretty

    Skill 用法

    安装包内附带 a3s-flow Skill。它会先查询 CLI 的节点清单,再创建、校验、编译并计算语义摘要。

    Prompt
    Use $a3s-flow to add the "flow.child-workflows" node to workflow.json, connect valid ports, and validate the result.

    CLI 用法 · Skill 用法

    使用注意

    • 成员列表不能为空,child_id 不能重复。
    • 按声明顺序汇总结果,不依赖完成先后。
    • 更大的集合按稳定游标拆分成多批。