orchestrator.yml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # ════════════════════════════════════════════════════════════
  2. # Physics67 — 物理自动化研究总指挥 v3
  3. # ════════════════════════════════════════════════════════════
  4. #
  5. # Lambda 语义:
  6. # λidea. Loop_N=3(
  7. # PhysIdea >> PhysGatePlan >>
  8. # PhysLit >> PhysGateLit >>
  9. # PhysSim >> PhysGateSim >>
  10. # PhysAnalyst >> PhysGateAnalysis >>
  11. # PhysWriter >> PhysGatePaper >>
  12. # PhysReview >> PhysGateReview
  13. # )
  14. #
  15. # 每轮调用全部 6 个 sub-agent,并在每个阶段后进行产物验收;
  16. # 3 轮跑完后 terminate。
  17. # 每一轮使用独立 workspace: {base_workspace}/cycle_{n}。
  18. agentId: physics67-orchestrator
  19. name: Physics67 物理研究
  20. # _config_dir 不写死:from_config 默认使用本文件所在目录,
  21. # agentpaas 加载时也会按 explicit > agent_dir > dirname(config_path) 顺序回退(见 agents.py:1248-1266)。
  22. description: >
  23. 物理学自动化研究智能体 v3。从研究问题出发,自动完成
  24. "规划 → 文献 → 模拟 → 分析 → 写作 → 同行评审" 的三轮闭环。
  25. 每轮写入独立工作区,上一轮审稿意见会作为下一轮修订输入。
  26. type: react
  27. model:
  28. provider: claude-code
  29. name: sonnet
  30. temperature: 0.1
  31. maxTokens: 8192
  32. timeout: 1200
  33. systemPrompt: |
  34. 你是物理研究流水线的路由器。你不是执行器;每次只输出一行 JSON 工具调用。
  35. ## 固定目标
  36. 跑满 3 轮 × 12 步 = 6 个 sub-agent + 6 次 gate 验收后再 terminate。
  37. 每轮固定顺序:
  38. call_physidea → call_physgate_plan →
  39. call_physlit → call_physgate_lit →
  40. call_physsim → call_physgate_sim →
  41. call_physanalyst → call_physgate_analysis →
  42. call_physwriter → call_physgate_paper →
  43. call_physreview → call_physgate_review
  44. 如果任何 gate 返回 `"status": "fail"`,不要进入下一阶段。
  45. 必须回到对应 owner 阶段重跑或修复。例如 sim gate fail → call_physsim;
  46. analysis gate fail → call_physanalyst;paper gate fail → call_physwriter。
  47. ## 轮次和工作区
  48. **铁律:所有 workspace 路径必须是绝对路径 (以 `/` 开头)。** 这条规则是
  49. 为了防止 sub-agent 把数据/图/论文写到 repo 根 — 已经发生过两次, 见
  50. docs/AUDIT_2026-06-05.md "项目外目录非法写入" 一节。
  51. - base_workspace:
  52. * 用户指定的绝对路径 → 直接用。
  53. * 用户未给出 → 你必须先调用 Bash 工具:
  54. `echo "$HOME/physics_runs/{安全化标题}"`
  55. 拿到的绝对路径作为 base_workspace。**禁止**使用 `physics_runs/...`
  56. 这种相对形式 — relative + cwd=repo_root 会污染主仓库。
  57. - cycle: 当前轮次,取 1、2、3。
  58. - workspace: `{base_workspace}/cycle_{cycle}` (绝对路径)。
  59. - prev_workspace: cycle=1 时为空字符串;cycle>1 时为 `{base_workspace}/cycle_{cycle-1}`。
  60. **校验**: 调用任何 sub-agent 前, 自己检查 input.workspace 是否以 `/`
  61. 开头。如果不是, 不要发出工具调用 — 重新算 base_workspace 直到拿到
  62. 绝对路径。
  63. 每次调用 sub-agent 时都必须传入:
  64. {
  65. "research_question": "...",
  66. "base_workspace": "<绝对路径>",
  67. "workspace": "<绝对路径>/cycle_N",
  68. "prev_workspace": "<上一轮workspace或空>",
  69. "cycle": N,
  70. "target_venue": "PRL"
  71. }
  72. 每次调用 gate 工具时必须传入:
  73. {"workspace":"<绝对路径>/cycle_N","cycle":N,"stage":"plan|lit|sim|analysis|paper|review"}
  74. ## 如何判断进度
  75. 数输入里完整出现 `call_physreview done` 后再出现 `call_physgate_review done`
  76. 的次数 = 已完成轮数。若不确定,继续按固定顺序推进,不要 terminate。
  77. - 0 次:第 1 轮
  78. - 1 次:第 2 轮
  79. - 2 次:第 3 轮
  80. - 3 次:输出 terminate
  81. 看最后一条 `[Step K] X done`:
  82. - 没有任何 done → call_physidea
  83. - X = call_physidea → call_physgate_plan
  84. - X = call_physlit → call_physgate_lit
  85. - X = call_physsim → call_physgate_sim
  86. - X = call_physanalyst → call_physgate_analysis
  87. - X = call_physwriter → call_physgate_paper
  88. - X = call_physreview → call_physgate_review
  89. - X = call_physgate_review 且已完成 < 3 轮 → 下一轮 call_physidea
  90. - X = call_physgate_review 且已完成 = 3 轮 → terminate
  91. - 其他 X → 按固定顺序调用下一个 sub-agent
  92. ## 禁止
  93. - 禁止直接调用 ReadFile、WriteFile、Bash、ListFiles。
  94. - 禁止自己写论文、写代码、搜索文献或审稿。
  95. - 禁止因为 score >= 7 提前终止;score 只作为下一轮修订信号。
  96. - 禁止跳过 gate;每个阶段产物必须先验收再进入下一阶段。
  97. - 禁止输出 markdown、注释、解释、思考过程。
  98. ## 输出格式
  99. {"tool":"call_physidea","input":{"research_question":"...","base_workspace":"...","workspace":".../cycle_1","prev_workspace":"","cycle":1,"target_venue":"PRL"}}
  100. react:
  101. maxSteps: 120
  102. observationEnabled: true
  103. # physsim plots 10+ figures + writes .npz files; physwriter writes the
  104. # LaTeX + bib + compiles paper.pdf + compiles paper_zh.pdf. Both ran past
  105. # 600s in cycle_1 of run_20260605_004456 (timed out but had produced
  106. # most artifacts). 1200s gives headroom.
  107. toolTimeout: 1200
  108. verbose: true
  109. # Engine-level hard floor (sequence mode): terminate is REJECTED until
  110. # the full stage+gate sequence has fired 3 times. Counter mode
  111. # (`tool` + `minCount`) was gamed in run_ba0d79701903 — orchestrator
  112. # learned to spam call_physreview 3× without ever calling sim/analyst/
  113. # writer. Sequence mode requires each prereq tool to actually appear
  114. # between adjacent call_physreview invocations for a cycle to count.
  115. enforceLoop:
  116. sequence:
  117. - call_physidea
  118. - call_physgate_plan
  119. - call_physlit
  120. - call_physgate_lit
  121. - call_physsim
  122. - call_physgate_sim
  123. - call_physanalyst
  124. - call_physgate_analysis
  125. - call_physwriter
  126. - call_physgate_paper
  127. - call_physreview
  128. - call_physgate_review
  129. minCycles: 3
  130. memory:
  131. enabled: true
  132. strategy: local
  133. size: 50
  134. ttl: 86400
  135. mcp:
  136. # Orchestrator is intentionally pure routing. Sub-agents own file and shell tools.
  137. localTools:
  138. - call_physidea
  139. - call_physlit
  140. - call_physsim
  141. - call_physanalyst
  142. - call_physwriter
  143. - call_physreview
  144. - call_physgate_plan
  145. - call_physgate_lit
  146. - call_physgate_sim
  147. - call_physgate_analysis
  148. - call_physgate_paper
  149. - call_physgate_review
  150. - terminate
  151. policy:
  152. mode: auto
  153. maxConcurrent: 1
  154. # NOTE: current compiler accepts both `subAgents` and `sub_agents`, but this
  155. # config uses the canonical camelCase form. The inner key must be `tool`
  156. # (not `tool_name`) so the desired public tool name is registered.
  157. subAgents:
  158. physidea:
  159. config: ./agents/idea-planner.yml
  160. tool: call_physidea
  161. physlit:
  162. config: ./agents/lit-searcher.yml
  163. tool: call_physlit
  164. physsim:
  165. config: ./agents/simulator.yml
  166. tool: call_physsim
  167. physanalyst:
  168. config: ./agents/analyst.yml
  169. tool: call_physanalyst
  170. physwriter:
  171. config: ./agents/writer.yml
  172. tool: call_physwriter
  173. physreview:
  174. config: ./agents/reviewer.yml
  175. tool: call_physreview
  176. physgate_plan:
  177. config: ./agents/artifact-gate.yml
  178. tool: call_physgate_plan
  179. physgate_lit:
  180. config: ./agents/artifact-gate.yml
  181. tool: call_physgate_lit
  182. physgate_sim:
  183. config: ./agents/artifact-gate.yml
  184. tool: call_physgate_sim
  185. physgate_analysis:
  186. config: ./agents/artifact-gate.yml
  187. tool: call_physgate_analysis
  188. physgate_paper:
  189. config: ./agents/artifact-gate.yml
  190. tool: call_physgate_paper
  191. physgate_review:
  192. config: ./agents/artifact-gate.yml
  193. tool: call_physgate_review
  194. runtime:
  195. engine: cek
  196. costBudget: 2.00
  197. maxSteps: 100000