结构化的多 Agent 层Orchestration 是 Orca 的「有主、可追踪」多 Agent 机制:Run(命名空间 + 协调者收件箱)、Task、Dispatch、监督式 Worker、消息、决策门。需要归属感、完成追踪或 DAG 依赖时用它;一次性提问用
orca terminal send 就够了。核心模型
| 概念 | 含义 |
|---|---|
| Run | 持久的命名空间与收件箱;永不调度或安置 Worker |
| Task | 一项工作:规格 + 依赖 + 状态(pending / ready / dispatched / completed / failed / blocked) |
| Dispatch | 一个任务在某个终端上的一次尝试;是 worker_done / 心跳的生命周期权威 |
| Message | 收件箱邮件:status、dispatch、worker_done、escalation、question、heartbeat… |
| Decision gate | 协调者拥有的问题,阻塞任务直到被解决 |
实验性功能:先在 Settings → Experimental 打开。CLI 与运行中的 Orca 通信,所以
orca status --json应先行通过。
监督式 Worker 循环
orca orchestration run-create --objective "Split checkout QA and summarize blockers" --json
orca orchestration task-create --spec "Audit billing settings for mobile layout" --task-title "Billing audit" --json
orca orchestration worker-start --task <taskId> --worktree current --agent codex --json
# 或建子工作树:
orca orchestration worker-start --task <taskId> --worktree new-child --name billing-audit --agent codex --setup run --json
等待完成(处理 Delivery 里每条消息再 ack):
orca orchestration check --wait --types worker_done,escalation,question --timeout-ms 900000 --json
orca orchestration check --ack <deliveryId> --wait --types worker_done,escalation,question --timeout-ms 900000 --json
Worker 在它的面板里汇报完成(注入的 ID 要用上):
orca orchestration send --type worker_done --subject "Completed mobile audit" \
--body "Fixed footer overlap; no follow-ups." \
--task-id <taskId> --dispatch-id <dispatchId> \
--outcome succeeded --files-modified "src/app/settings/Billing.tsx" --json
worker_done必须带--outcome succeeded|failed;worker 完成/心跳消息要同时带taskId与dispatchId。
检查与回收
orca orchestration worker-show --dispatch <dispatchId> --json
orca orchestration worker-read --dispatch <dispatchId> --limit 50 --json
orca orchestration worker-stop --dispatch <dispatchId> --json
orca orchestration worker-release --dispatch <dispatchId> --json # 归档输出后关闭该协调者终端
orca orchestration worker-retain --dispatch <dispatchId> --json # 保留以供调试
终端里打印的 task_... 是可点击链接——点击会让 Orca 查该任务当前 Dispatch 并聚焦对应终端,包括远程/SSH 运行时里的任务。
落地练习:跑一个受监督任务
- 开启 Experimental → Orchestration
run-create建一个 Run,task-create建一个任务worker-start派一个 Worker(当前工作树 or new-child)- 用
check --wait等完成,send --type worker_done汇报 worker-release回收终端,观察看板/地图上的状态流转
怎么判断做对了?——你能说出 Run / Task / Dispatch / Message 四者关系,并走通一次「派单 → 干活 → 汇报 → 回收」。
卡住了怎么办? 命令报错先 orca skills get orchestration --full 拉最新手册;旧版 run/run-stop 已退役,走 Run + worker-start 新流程。
小结
- Run / Task / Dispatch / Worker / Message / Decision gate 六件套
- 监督循环:run-create → task-create → worker-start → check → send worker_done
- 完成权威来自活跃 Dispatch 上下文,ID 必须带全
- task_... 可点击直达终端(含远程运行时)
- 需要归属与 DAG 才用编排;一次性提问用 terminal send
下一节,定时自动化。