@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (620) hide show
  1. package/CHANGELOG.md +700 -0
  2. package/README.md +441 -177
  3. package/dist/adapters.d.ts +4 -1
  4. package/dist/adapters.js +4 -2
  5. package/dist/agent-rows.d.ts +1 -3
  6. package/dist/agents-store.d.ts +35 -3
  7. package/dist/agents-store.js +48 -23
  8. package/dist/answer-json.d.ts +34 -1
  9. package/dist/answer-json.js +91 -9
  10. package/dist/api-only.d.ts +1 -1
  11. package/dist/api-only.js +2 -2
  12. package/dist/bash-read-only.js +2 -1
  13. package/dist/browser-cost.js +52 -93
  14. package/dist/cap-short.d.ts +12 -0
  15. package/dist/cap-short.js +60 -0
  16. package/dist/cap.d.ts +3 -400
  17. package/dist/cap.js +6 -942
  18. package/dist/catalog.d.ts +0 -5
  19. package/dist/catalog.js +2 -6
  20. package/dist/chatgpt-plan.d.ts +163 -0
  21. package/dist/chatgpt-plan.js +549 -0
  22. package/dist/cli.js +26 -6
  23. package/dist/composio-preset.d.ts +25 -0
  24. package/dist/composio-preset.js +51 -8
  25. package/dist/composio-triggers.d.ts +113 -0
  26. package/dist/composio-triggers.js +411 -0
  27. package/dist/computer-calls.d.ts +36 -24
  28. package/dist/computer-calls.js +110 -27
  29. package/dist/computer-commands.d.ts +2 -0
  30. package/dist/computer-commands.js +7 -3
  31. package/dist/computer-live.d.ts +12 -2
  32. package/dist/computer-live.js +21 -5
  33. package/dist/computer-routes.d.ts +2 -2
  34. package/dist/computer-routes.js +2 -2
  35. package/dist/computer-setting.d.ts +15 -2
  36. package/dist/computer-setting.js +20 -4
  37. package/dist/computer-view.d.ts +18 -2
  38. package/dist/computer-view.js +21 -6
  39. package/dist/computer-viewer.js +40 -13
  40. package/dist/computers.d.ts +8 -2
  41. package/dist/computers.js +18 -8
  42. package/dist/console/assets/index-BNhZs-jp.css +1 -0
  43. package/dist/console/assets/index-BQv5aOGB.js +700 -0
  44. package/dist/console/index.html +2 -2
  45. package/dist/console-links.d.ts +2 -0
  46. package/dist/console-links.js +6 -3
  47. package/dist/decision-cap.d.ts +2 -5
  48. package/dist/decision-cap.js +3 -6
  49. package/dist/decision-rows.js +11 -11
  50. package/dist/decisions.js +4 -0
  51. package/dist/email/account.d.ts +84 -0
  52. package/dist/email/account.js +159 -0
  53. package/dist/email/answer.d.ts +10 -0
  54. package/dist/email/answer.js +182 -0
  55. package/dist/email/email-faux.d.ts +95 -0
  56. package/dist/email/email-faux.js +849 -0
  57. package/dist/email/labels.d.ts +1 -0
  58. package/dist/email/labels.js +84 -0
  59. package/dist/email/mail.d.ts +186 -0
  60. package/dist/email/mail.js +380 -0
  61. package/dist/email/names.d.ts +20 -0
  62. package/dist/email/names.js +40 -0
  63. package/dist/email/routes.d.ts +9 -0
  64. package/dist/email/routes.js +50 -0
  65. package/dist/email/tools.d.ts +20 -0
  66. package/dist/email/tools.js +517 -0
  67. package/dist/environment.d.ts +17 -2
  68. package/dist/environment.js +36 -8
  69. package/dist/errors.d.ts +6 -0
  70. package/dist/errors.js +12 -0
  71. package/dist/eval-mailbox.d.ts +103 -0
  72. package/dist/eval-mailbox.js +236 -0
  73. package/dist/faux-computers.js +4 -2
  74. package/dist/graph-view.d.ts +9 -2
  75. package/dist/graph-view.js +6 -2
  76. package/dist/harness-install.d.ts +28 -2
  77. package/dist/harness-install.js +147 -59
  78. package/dist/harness-opencode/adapter.js +2 -22
  79. package/dist/harness-opencode/facts.js +5 -4
  80. package/dist/harness-opencode/host/policy.d.ts +4 -5
  81. package/dist/harness-opencode/host/policy.js +14 -33
  82. package/dist/harness-opencode/index.d.ts +1 -1
  83. package/dist/harness-opencode/index.js +1 -1
  84. package/dist/harness-opencode/versions.d.ts +6 -0
  85. package/dist/harness-opencode/versions.js +6 -0
  86. package/dist/harness-table.d.ts +0 -2
  87. package/dist/harness-table.js +8 -7
  88. package/dist/harness.d.ts +12 -0
  89. package/dist/harness.js +15 -3
  90. package/dist/host-tools.d.ts +1 -5
  91. package/dist/host-tools.js +7 -10
  92. package/dist/hosted-search.d.ts +3 -3
  93. package/dist/hosted-search.js +51 -32
  94. package/dist/import-sources.d.ts +1 -1
  95. package/dist/import-sources.js +3 -3
  96. package/dist/import.d.ts +21 -0
  97. package/dist/import.js +186 -1
  98. package/dist/key-check.d.ts +0 -2
  99. package/dist/key-check.js +3 -4
  100. package/dist/key-refusal.d.ts +8 -2
  101. package/dist/key-refusal.js +16 -13
  102. package/dist/key-words.d.ts +3 -2
  103. package/dist/key-words.js +4 -2
  104. package/dist/learn/check.d.ts +24 -4
  105. package/dist/learn/check.js +340 -7
  106. package/dist/learn/commit.d.ts +10 -0
  107. package/dist/learn/commit.js +18 -4
  108. package/dist/learn/compile.d.ts +250 -0
  109. package/dist/learn/compile.js +507 -0
  110. package/dist/learn/general.d.ts +3 -0
  111. package/dist/learn/general.js +4 -2
  112. package/dist/learn/grade.d.ts +5 -1
  113. package/dist/learn/grade.js +11 -7
  114. package/dist/learn/notes.d.ts +8 -0
  115. package/dist/learn/notes.js +18 -0
  116. package/dist/learn/promote.d.ts +308 -0
  117. package/dist/learn/promote.js +321 -0
  118. package/dist/learn/refit.d.ts +48 -0
  119. package/dist/learn/refit.js +264 -0
  120. package/dist/learn/reflect.d.ts +5 -25
  121. package/dist/learn/reflect.js +14 -131
  122. package/dist/learn/replay-calls.d.ts +63 -0
  123. package/dist/learn/replay-calls.js +158 -0
  124. package/dist/learn/skills.d.ts +19 -16
  125. package/dist/learn/skills.js +157 -53
  126. package/dist/learn/workflow-nodes.d.ts +15 -0
  127. package/dist/learn/workflow-nodes.js +44 -0
  128. package/dist/learned-nodes.d.ts +58 -2
  129. package/dist/learned-nodes.js +68 -5
  130. package/dist/learned-workflow.d.ts +58 -32
  131. package/dist/learned-workflow.js +215 -77
  132. package/dist/learning-batch.d.ts +2 -2
  133. package/dist/learning-batch.js +4 -4
  134. package/dist/learning-cost.d.ts +41 -11
  135. package/dist/learning-cost.js +31 -13
  136. package/dist/learning-routes.d.ts +12 -2
  137. package/dist/learning-routes.js +34 -6
  138. package/dist/learning-words.d.ts +8 -1
  139. package/dist/learning-words.js +11 -1
  140. package/dist/learning.d.ts +26 -1
  141. package/dist/learning.js +7 -4
  142. package/dist/link-check.d.ts +27 -0
  143. package/dist/link-check.js +164 -0
  144. package/dist/llm.js +0 -3
  145. package/dist/local-models.d.ts +33 -2
  146. package/dist/local-models.js +43 -5
  147. package/dist/mcp-gateway.d.ts +12 -20
  148. package/dist/mcp-gateway.js +16 -44
  149. package/dist/mcp-oauth.d.ts +5 -0
  150. package/dist/mcp-oauth.js +1 -1
  151. package/dist/mcp-pin-first.d.ts +37 -0
  152. package/dist/mcp-pin-first.js +113 -0
  153. package/dist/mcp-probe.d.ts +8 -9
  154. package/dist/mcp-probe.js +16 -33
  155. package/dist/mcp-secret-writes.js +3 -0
  156. package/dist/mcp-servers-store.d.ts +102 -26
  157. package/dist/mcp-servers-store.js +151 -25
  158. package/dist/mcp-sources.d.ts +39 -0
  159. package/dist/mcp-sources.js +74 -0
  160. package/dist/mcp-store.d.ts +11 -0
  161. package/dist/mcp-store.js +16 -2
  162. package/dist/mcp-wire.d.ts +22 -0
  163. package/dist/mcp-wire.js +36 -0
  164. package/dist/mcp.js +3 -3
  165. package/dist/meta-tool-names.d.ts +1 -0
  166. package/dist/meta-tool-names.js +3 -0
  167. package/dist/model-form.d.ts +11 -0
  168. package/dist/model-form.js +17 -1
  169. package/dist/model.d.ts +39 -6
  170. package/dist/model.js +171 -32
  171. package/dist/monid.d.ts +50 -29
  172. package/dist/monid.js +234 -143
  173. package/dist/native/binding.d.ts +13 -0
  174. package/dist/native/binding.js +57 -0
  175. package/dist/native/cli.d.ts +2 -0
  176. package/dist/native/cli.js +48 -0
  177. package/dist/native/connection.d.ts +8 -0
  178. package/dist/native/connection.js +94 -0
  179. package/dist/native/context.d.ts +6 -0
  180. package/dist/native/context.js +22 -0
  181. package/dist/native/discovery.d.ts +27 -0
  182. package/dist/native/discovery.js +404 -0
  183. package/dist/native/environment.d.ts +4 -0
  184. package/dist/native/environment.js +18 -0
  185. package/dist/native/history.d.ts +20 -0
  186. package/dist/native/history.js +147 -0
  187. package/dist/native/instructions.d.ts +21 -0
  188. package/dist/native/instructions.js +173 -0
  189. package/dist/native/remote-worker-bridge.d.ts +3 -0
  190. package/dist/native/remote-worker-bridge.js +278 -0
  191. package/dist/native/remote.d.ts +187 -0
  192. package/dist/native/remote.js +492 -0
  193. package/dist/native/runtime.d.ts +17 -0
  194. package/dist/native/runtime.js +316 -0
  195. package/dist/native/runtimes.d.ts +66 -0
  196. package/dist/native/runtimes.js +41 -0
  197. package/dist/native/schema.d.ts +46 -0
  198. package/dist/native/schema.js +41 -0
  199. package/dist/native/types.d.ts +87 -0
  200. package/dist/native/types.js +1 -0
  201. package/dist/observation/http.d.ts +4 -0
  202. package/dist/observation/http.js +140 -0
  203. package/dist/observation/observer.d.ts +301 -0
  204. package/dist/observation/observer.js +919 -0
  205. package/dist/observation/schema.d.ts +52 -0
  206. package/dist/observation/schema.js +154 -0
  207. package/dist/openapi.d.ts +1 -0
  208. package/dist/openapi.js +705 -126
  209. package/dist/paid-calls.d.ts +34 -32
  210. package/dist/paid-calls.js +52 -104
  211. package/dist/place-offers.d.ts +4 -8
  212. package/dist/place-offers.js +4 -9
  213. package/dist/port-models.d.ts +7 -2
  214. package/dist/port-models.js +5 -2
  215. package/dist/print.d.ts +4 -2
  216. package/dist/print.js +4 -3
  217. package/dist/propose.d.ts +8 -3
  218. package/dist/propose.js +28 -7
  219. package/dist/provider.d.ts +5 -1
  220. package/dist/provider.js +17 -2
  221. package/dist/push-handler.d.ts +3 -2
  222. package/dist/push-handler.js +20 -6
  223. package/dist/reflect-range.js +2 -1
  224. package/dist/refusal-words.d.ts +11 -0
  225. package/dist/refusal-words.js +13 -2
  226. package/dist/rows.d.ts +5 -3
  227. package/dist/rows.js +15 -4
  228. package/dist/run-launch.d.ts +23 -1
  229. package/dist/run-launch.js +17 -4
  230. package/dist/run-learning-served.d.ts +84 -0
  231. package/dist/run-manifest.d.ts +8 -0
  232. package/dist/run-manifest.js +33 -1
  233. package/dist/run-reads-over-store.d.ts +3 -3
  234. package/dist/run-reads-over-store.js +13 -10
  235. package/dist/run-secrets.js +2 -3
  236. package/dist/run-timeline-served.d.ts +3 -2
  237. package/dist/run-timeline-served.js +12 -10
  238. package/dist/run-view.d.ts +59 -41
  239. package/dist/run-view.js +128 -64
  240. package/dist/runnable.d.ts +13 -8
  241. package/dist/runnable.js +77 -60
  242. package/dist/runner/adapter-loop.d.ts +60 -15
  243. package/dist/runner/adapter-loop.js +1406 -464
  244. package/dist/runner/adapter-run-spec.d.ts +45 -14
  245. package/dist/runner/adapter-run-spec.js +200 -116
  246. package/dist/runner/adapters/pi.d.ts +40 -7
  247. package/dist/runner/adapters/pi.js +149 -38
  248. package/dist/runner/beside.d.ts +3 -1
  249. package/dist/runner/beside.js +24 -8
  250. package/dist/runner/claim-secrets.d.ts +3 -1
  251. package/dist/runner/claim-secrets.js +28 -4
  252. package/dist/runner/cli-run-spec.d.ts +30 -0
  253. package/dist/runner/cli-run-spec.js +150 -66
  254. package/dist/runner/computer-channel.d.ts +5 -2
  255. package/dist/runner/computer-channel.js +5 -3
  256. package/dist/runner/computer-journal.d.ts +6 -0
  257. package/dist/runner/computer-journal.js +8 -10
  258. package/dist/runner/conformance/harness.d.ts +3 -0
  259. package/dist/runner/conformance/harness.js +149 -5
  260. package/dist/runner/conformance/subject.d.ts +11 -4
  261. package/dist/runner/end-of-run.d.ts +8 -5
  262. package/dist/runner/end-of-run.js +11 -6
  263. package/dist/runner/feedback-round.d.ts +79 -0
  264. package/dist/runner/feedback-round.js +127 -0
  265. package/dist/runner/harness-loops.js +17 -0
  266. package/dist/runner/journal-kinds.d.ts +55 -13
  267. package/dist/runner/journal-kinds.js +19 -0
  268. package/dist/runner/learning-dispatch.d.ts +3 -2
  269. package/dist/runner/learning-dispatch.js +6 -6
  270. package/dist/runner/learning-end.d.ts +58 -19
  271. package/dist/runner/learning-end.js +316 -115
  272. package/dist/runner/learning-factory.d.ts +3 -0
  273. package/dist/runner/learning-factory.js +8 -2
  274. package/dist/runner/learning-loop.d.ts +21 -1
  275. package/dist/runner/learning-loop.js +24 -6
  276. package/dist/runner/learning-seed.d.ts +4 -0
  277. package/dist/runner/learning-seed.js +14 -0
  278. package/dist/runner/loop-contract.d.ts +19 -3
  279. package/dist/runner/loop.d.ts +34 -1
  280. package/dist/runner/loop.js +55 -1
  281. package/dist/runner/main.d.ts +6 -1
  282. package/dist/runner/main.js +26 -4
  283. package/dist/runner/mcp-claim.d.ts +5 -1
  284. package/dist/runner/mcp-claim.js +66 -50
  285. package/dist/runner/mcp-run.d.ts +20 -53
  286. package/dist/runner/mcp-run.js +22 -88
  287. package/dist/runner/meta-tools.d.ts +44 -0
  288. package/dist/runner/meta-tools.js +344 -0
  289. package/dist/runner/metrics.d.ts +80 -21
  290. package/dist/runner/metrics.js +128 -42
  291. package/dist/runner/model-route.d.ts +12 -3
  292. package/dist/runner/model-route.js +149 -19
  293. package/dist/runner/monid-run.d.ts +18 -0
  294. package/dist/runner/monid-run.js +170 -0
  295. package/dist/runner/native-loop.d.ts +11 -0
  296. package/dist/runner/native-loop.js +438 -0
  297. package/dist/runner/promotion.d.ts +146 -0
  298. package/dist/runner/promotion.js +803 -0
  299. package/dist/runner/redact.js +3 -0
  300. package/dist/runner/reflect-hook.d.ts +36 -21
  301. package/dist/runner/reflect-hook.js +147 -49
  302. package/dist/runner/runner.d.ts +7 -1
  303. package/dist/runner/runner.js +34 -8
  304. package/dist/runner/sdk-loop.d.ts +7 -0
  305. package/dist/runner/sdk-loop.js +470 -0
  306. package/dist/runner/sessions.d.ts +8 -3
  307. package/dist/runner/sessions.js +5 -1
  308. package/dist/runner/spec-holds.d.ts +16 -2
  309. package/dist/runner/spec-holds.js +42 -14
  310. package/dist/runner/step-guard.d.ts +62 -0
  311. package/dist/runner/step-guard.js +93 -0
  312. package/dist/runner/store-secrets.js +17 -2
  313. package/dist/runner/subagent.d.ts +0 -3
  314. package/dist/runner/subagent.js +7 -12
  315. package/dist/runner/workflow-first.d.ts +226 -0
  316. package/dist/runner/workflow-first.js +293 -0
  317. package/dist/runner/workflow-loop.d.ts +1 -1
  318. package/dist/runner/workflow-loop.js +32 -19
  319. package/dist/runner/workflow-spec.d.ts +5 -1
  320. package/dist/runner/workflow-spec.js +63 -48
  321. package/dist/runs-over-store.d.ts +41 -4
  322. package/dist/runs-over-store.js +64 -22
  323. package/dist/sdk/runs.d.ts +115 -0
  324. package/dist/sdk/runs.js +422 -0
  325. package/dist/sdk/schema.d.ts +175 -0
  326. package/dist/sdk/schema.js +138 -0
  327. package/dist/sdk/workflows.d.ts +22 -0
  328. package/dist/sdk/workflows.js +39 -0
  329. package/dist/secrets.d.ts +2 -0
  330. package/dist/secrets.js +19 -1
  331. package/dist/server.d.ts +108 -20
  332. package/dist/server.js +874 -157
  333. package/dist/settings-wake.d.ts +8 -6
  334. package/dist/settings-wake.js +13 -7
  335. package/dist/skill-route.d.ts +3 -0
  336. package/dist/skill-route.js +16 -0
  337. package/dist/skills/agentrun-serve/SKILL.md +368 -0
  338. package/dist/stats.d.ts +10 -10
  339. package/dist/store/agent-body.d.ts +22 -7
  340. package/dist/store/agent-body.js +23 -14
  341. package/dist/store/command-wake.d.ts +3 -2
  342. package/dist/store/command-wake.js +4 -4
  343. package/dist/store/index.d.ts +1 -1
  344. package/dist/store/native-command-owner.d.ts +10 -0
  345. package/dist/store/native-command-owner.js +47 -0
  346. package/dist/store/postgres/connection.js +3 -1
  347. package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
  348. package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
  349. package/dist/store/postgres/migrations/0012_revision_monid_pin.sql +4 -0
  350. package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
  351. package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
  352. package/dist/store/postgres/store.js +3 -0
  353. package/dist/store/schema.d.ts +16 -0
  354. package/dist/store/schema.js +47 -8
  355. package/dist/store/sqlite/connection.d.ts +2 -2
  356. package/dist/store/sqlite/connection.js +2 -2
  357. package/dist/store/sqlite/run-patch.d.ts +8 -1
  358. package/dist/store/sqlite/run-patch.js +33 -10
  359. package/dist/store/sqlite/store.js +184 -28
  360. package/dist/store/store.d.ts +98 -21
  361. package/dist/store-reads/analytics.d.ts +7 -7
  362. package/dist/store-reads/analytics.js +23 -5
  363. package/dist/store-reads/cap.js +8 -6
  364. package/dist/store-reads/journal.d.ts +30 -1
  365. package/dist/store-reads/journal.js +141 -83
  366. package/dist/store-reads/learning.d.ts +179 -13
  367. package/dist/store-reads/learning.js +230 -68
  368. package/dist/store-reads/loop.d.ts +61 -0
  369. package/dist/store-reads/loop.js +111 -0
  370. package/dist/store-reads/runs.d.ts +5 -0
  371. package/dist/store-reads/runs.js +3 -2
  372. package/dist/store-view.d.ts +3 -2
  373. package/dist/store-view.js +109 -37
  374. package/dist/template-eval.d.ts +87 -16
  375. package/dist/template-eval.js +605 -120
  376. package/dist/template-github-permissions.d.ts +2 -2
  377. package/dist/template-github-permissions.js +2 -1
  378. package/dist/template-import.d.ts +31 -0
  379. package/dist/template-import.js +121 -0
  380. package/dist/template-source.d.ts +51 -0
  381. package/dist/template-source.js +371 -0
  382. package/dist/templates.d.ts +274 -52
  383. package/dist/templates.js +670 -201
  384. package/dist/text-urls.d.ts +38 -0
  385. package/dist/text-urls.js +170 -0
  386. package/dist/timeline/computer.d.ts +48 -0
  387. package/dist/timeline/computer.js +169 -0
  388. package/dist/timeline/index.d.ts +7 -5
  389. package/dist/timeline/index.js +7 -5
  390. package/dist/timeline/labels.d.ts +11 -4
  391. package/dist/timeline/labels.js +122 -8
  392. package/dist/timeline/origin.d.ts +20 -6
  393. package/dist/timeline/origin.js +13 -6
  394. package/dist/timeline/render-text.js +1 -1
  395. package/dist/timeline/timeline.d.ts +76 -20
  396. package/dist/timeline/timeline.js +184 -39
  397. package/dist/timeline/util.d.ts +5 -0
  398. package/dist/timeline/util.js +44 -8
  399. package/dist/timeline/web-calls.d.ts +17 -0
  400. package/dist/timeline/web-calls.js +106 -0
  401. package/dist/tool-gate.d.ts +103 -76
  402. package/dist/tool-gate.js +200 -127
  403. package/dist/tool-keys.d.ts +4 -1
  404. package/dist/tool-keys.js +8 -3
  405. package/dist/tool-list.d.ts +29 -0
  406. package/dist/tool-list.js +50 -0
  407. package/dist/tool-names.d.ts +76 -0
  408. package/dist/tool-names.js +101 -0
  409. package/dist/tool-plane.d.ts +34 -28
  410. package/dist/tool-plane.js +72 -37
  411. package/dist/tools.d.ts +59 -15
  412. package/dist/tools.js +46 -42
  413. package/dist/trigger-adapter.d.ts +85 -5
  414. package/dist/trigger-adapter.js +6 -0
  415. package/dist/trigger-adapters.js +3 -1
  416. package/dist/trigger-composio.d.ts +10 -0
  417. package/dist/trigger-composio.js +122 -0
  418. package/dist/trigger-email.d.ts +4 -0
  419. package/dist/trigger-email.js +228 -0
  420. package/dist/trigger-signatures.d.ts +6 -10
  421. package/dist/trigger-signatures.js +16 -16
  422. package/dist/trigger-targets.d.ts +1 -1
  423. package/dist/trigger-targets.js +4 -3
  424. package/dist/trigger-webhook.js +6 -4
  425. package/dist/triggers.d.ts +94 -9
  426. package/dist/triggers.js +263 -62
  427. package/dist/uploads.d.ts +9 -0
  428. package/dist/uploads.js +27 -0
  429. package/dist/validate.d.ts +15 -7
  430. package/dist/validate.js +91 -50
  431. package/dist/web-fake.d.ts +56 -0
  432. package/dist/web-fake.js +102 -0
  433. package/dist/web-fetch-direct.d.ts +3 -0
  434. package/dist/web-fetch-direct.js +4 -1
  435. package/dist/web-fetch.d.ts +6 -8
  436. package/dist/web-fetch.js +10 -53
  437. package/dist/web-search.d.ts +51 -2
  438. package/dist/web-search.js +116 -18
  439. package/dist/webhooks.d.ts +2 -1
  440. package/dist/webhooks.js +5 -1
  441. package/dist/workflow/node-runner.js +10 -2
  442. package/dist/workspace/archil-claim.d.ts +3 -0
  443. package/dist/workspace/archil-claim.js +9 -2
  444. package/dist/workspace/computer-deps.d.ts +25 -9
  445. package/dist/workspace/computer-deps.js +82 -38
  446. package/dist/workspace/computer-for-claim.d.ts +60 -4
  447. package/dist/workspace/computer-for-claim.js +203 -45
  448. package/dist/workspace/computer-hold.js +7 -1
  449. package/dist/workspace/computer-janitor.d.ts +10 -3
  450. package/dist/workspace/computer-janitor.js +96 -29
  451. package/dist/workspace/computer-kept.d.ts +82 -0
  452. package/dist/workspace/computer-kept.js +147 -0
  453. package/dist/workspace/computer-mcp.js +4 -3
  454. package/dist/workspace/computer-ports.d.ts +23 -3
  455. package/dist/workspace/computer-ports.js +115 -5
  456. package/dist/workspace/index.d.ts +2 -3
  457. package/dist/workspace/index.js +1 -2
  458. package/dist/workspace/kind-skills/desktop/SKILL.md +31 -11
  459. package/dist/workspace/kind-skills/phone/SKILL.md +29 -14
  460. package/dist/workspace/local.js +2 -2
  461. package/dist/workspace/resolve-computer.d.ts +33 -1
  462. package/dist/workspace/resolve-computer.js +37 -16
  463. package/dist/workspace/revision-skills.d.ts +6 -2
  464. package/dist/workspace/revision-skills.js +12 -5
  465. package/dist/workspace/run-end-computers.d.ts +30 -0
  466. package/dist/workspace/run-end-computers.js +137 -0
  467. package/dist/workspace/run-tools.d.ts +40 -23
  468. package/dist/workspace/run-tools.js +46 -19
  469. package/dist/wrap-up.d.ts +35 -0
  470. package/dist/wrap-up.js +48 -0
  471. package/launcher/agentrun-serve +4 -2
  472. package/package.json +13 -9
  473. package/skills/agentrun-serve/SKILL.md +248 -10
  474. package/templates/README.md +220 -60
  475. package/templates/TOOLS.md +168 -0
  476. package/templates/code-review/agent.md +46 -16
  477. package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
  478. package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
  479. package/templates/code-review/evals/injection/case.yaml +2 -1
  480. package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
  481. package/templates/code-review/evals/mentions-defused/case.yaml +3 -3
  482. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
  483. package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
  484. package/templates/code-review/evals/never-flag/case.yaml +2 -1
  485. package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
  486. package/templates/code-review/evals/null-name/case.yaml +2 -1
  487. package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
  488. package/templates/code-review/evals/off-by-one/case.yaml +2 -1
  489. package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
  490. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +2 -1
  491. package/templates/code-review/evals/other-repo/case.yaml +16 -0
  492. package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
  493. package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
  494. package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
  495. package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
  496. package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
  497. package/templates/code-review/evals/other-repo/prompt.md +10 -0
  498. package/templates/code-review/evals/pasted-by-reference/case.yaml +5 -0
  499. package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
  500. package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
  501. package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -0
  502. package/templates/code-review/evals/re-review/case.yaml +2 -1
  503. package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
  504. package/templates/code-review/evals/re-review-open/case.yaml +2 -1
  505. package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
  506. package/templates/code-review/evals/repo-rule/case.yaml +2 -1
  507. package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
  508. package/templates/code-review/evals/two-defects/case.yaml +2 -1
  509. package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
  510. package/templates/code-review/rules/CODEREVIEW.md +1 -1
  511. package/templates/code-review/skills/review/DEEP.md +5 -4
  512. package/templates/code-review/skills/review/REVIEWER.md +5 -4
  513. package/templates/code-review/skills/review/SKILL.md +11 -6
  514. package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
  515. package/templates/inbound-lead/agent.md +26 -16
  516. package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
  517. package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
  518. package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
  519. package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
  520. package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
  521. package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
  522. package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
  523. package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
  524. package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
  525. package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
  526. package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
  527. package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
  528. package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
  529. package/templates/kyb/agent.md +15 -5
  530. package/templates/kyb/evals/adverse-media/prompt.md +2 -7
  531. package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
  532. package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
  533. package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
  534. package/templates/kyb/evals/name-collision/prompt.md +2 -6
  535. package/templates/kyb/evals/no-invention/prompt.md +2 -6
  536. package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
  537. package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
  538. package/templates/kyb/kyb.schema.json +8 -7
  539. package/templates/kyb/skills/kyb/SKILL.md +9 -6
  540. package/templates/market-monitor/agent.md +19 -12
  541. package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
  542. package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
  543. package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
  544. package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
  545. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  546. package/templates/release-notes/agent.md +32 -10
  547. package/templates/release-notes/evals/draft-not-publish/case.yaml +5 -4
  548. package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
  549. package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
  550. package/templates/release-notes/evals/issue-write-refused/case.yaml +5 -4
  551. package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
  552. package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
  553. package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
  554. package/templates/release-notes/evals/learned-style/case.yaml +2 -1
  555. package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
  556. package/templates/release-notes/evals/other-repo/case.yaml +24 -0
  557. package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
  558. package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
  559. package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
  560. package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
  561. package/templates/release-notes/evals/other-repo/prompt.md +32 -0
  562. package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
  563. package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
  564. package/templates/release-notes/notes.schema.json +1 -1
  565. package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
  566. package/dist/console/assets/index-Cn6JX1uH.js +0 -563
  567. package/dist/console/assets/index-DRN62V5v.css +0 -1
  568. package/dist/host-calls.d.ts +0 -20
  569. package/dist/host-calls.js +0 -12
  570. package/dist/runner/adapters/pi-computer.d.ts +0 -7
  571. package/dist/runner/adapters/pi-computer.js +0 -43
  572. package/dist/tool-blurbs.d.ts +0 -4
  573. package/dist/tool-blurbs.js +0 -28
  574. package/dist/tool-budget.d.ts +0 -38
  575. package/dist/tool-budget.js +0 -62
  576. package/dist/workspace/computer-script.d.ts +0 -37
  577. package/dist/workspace/computer-script.js +0 -138
  578. package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
  579. package/templates/code-review/evals/injection/graders/schema.md +0 -5
  580. package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
  581. package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
  582. package/templates/code-review/evals/null-name/graders/schema.md +0 -5
  583. package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
  584. package/templates/code-review/evals/re-review/graders/schema.md +0 -5
  585. package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
  586. package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
  587. package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
  588. package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
  589. package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
  590. package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
  591. package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
  592. package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
  593. package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
  594. package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
  595. package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
  596. package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
  597. package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
  598. package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
  599. package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
  600. package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
  601. package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
  602. package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
  603. package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
  604. package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
  605. package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
  606. package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
  607. package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
  608. package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
  609. package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
  610. package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
  611. package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
  612. package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
  613. package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
  614. package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
  615. package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
  616. package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
  617. package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
  618. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
  619. package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
  620. package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
package/README.md CHANGED
@@ -7,6 +7,19 @@ runner starts beside the server. The capabilities document (`GET /v2/capabilitie
7
7
 
8
8
  `npx @parcha/agentrun` starts it, with its console, on your machine; the container image runs it on a server (below).
9
9
 
10
+ Already use Claude Code or Codex? Choose **Connect agent** in the console and select your coding agent from the
11
+ dropdown. Its skill asks whether to connect for future jobs, import past history, or both, then confirms the source
12
+ project and machine. No destination model key is needed for this connection: a live agent uses its existing native
13
+ sign-in and configuration. Turn **Self-improving** On separately to supply checked notes and skills to later runs;
14
+ imported history stays historical and does not automatically train the agent.
15
+
16
+ For a source on a different laptop, VM or container, choose **Connection setup → Another machine** and use the
17
+ matching [Python source connector](../../connector/README.md). Remote execution currently needs the server and
18
+ connector from the same reviewed development checkout; the published observation-only CLI does not include it.
19
+ The source worker must stay online. See [Native agents](../../docs/native-agents.md) for setup, history scopes and
20
+ runtime limits. Connected agents use ordinary agent revisions and the existing checked learning pipeline; managed
21
+ adapter isolation is unchanged.
22
+
10
23
  ## Quick start (no key, no network)
11
24
 
12
25
  Node 24.22.3 or later. In a checkout of this repository:
@@ -35,7 +48,7 @@ Set your password: http://127.0.0.1:7340/setup (the first visit sets it)
35
48
  A Docker box's image is built on its first run, which shows that on its timeline. `npx @parcha/agentrun` prints the
36
49
  `Boxes:` line on stderr, after its own line on stdout. On a machine where Docker is not running, the `Boxes:` line says so instead (`Boxes: none, so new agents run on the
37
50
  runner. Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart
38
- AgentRun.`); see [Boxes](#boxes).
51
+ AgentRun.`); see [Sandbox](#sandbox).
39
52
 
40
53
  `Open` is [the console](#the-console), which takes [your password](#your-password). For a client, export the two lines before
41
54
  it, then make an agent, start a run, and read its timeline until a page says `final`:
@@ -75,7 +88,8 @@ place: a token from the environment stays out of the logs. `DIR/.token`'s token
75
88
  it; a later start prints `AGENTRUN_API_KEY=<in DIR/.token>`, to read it there. With `AGENTRUN_ACCOUNTS=0` the `Open`
76
89
  link carries a launch code this start made at random (`?launch=<code>`), never the token. `AGENTRUN_PUBLIC_URL`, when set, is the
77
90
  address people open (a container's published port, or a proxy's URL): the printed `Open` link and `AGENTRUN_BASE_URL`
78
- use it.
91
+ use it. `AGENTRUN_FREE_MODEL_REQUESTS` (default 60) is the most requests on free models a run makes
92
+ ([a limit on free requests](#a-limit-on-free-requests)).
79
93
 
80
94
  ## Sandbox in 60 seconds
81
95
 
@@ -137,7 +151,7 @@ at=2026-10-25T21:04:09.010Z event=auth_failed route=/v2/runs reason=wrong_token
137
151
  A request's path has no query. `auth_failed` names the route and why (`no_credential`, `wrong_token`,
138
152
  `wrong_launch_code`, `wrong_password`, `sign_in_table_full`), never the token given nor any part of it. `AGENTRUN_LOG=quiet` leaves out the request lines; the
139
153
  run and `auth_failed` lines stay. A run whose process failed at its start says why in its `error.message`, in words.
140
- One line at start, `event=boxes`, says which boxes this server has ([Boxes](#boxes)); quiet keeps it too.
154
+ One line at start, `event=boxes`, says which boxes this server has ([Sandbox](#sandbox)); quiet keeps it too.
141
155
  `event=harness_offers why=start ms=<n>` says how long the server took to check what each harness offers (each CLI's
142
156
  package and pins; [harnesses](#harnesses)), the bulk of its start; quiet keeps it too. It is made at the start only: a
143
157
  PUT of `/settings/tools` and a save or delete of a tool key change no harness's offer, so they remake capabilities at
@@ -151,9 +165,11 @@ Docker socket, so each run's Docker sandbox is a container beside the server's,
151
165
  volume ([in the published image](#in-the-published-image)). It takes Docker Engine 26 or later, which mounts a
152
166
  volume's subpath.
153
167
 
154
- 1. Start it (below).
168
+ 1. Start it (below). It needs no model key.
155
169
  2. Open the console and set your password.
156
- 3. Sign in with it on any browser; the token in the log stays for scripts and the CLI.
170
+ 3. Continue with ChatGPT (Settings → Model keys, or the first screen), then run your first agent. Or add a model key
171
+ there instead ([on a ChatGPT plan](#on-a-chatgpt-plan)).
172
+ 4. Sign in with your password on any browser; the token in the log stays for scripts and the CLI.
157
173
 
158
174
  On a fresh server with no `AGENTRUN_PUBLIC_URL`, whoever reaches the console first sets the password, so set it right after
159
175
  the start, before the port is reachable by anyone else. With `AGENTRUN_PUBLIC_URL` set, the setup code the server
@@ -163,13 +179,18 @@ On a Linux host with Docker Engine 26 or later, with no checkout:
163
179
 
164
180
  ```sh
165
181
  curl -fsSLO https://raw.githubusercontent.com/Parcha-ai/agentrun/main/compose.yaml
166
- export AGENT_MODEL=openrouter/anthropic/claude-sonnet-5.5 OPENROUTER_API_KEY=...
167
182
  echo "DOCKER_GID=$(stat -c %g /var/run/docker.sock)" >> .env
168
183
  echo "AGENTRUN_SEAL_KEY=$(openssl rand -base64 32)" >> .env && chmod 600 .env # once; keep it
169
184
  docker compose up -d
170
185
  docker compose logs agentrun | grep Open
171
186
  ```
172
187
 
188
+ For a model key as well, save it in the console, or export it before `docker compose up`:
189
+
190
+ ```sh
191
+ export AGENT_MODEL=openrouter/anthropic/claude-sonnet-5.5 OPENROUTER_API_KEY=...
192
+ ```
193
+
173
194
  The `.env` beside `compose.yaml` keeps the socket's group (`DOCKER_GID`) for every later `docker compose` command, in any
174
195
  shell: compose reads it each time, and `compose.yaml` needs it to be read at all.
175
196
 
@@ -276,7 +297,9 @@ and a 200 says it can work, and the platforms here take one path.
276
297
 
277
298
  A run's runner renews its claim on the run every 10 s, for a claim of 30 s. A runner that stops, or cannot renew in
278
299
  time, writes nothing more to the run, and the store refuses any write under a claim the run has moved past. Once the
279
- claim lapses another runner claims the run and resumes it from its journal. `agentrun-serve runner --check --data DIR --name N`
300
+ claim lapses another runner claims the run and resumes it from its journal. A run's own computer doesn't survive a
301
+ runner loss, a crash, a server stop or a park (the claim that resumes the run starts a new one, and says so on the
302
+ timeline and, once, to the model as an "AgentRun server note"), and the agent's own computer, a persistent setting, does. `agentrun-serve runner --check --data DIR --name N`
280
303
  (or `AGENTRUN_RUNNER_NAME=N` in place of `--name`) says whether the runner named `N` has a fresh heartbeat: it exits 0
281
304
  when it does and 1 when it does not, and 2 when no name is given. Name a runner you start yourself with
282
305
  `agentrun-serve runner --data DIR --name N`.
@@ -287,10 +310,10 @@ A sandbox agent's `bash` runs in a box, a machine apart from this server. Docker
287
310
  with no setup: a Docker container made for each run, which binds the run's `work/` and nothing else. A Daytona or Modal box
288
311
  runs on a computer from that provider, offered once `AGENTRUN_BOXES` lists it and the keys its computer provider needs are
289
312
  set (the environment, or Settings → Computers). No box holds a key. A Docker box on Linux reaches the package registries
290
- and GitHub through a proxy, and nothing else; a Daytona or Modal box is made with no network when a host list is set, and
291
- capabilities say so in its `places.boxes` entry. Its `read`, `write` and `edit` work on that same `work/`: on this server, where the box binds it and this server
313
+ and GitHub through a proxy, and nothing else; so does a Daytona or Modal box, through the egress proxy its computer's
314
+ init starts, and capabilities say so in its `places.boxes` entry. Its `read`, `write` and `edit` work on that same `work/`: on this server, where the box binds it and this server
292
315
  holds directory handles (Docker on Linux), else in the box. The agent's loop, its log, its model calls and every key stay
293
- on the server. An agent says so in its [place](#place); the server says which [boxes](#boxes) it has; [a run in a Docker
316
+ on the server. An agent says so in its [place](#place); the server says which boxes it has (`places.boxes` in its capabilities); [a run in a Docker
294
317
  box](#a-run-in-a-docker-box) is what the container gets; [the box's image](#the-boxs-image) is what it starts from.
295
318
  [Sandbox in 60 seconds](#sandbox-in-60-seconds) is all of it
296
319
  end to end. The [published image](#in-the-published-image) hosts Docker boxes through the host's Docker socket.
@@ -357,7 +380,7 @@ link, and write through a temporary file renamed over the old one, keeping its m
357
380
  says so and names the box's path; `bash`, in the container, can still reach the file. Where this server reaches
358
381
  directories by path (no `/proc/self/fd`, as on macOS), or a box binds nothing, all four run in the container, made on
359
382
  the first of them.
360
- `web_fetch`, `web_search` and the `monid.*` tools stay on this server, and so do
383
+ `web_fetch`, `web_search` and monid's endpoints stay on this server, and so do
361
384
  the run's loop, its log, its model calls and every key. What the server itself files in `work/` (monid's long answers,
362
385
  the browser's evidence) never goes through a link a box's command planted there: each directory is held open on the
363
386
  way (`/proc/self/fd`). On a host without it (macOS), where a link swapped in mid-walk could still turn a write, a sandbox run's `work/` gets none of
@@ -619,7 +642,7 @@ Settings → Computers. The kind says what the agent is given, and the provider
619
642
  |---|---|---|
620
643
  | `none` | The run's folder alone: no computer, and no provider (`{"kind": "none"}`) | |
621
644
  | `sandbox` | A Linux shell, with files and processes | `docker`, `daytona`, `modal`, `e2b` |
622
- | `desktop` | The computer's tools (`computer_observe`, `computer_act`, `computer_screenshot`, `computer_script`), and a shell where its provider mounts the run's folder | `docker` (with an image that has an X server), `e2b`, `orgo`, or [a paired computer](#a-persons-own-computer) by its id |
645
+ | `desktop` | The computer's tools (`computer_observe`, `computer_act`, `computer_screenshot`), the computer as `codemode`'s `computer`, and a shell where its provider mounts the run's folder | `docker` (with an image that has an X server), `e2b`, `orgo`, or [a paired computer](#a-persons-own-computer) by its id |
623
646
  | `phone` | A rented Android, through the same computer tools | `phone-harness` |
624
647
  | `browser` | A hosted browser (the browser tools) | `browserbase`, `kernel` |
625
648
 
@@ -627,12 +650,18 @@ A desktop's and a phone's tools are one set over the computer's groups. With the
627
650
  the app window's elements as compact lines (`@e12 button "Save"`), and `computer_act` runs steps on them by ref (press,
628
651
  set, click, type, key, scroll, drag, nav), each step saying its route and whether a readback verified it, and the answer
629
652
  ending with the window's new state. Without it, observe is a screenshot and act's steps are raw input at its pixels.
630
- `computer_script` runs JavaScript in an isolate in this server, with a typed `computer` object as its only binding (no
631
- network, no keys): a known sequence of steps is one script, and it returns only what the next decision needs. Its
632
- declarations are `spec/computer/computer.d.ts`, generated from `packages/computer/src/surface/api.ts`. On pi, a run
633
- with a desktop or a phone also has pi's code mode (`codemode`), whose scripts call the run's tools and have the same
634
- `computer` bound; the call is held to the kind's setting. In Codex's code mode, a script's call of a computer tool
635
- answers the tool's value as JSON. `computerMcp` (`src/workspace/computer-mcp.ts`) serves the same tools to an MCP
653
+ Scripts are the host's `codemode` (no network, no keys): a known sequence of steps is one script, and it returns only
654
+ what the next decision needs. On a desktop or a phone its script has a typed `computer` object beside `tools`, whose
655
+ declarations codemode's description gives for the computer's groups (`spec/computer/computer.d.ts`, generated from
656
+ `packages/computer/src/surface/api.ts`). Every method of `computer` is a nested call of the script: observe, act and
657
+ the screenshot are the tools of those names, and the rest (apps, the shell, files, processes, raw input) is
658
+ `computer_op` (`{op, args}`), a tool bound for scripts alone. Each call is held to the run's gate and recorded on the
659
+ timeline like a tool's, and a crash rerun of the script answers a call that already ran from its record: a shell
660
+ command (`shell.run`) is held to the agent's `bash` setting, a started process to `bash_background`, a file written to
661
+ `write`, and a file read, listed or looked up to `read`, after the kind's own setting for `computer_op`. A script's call
662
+ of a computer tool answers the tool's value. Codex's code mode takes no binding of ours, so a Codex run is offered
663
+ `computer_op` beside the computer's tools and its scripts call them as nested calls, each answering the tool's value as
664
+ JSON. A run whose `codemode` is set to deny lists them the same way, so its computer stays in reach. `computerMcp` (`src/workspace/computer-mcp.ts`) serves the same tools to an MCP
636
665
  client, each answer with its value as `structuredContent`.
637
666
 
638
667
  A kind with no provider, a provider that does not serve the kind, or a provider whose required keys are not saved is
@@ -672,10 +701,9 @@ computer is made with the GPUs asked.
672
701
  `types: ["H100"]`, `max: 1`); another type or count needs a snapshot of its own, so it is refused. A GPU sandbox is
673
702
  made from that snapshot, with its 16 vCPUs, 100 GiB of memory and 400 GiB of disk, in region `earth`. Stopping it
674
703
  deletes it: it has no pause and no snapshot, so nothing on it outlives the run. A Daytona GPU may be preempted, so a
675
- run on one can be cut short. The Daytona org needs GPU credits. It takes no mount (`mounts: []`: the snapshot's user
676
- is not root and has no Archil client), so it can't hold the run's folder from Archil: in Mode 2 this server refuses a
677
- Daytona sandbox with a `gpu`, and `GET /v2/computers` says why in Daytona's `gpu.why`. In Mode 1 a sandbox runs on
678
- Docker only, so a Daytona GPU sandbox runs on neither mode's server today.
704
+ run on one can be cut short. The Daytona org needs GPU credits. No Daytona sandbox takes an Archil mount, with a GPU
705
+ or without (Archil's client hangs on its sandboxes), so it can't hold the run's folder: Mode 2 refuses it, and in
706
+ Mode 1 a sandbox runs on Docker only, so a Daytona sandbox runs on neither mode's server today.
679
707
  - **Modal** declares its GPUs, but a Modal GPU sandbox runs on gVisor, and the Archil mount the run's folder needs is not
680
708
  proven there. So this server refuses a Modal sandbox with a `gpu` for now. A Modal GPU is also preemptible.
681
709
 
@@ -739,9 +767,16 @@ passes the binding's conformance cases (below) needs no change here.
739
767
  region and that region's S3 URL (and an exec image pinned by digest, if you want one other than serve's default);
740
768
  `DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by digest (git 2.47),
741
769
  because Archil's own has git 2.34 and a read-only bash policy runs git only at 2.43 or later. An image you name needs
742
- git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Daytona, Modal, E2B or Agent37 sandbox mounts
743
- the run's folder from its disk with a mount credential minted for that run alone; Docker's sandbox is refused, since
744
- it cannot mount the disk.
770
+ git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Modal, E2B or Agent37 sandbox
771
+ mounts the run's folder from its disk, which needs Archil's image in your own vendor account. Agent37 puts it there
772
+ itself: its descriptor says `prepareImage`, so a run's first claim registers our public box image as a template of the
773
+ key's workspace (`agentrun-box-<recipe hash>`) and waits once, saying it is pulling. Its sandbox and desktop are
774
+ ready once the keys work. Modal's descriptor says `prepareImage` too, and it answers our public box image by its
775
+ registry tag, which Modal pulls at a computer's first create in a workspace, so a Modal sandbox is ready once the keys
776
+ work. E2B's says `prepareImage` as well, and it answers our public box template by name
777
+ (`<publisher>/agentrun-archil-<recipe hash>`, which the release builds and makes public), with no call, so an E2B
778
+ sandbox and desktop are ready once the key works; the desktop mounts the folder too (it has files and exec). Docker's
779
+ sandbox is refused, since it cannot mount the disk, and so is Daytona's, since Archil's client hangs on its sandboxes.
745
780
 
746
781
  The PUT is a secret write, so it takes the owner's signed-in session. A server with none to give it (API only, or
747
782
  `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
@@ -797,24 +832,22 @@ owner's.
797
832
  - **Later, narrower tokens.** Archil's tokens reach a whole disk; nothing narrower exists today. If Archil ships
798
833
  path-scoped tokens, a run's token narrows from its disk to its own folder with no other change.
799
834
 
800
- **A Daytona computer's snapshot.** The mount runs as root through the image's root helper and its pinned archil client,
801
- so a Daytona computer that mounts the run's folder must start from a snapshot of the computer package's
802
- `box/Dockerfile`; Daytona's default snapshot, whose user is not root, is refused before anything mounts. Build one in
803
- the organization of `DAYTONA_API_KEY` with Daytona's Python SDK (`pip install daytona`), which prints its name, a hash
804
- of the recipe:
835
+ **A Daytona computer's snapshot.** `AGENTRUN_DAYTONA_SNAPSHOT` names the snapshot (its id or name) every Daytona
836
+ computer is made from, as `AGENTRUN_DOCKER_IMAGE` names Docker's image; unset, it is Daytona's default snapshot. One of
837
+ the computer package's `box/Dockerfile` is built in the organization of `DAYTONA_API_KEY` with Daytona's Python SDK
838
+ (`pip install daytona`), which prints its name, a hash of the recipe:
805
839
 
806
840
  ```sh
807
841
  DAYTONA_API_KEY=... python3 packages/computer/box/build-daytona.py # prints snapshot=agentrun-archil-<12 hex>
808
842
  ```
809
843
 
810
- and name it in the server's environment, `AGENTRUN_DAYTONA_SNAPSHOT=agentrun-archil-<12 hex>` (the id or name of any
811
- Daytona snapshot), as `AGENTRUN_DOCKER_IMAGE` names Docker's image. Every Daytona computer is then made from it. Unset,
812
- it is Daytona's default snapshot, as before. A changed recipe is a new name, so build again after an upgrade that
813
- changes `box/`. The [Daytona box](#a-run-in-a-daytona-box) never reads it.
844
+ A Daytona computer takes no Archil mount, so this server never holds a run's folder on one (see Mode 2 above). A
845
+ Daytona [box](#sandbox) never reads it.
814
846
 
815
- A desktop, a phone and a browser run in either mode. The run's folder is at `/workspace` in every computer that mounts
816
- it: a sandbox always, and a desktop whose provider mounts the mode's folder (Docker's in Mode 1, E2B's in Mode 2). A
817
- phone and a browser never mount it.
847
+ A desktop, a phone and a browser run in either mode. The run's folder is at
848
+ `/workspace` in every computer that mounts it: a sandbox always, and a desktop whose provider mounts the mode's folder
849
+ (Docker's in Mode 1, Agent37's and E2B's in Mode 2). A phone and a browser never mount it. On a desktop that mounts it, the
850
+ `shell` group's commands and the programs `processes.start` opens start in `/workspace` too, as `bash` does.
818
851
 
819
852
  **Where `bash` runs.** It follows the mount:
820
853
 
@@ -844,9 +877,12 @@ no computer.
844
877
  registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. From a
845
878
  server in a container the proxy also refuses the Docker host's own addresses, which the server reads through the socket
846
879
  ([in the published image](#in-the-published-image)). A
847
- Daytona, Modal, E2B or Agent37 sandbox has no network of its own (loopback only). A phone and a hosted browser are on their
848
- vendor's own network, whatever the list says. Local Chrome is open unless this server sets `AGENTRUN_BOX_ALLOW`; then
849
- only those hosts (the default list, a sandbox's package registries, is no browsing policy). Under
880
+ Daytona, Modal, E2B or Agent37 sandbox reaches the same list through an egress proxy on the vendor's machine, outside its
881
+ programs' network. An Orgo desktop has no network of its own (loopback only). A desktop (Docker's, Agent37's, E2B's) and
882
+ Local Chrome are open to the public internet, through their egress proxy, unless this server sets `AGENTRUN_BOX_ALLOW`;
883
+ then only those hosts (the default list, a sandbox's package registries, is no browsing policy). Either way the proxy
884
+ refuses private, link-local and metadata addresses. A phone and a hosted browser are on their vendor's own network,
885
+ whatever the list says. Under
850
886
  `AGENTRUN_BOX_ALLOW=none`, each of these is refused at the run's start, in words that name the setting.
851
887
 
852
888
  **Docker.** A Docker computer runs where this server's Docker answers. With `AGENTRUN_BOXES` not set at all (a plain
@@ -875,19 +911,23 @@ its provider's capable everyday model, not its dearest ($2 in and $10 out per mi
875
911
  another. claude-agent takes only the Anthropic one and codex only the OpenAI one. A workflow revision names no model: each model node names a tier (`fast`, `default`
876
912
  or `strong`), and the host maps it, `fast` to `AGENT_MODEL_FAST` and `strong` to `AGENT_MODEL_STRONG`, each falling back
877
913
  to `AGENT_MODEL`. Capabilities show the mapping in `models` (`{source, route_prefix, fast, default, strong}`):
878
- `source` is `gateway`, `providers` or `faux` (the published document marks these as `models/2`, beyond the contract's
879
- `managed`, `chatgpt`, `env` and `faux`), and `route_prefix` is the routing prefix this server puts before a gateway's
914
+ `source` is `gateway`, `providers`, `chatgpt` or `faux` (the published document marks `gateway` and `providers` as
915
+ `models/2`, beyond the contract's `managed`, `chatgpt`, `env` and `faux`), and `route_prefix` is the routing prefix this server puts before a gateway's
880
916
  model ids (`agent-model`), which a client takes off to show the gateway's own id, and null with any other source.
881
917
  `models` also says `ready`, whether a revision that names no model runs here, and when it does not, `needs`: `key` (no
882
- model provider's key, or none for the default's provider) or `model` (`AGENT_MODEL` names one this server does not
918
+ model provider's key and no [ChatGPT sign-in](#on-a-chatgpt-plan), or none for the default's provider) or `model` (`AGENT_MODEL` names one this server does not
883
919
  know); and `priced`, whether that model has a price here, which a run's `max_cost_usd` needs (false for a gateway
884
920
  model with no price set that the catalog does not list in any form; null while `ready` is false, with no model to price). Where the models come from:
885
921
 
886
922
  - `--faux MODULE`: every model is the module's (below), with no key and no network: `faux-1`, or for a tier the model
887
923
  id its variable names.
888
- - `AGENT_MODEL_BASE_URL`: every model id goes to that one OpenAI Responses endpoint, a gateway, at `<base>/v1/responses`
889
- with one trailing `/v1` taken off the base first, as for every harness (OpenRouter's is `https://openrouter.ai/api` or
890
- `https://openrouter.ai/api/v1`): a revision's `provider/model-id` is sent whole, as a gateway like OpenRouter names its
924
+ - `AGENT_MODEL_BASE_URL`: every model id goes to that one gateway, with one trailing `/v1` taken off the base first, as
925
+ for every harness (OpenRouter's is `https://openrouter.ai/api` or `https://openrouter.ai/api/v1`): a Claude model on
926
+ Anthropic's Messages API at `<base>/v1/messages`, where pi marks its prompt for Anthropic's cache (the Responses API
927
+ carries no cache mark, so a gateway's bridge from it reads none), and every other model on OpenAI's Responses API at
928
+ `<base>/v1/responses`. A model is Claude's when its id names Anthropic as its vendor (`anthropic/claude-sonnet-5.5`)
929
+ or names none and pi-ai's catalog lists it under Anthropic (`claude-opus-5-5`); the gateway serves both APIs, as
930
+ LiteLLM's proxy and OpenRouter do, with `AGENT_MODEL_API_KEY` as a bearer token on either. A revision's `provider/model-id` is sent whole, as a gateway like OpenRouter names its
891
931
  models `vendor/model`, and `AGENT_MODEL`, `AGENT_MODEL_FAST` and `AGENT_MODEL_STRONG` are sent as they are. For a
892
932
  gateway that wants the id alone, `AGENT_MODEL_GATEWAY_IDS=bare` sends a revision's model without its provider. `AGENT_MODEL_API_KEY` is its key when it needs one. `AGENT_MODEL_PRICE` is `input,output,cacheRead[,cacheWrite]`
893
933
  in USD per million tokens, so a run's cost estimate has a price; `AGENT_MODEL_FAST_PRICE` and `AGENT_MODEL_STRONG_PRICE`
@@ -906,6 +946,8 @@ model with no price set that the catalog does not list in any form; null while `
906
946
  gets that as a warning. One
907
947
  without a cap runs, on every harness, with each request's cost unknown: codex's and opencode's proxy books it unknown,
908
948
  never $0, so the run's `cost.usd` is `null` and `/usage` counts it in `unpriced_runs`.
949
+ - A ChatGPT plan signed in here ([below](#on-a-chatgpt-plan)), with no provider's key: `source` is `chatgpt`, and pi
950
+ and codex run on the plan's models (`chatgpt/<model-id>`) with no key.
909
951
  - Otherwise pi-ai's providers serve them, each with its key from the environment (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
910
952
  `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, Bedrock's `AWS_*` keys, ...), and its catalog prices the run. The `AGENT_MODEL`
911
953
  variables are then `provider/model-id` too. The launcher holds every key pi-ai reads, as it holds the rest, and a run's
@@ -940,6 +982,52 @@ above the harness's highest runs at that highest (Codex and OpenCode stop at `xh
940
982
  (`src/effort-guidance.ts`): `low` answers directly, `medium` plans briefly and checks once, `high` plans each part, fills
941
983
  the gaps and reviews. A run with no level, or one above `high`, gets no note.
942
984
 
985
+ ### On a ChatGPT plan
986
+
987
+ A server needs no model key to start, on any of its deploys. With none, capabilities say `models.ready: false` and
988
+ `needs: "key"`, and each harness's `reason` names the keys it takes. Codex's and pi's add "or sign in with ChatGPT
989
+ (Settings → Model keys) to run it on your ChatGPT plan" (after an expiry: "your ChatGPT sign-in expired: sign in again
990
+ (Settings → Model keys)"), and their entries say `needs: ["key", "chatgpt"]`; Claude Agent's and OpenCode's say
991
+ `needs: ["key"]`. The console's first screen then offers **Continue with ChatGPT** beside **Add a key** (also under
992
+ Settings → Model keys), and its "What runs here" reads `needs`: Codex and pi "run after Continue with ChatGPT". The owner
993
+ signs in with their ChatGPT plan, and pi and codex run on it with no key. Claude Agent, OpenCode, Jev decisions and paid
994
+ tools still need their own keys.
995
+
996
+ The sign-in is the owner's alone, over the owner's signed-in session (the API token gets `403`, as for every secret):
997
+
998
+ - `POST /v2/settings/chatgpt/sign-in` answers `authorize_url`, OpenAI's sign-in page, and `expires_at`: one sign-in
999
+ waits at a time, for 10 minutes, and starting again replaces it. Where the browser and the server share a computer
1000
+ (`npx @parcha/agentrun`), it finishes by itself. On a server that isn't this computer (Render, a container), the
1001
+ sign-in tab ends on a page that won't load: copy its whole address into the console, which sends it as
1002
+ `POST /v2/settings/chatgpt/sign-in/finish` `{"redirect_url": "..."}`.
1003
+ - `GET /v2/settings/chatgpt` says `state`: `signed_out`, `pending` (with `authorize_url` and `expires_at`), `signed_in`
1004
+ (with `email`, `plan` and the plan's `models`) or `expired`.
1005
+ - `DELETE /v2/settings/chatgpt` signs out: it removes the sign-in here and revokes it at OpenAI, and answers
1006
+ `{"revoked": true}` when OpenAI confirmed it (or nothing was signed in, as when it only cancels a waiting sign-in).
1007
+ When OpenAI didn't confirm it, the answer is `{"revoked": false, "message": "Signed out here. OpenAI didn't confirm
1008
+ the revocation: remove AgentRun in your ChatGPT settings."}`. Signing in again revokes the sign-in it replaces, and a
1009
+ renewal that finishes after a sign-out revokes the tokens it got.
1010
+
1011
+ A curl call with the owner's session (the console's cookie: `__Host-agentrun-session` on https) sends this server's own
1012
+ `origin` and `content-type: application/json` on every write, a `DELETE` with no body too: without them the cookie
1013
+ does not count, and the server answers `401` ([the console](#the-console)).
1014
+
1015
+ ```sh
1016
+ S=(-H "cookie: __Host-agentrun-session=$SESSION" -H "origin: $BASE" -H 'content-type: application/json')
1017
+ curl -X POST "$BASE/v2/settings/chatgpt/sign-in" "${S[@]}"
1018
+ curl -X POST "$BASE/v2/settings/chatgpt/sign-in/finish" "${S[@]}" -d '{"redirect_url":"<the address the sign-in tab ended on>"}'
1019
+ curl "$BASE/v2/settings/chatgpt" "${S[@]}"
1020
+ curl -X DELETE "$BASE/v2/settings/chatgpt" "${S[@]}" # 200 {"revoked": true}, or {"revoked": false, "message": "..."}
1021
+ ```
1022
+
1023
+ The sign-in is sealed in the store under the seal key, like a saved key. Any process that holds the store and the seal
1024
+ key (the server, each runner) renews the sign-in, so it is as trusted as the server; the seal key already opens every
1025
+ sealed key. Signed in, with no provider's key, capabilities
1026
+ say `models.source: "chatgpt"` and a revision that names no model runs on `chatgpt/gpt-6.1-sol` where the plan lists it.
1027
+ A run on the plan books its tokens and no dollars (`cost.plan`). Eligible usage in this app uses your ChatGPT plan.
1028
+ Manage usage in your ChatGPT settings. A sign-in is for the person who runs this server: don't share it or let others
1029
+ run agents on it.
1030
+
943
1031
  ## Tools
944
1032
 
945
1033
  A revision names its tools from one closed table (`src/tools.ts`): each name is how the run's process binds it and the
@@ -965,12 +1053,10 @@ agent_not_runnable`, with `details.unbound` and `details.missing`).
965
1053
  | `web_fetch` | Read one web page from a public host through the guarded direct fetch, or through Parallel's extract where Parallel is picked ([search and fetch](#search-and-fetch)), a part at a time: `{url, offset?, max_chars?}` in, a Page out, `{ok, url, status, title, text, chars, truncated?, original_chars?, beyond_read?, offset?, next_offset?, html_chars?, converted?, links, links_omitted?, via, parallel?, refused?, error?}` | nothing (`PARALLEL_API_KEY` for Parallel, one billed extract a page a run) | yes, yes |
966
1054
  | `web_search` | Search the web, natively where the harness or the model's provider can, else through Parallel where the server holds its key, else keyless through Exa, or through the provider picked ([search and fetch](#search-and-fetch)): `{query, n?}` in, `{provider, query, results: [{url, title, snippet, published?}], text?}` or `{error}` out | nothing (`PARALLEL_API_KEY` for Parallel) | yes, yes |
967
1055
  | `browser` | A hosted browser, Browserbase's or Kernel's, on pi-browser's durable adapter: `snapshot`, `run`, `screenshot`, `browser_read`, `browser_release`, `browser_relaunch`, `browser_downloads` and `browser_upload` (into and from the run's `work/`); Kernel keeps no downloads, so a run on Kernel has no `browser_downloads` | `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`, or `KERNEL_API_KEY` | yes, no |
968
- | `monid.discover` | Search monid's catalog of paid data endpoints in plain words: `{query, limit?, minScore?}` in, `{results: [{provider, endpoint, description, score, price}]}` out | `MONID_API_KEY` | no, no |
969
- | `monid.inspect` | One monid endpoint before it runs: `{provider, endpoint}` in, the JSON Schemas of its input (`pathParams`, `queryParams`, `body`), its price, notes and documentation out | `MONID_API_KEY` | no, no |
970
- | `monid.run` | Run one monid endpoint, paid per call from the monid wallet: `{provider, endpoint, input}` in, the run's `output`, `price` and `cost` out | `MONID_API_KEY` | no, no |
1056
+ | `monid:<provider>/<endpoint>`, `monid:<provider>/*` | One monid endpoint, or every endpoint monid lists for a provider (at most 50), each pinned at the save and run as a tool of its own, paid per call from the monid wallet: `{body?, queryParams?, pathParams?}` in, the run's `output`, `price` and `cost` out ([monid](#monid)) | `MONID_API_KEY` | no, no |
971
1057
  | `pdf_pages` | A workflow call only: `{path, maxPages?, dpi?}` in, `{name, pageCount, dpi, pages: [{page, image}], text}` out. Draws a document's first pages (3 by default, at 110 dpi) as PNGs under the run's `work/pages/<stem>/<dpi>/` (`<stem>`: the document's path below its directory made one name, with a short hash, so two documents of one file name never share pages), the dpi lowered so a page's long side is at most 1568 px, with its text (`pdftotext`, cut at 20,000 characters). A PNG or JPEG passes through as one page, scaled down to 1568 px. `path` is under `--documents` or the run's `work/`, never outside | `pdftoppm`, `pdftotext` | no, yes |
972
1058
  | `llm` | A workflow call only: `{prompt, system?, maxTokens?, tier?}` in, `{text, model, usage, cost_usd}` out. One completion on the run's model of the tier (`default`; a tier the state fills in, such as `"{requestedTier}"`, may be any of the three, and a tier with no model fails the call), no tools and no loop; `cost_usd` is null when the model has no price, never 0 | a model | no, yes |
973
- | `subagent` | pi only: `{prompt, tools?, model?, max_tool_calls?, effort?}` in, the child's last text out, bounded like a host tool's result. Runs a fresh conversation whose whole task is `prompt`, with `tools` a subset of the agent's own (by catalog or session name, MCP tools and `bash` included; absent, none), on the agent's own model or the tier `model` names (`fast` or `strong`: the definition's `model_tiers`, else `AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`, else the agent's own model) ([subagents](#subagents)) | a pi run | no, no |
1059
+ | `subagent` | pi only: `{prompt, tools?, model?, effort?}` in, the child's last text out, bounded like a host tool's result. Runs a fresh conversation whose whole task is `prompt`, with `tools` a subset of the agent's own (by catalog or session name, MCP tools and `bash` included; absent, none), on the agent's own model or the tier `model` names (`fast` or `strong`: the definition's `model_tiers`, else `AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`, else the agent's own model) ([subagents](#subagents)) | a pi run | no, no |
974
1060
 
975
1061
  `bash` and the background tools run only in a box: a runner agent, and a workflow, get no shell on this machine (see [Safety](#safety)). In a
976
1062
  sandbox place `read`, `write` and `edit` run in the box too.
@@ -995,8 +1081,11 @@ length, and no `original_chars`, its text is the start of the page, and the last
995
1081
  1,000,000 characters of HTML before reading; the rest wasn't read.` `converted: "text"` says the text is the page's
996
1082
  plain text, its conversion to markdown having run out of time. A page is read to its first 1,000,000 characters: an
997
1083
  `offset` at or past them is refused, and the last part a read reaches of a longer page has `beyond_read`. The links,
998
- absolute http(s) only, come with the part at offset 0: at most 200, in 20,000 characters, with `links_omitted`
999
- counting those left out. A page is fetched once a run, at the first call for its URL, through either provider, and the
1084
+ absolute http(s) only, each once without its fragment, are the page's link targets and the URLs written out in its
1085
+ text (a JSON body's: those of its string values, so an API's `url` or `shortlink` field is one; an XML body's, an Atom
1086
+ or RSS feed's, read with its entities undone, so an entry's `<link href>` is one); an HTML page fetched
1087
+ directly gives its link targets alone. They come with the part at offset 0: at most 200, in 20,000 characters, with
1088
+ `links_omitted` counting those left out. A page is fetched once a run, at the first call for its URL, through either provider, and the
1000
1089
  run keeps what it read of its last 8 pages by the URL asked for: every later part of that URL comes from it, with no
1001
1090
  request, so a page's parts are always one read's. Through Parallel that is one billed extract a page a run, asked for
1002
1091
  its first 1,000,001 characters (the extract has no offset: its text always starts at the page's start). A refusal or a
@@ -1013,6 +1102,44 @@ to read it, which a run's confinement refuses, Codex keeps only the ends of a re
1013
1102
  would cut one past 2,000 lines or 51,200 bytes and save the rest to a file the session has no tool to read. A
1014
1103
  `web_search` answer past 100,000 characters leaves out its least relevant results, `omitted` counting them.
1015
1104
 
1105
+ ### Finding and calling the run's tools
1106
+
1107
+ A run lists every tool to the model in full until its catalog tools (an MCP server's, a monid one) pass 20
1108
+ (`DEFER_CATALOG_OVER`, `defersCatalog` in the kernel). Then they are deferred: not listed, found with `tools_search` and
1109
+ run with `tools_call` (built-ins and pi's own tools are always listed). Under 20, there is no search or call: they
1110
+ would find tools the model already has, at about 640 tokens on every request. Claude Code defers MCP tools itself (its
1111
+ ToolSearch), so it is offered neither of the two; Codex has them and keeps its own code mode. The server makes one
1112
+ decision for every harness (`SessionSpec.deferCatalog`: past 20, with both `tools_search` and `tools_call` allowed), and
1113
+ Claude Code's adapter turns its ToolSearch on exactly then (`ENABLE_TOOL_SEARCH`, `claudeToolSearch`). `codemode` is
1114
+ offered on every run (not Codex). Each of the three has a tool-settings key of its own, allow by default: set to `deny`,
1115
+ it is not offered at all, and a call to it is refused. A deny of `tools_search` or `tools_call` therefore lists every
1116
+ tool in full, on Claude Code too, where its ToolSearch is off. Settings → Tools lists the three (in
1117
+ `capabilities.tools` with `meta: true`), each allow or deny; no agent grants them, so the agent editor does not offer
1118
+ them. None of them goes around the run's tool settings:
1119
+
1120
+ - `tools_search {query, limit?}` ranks the run's tools by what they do and answers each match's name, description and
1121
+ input schema (8 by default, at most 25). It finds only tools the run may call: never one set to deny, and never these
1122
+ three.
1123
+ - `tools_call {name, args}` calls one of the run's tools by name. The call is the tool's own: it is asked about at the
1124
+ gate by that tool's name, and recorded and booked under `<callId>/call`. An ask parks the run, a deny refuses it in
1125
+ the gate's words, and a name the run has no tool by (or one of these three) is refused in words with nothing run.
1126
+ - `codemode {script}` runs a JavaScript script (the body of an async function) in a QuickJS sandbox. Its
1127
+ `await tools.<name>(args)` calls are each the tool's own call, under `<callId>/s<n>`, answered one at a time. A tool is
1128
+ named as `ALL_TOOLS` gives it; the description shows the first three (`tools.<name>`) and says to leave off the prefix
1129
+ a harness shows in the model's own tool list (`hands_`, `mcp__hands__`). The
1130
+ sandbox has the tools and nothing else of the run: no environment, key, file, network or timer. A tool's image (a
1131
+ screenshot) reaches the script with its pixels: `image(shot)` shows it to the model, and a returned one is the
1132
+ answer's image, its data never in the answer's text. A script runs at most
1133
+ 10 minutes in 256 MiB. A call that needs approval parks the run, and the script follows Codex's rule. Once a person
1134
+ answers, the script runs again from its start, and the calls it already made answer from their records. The parked
1135
+ call runs once (or is refused), its outcome is the script's answer, and the rest of the script does not run. The
1136
+ answer lists each call before it with its result as the script read it: a JSON value as itself, never quoted. A
1137
+ refused call ends the script with the refusal. A call cut off by a crash is told as possibly done and never run again.
1138
+
1139
+ A paid call made through `tools_call` or a script is held at its price before it is sent and settled once, as a direct
1140
+ call is, so the cap holds it. A run with a desktop or a phone has this same `codemode`, its computer's tools among
1141
+ the ones a script calls (see [Computers](#computers)).
1142
+
1016
1143
  ### Subagents
1017
1144
 
1018
1145
  `subagent` is one primitive: a prompt, a fresh context and a subset of the agent's own tools, on the agent's own model
@@ -1022,10 +1149,8 @@ given `subagent` or `ask_person`), and at most 4 children of a run work at once;
1022
1149
  child under its call, and the run's cost counts every child's requests. How to split work and merge answers is the
1023
1150
  agent's own instructions, never the engine's.
1024
1151
 
1025
- A call may set its child's `max_tool_calls` and `effort`. `max_tool_calls` narrows the agent's own budget (its definition's
1026
- `max_tool_calls`, which holds each conversation) for that child and never widens it; with no budget of the agent's, the
1027
- call's holds. `effort` (`low`, `medium` or `high`) is the child's thinking level; absent, the child thinks as the agent
1028
- does. So one template can run wide reviewers at `medium` with 30 calls and deep ones at `high` with 90.
1152
+ A call may set its child's `effort` (`low`, `medium` or `high`), its thinking level; absent, the child thinks as the agent
1153
+ does. So one template can run wide reviewers at `medium` and deep ones at `high`. The run's cap bounds every child's work.
1029
1154
 
1030
1155
  A child is a conversation in the run's own journal, owned by its call, so it lives and ends with the run:
1031
1156
 
@@ -1119,7 +1244,7 @@ A workflow's tools are those its revision lists and those its model and call nod
1119
1244
 
1120
1245
  Upgrading to the tool gate: a workflow whose call node's tool is set to ask, by a setting or a default, now refuses its
1121
1246
  run (`409` with `details.asks`); set that tool to allow for the agent (`definition.tool_settings`). Built-in tools are
1122
- allowed by default; catalog (`monid.*`) and MCP tools, which ask by default, are no call node's tools here.
1247
+ allowed by default; catalog (`monid:<provider>/<endpoint>`) and MCP tools, which ask by default, are no call node's tools here.
1123
1248
 
1124
1249
  Upgrading: a server holding `PARALLEL_API_KEY` used to read every `web_fetch` page through Parallel's extract on its own.
1125
1250
  Now `web_fetch` is the guarded direct fetch unless Parallel is picked; to keep the old behaviour, set
@@ -1190,7 +1315,9 @@ Keyless Exa, where `web_search` resolves to it, searches through Exa's public MC
1190
1315
  the search query (cut at 200 characters) and the number of results asked for (1 to 8, 5 by default), nothing else
1191
1316
  from the run, and no key. It goes to Exa over IPv4, straight from the run's process. Exa is a third party: its free,
1192
1317
  keyless use has a rate limit it does not publish, and its own terms. Past that limit the search is tried once more, and
1193
- then is a tool error in our words (above): the model reads why and answers without it. A search ends at 60 s, its retry
1318
+ then is a tool error in our words (above): the model reads why and answers without it, and the run's later searches
1319
+ are held for the wait. Exa answers its daily count running out the same way, naming no wait, so a second limit naming no
1320
+ wait after a wait has passed (a 429 with Retry-After is a timed limit, and only waits), in the same run and with no search succeeding since, turns search off for the rest of that run. A search ends at 60 s, its retry
1194
1321
  included, so a call never hangs. The answer is the query and its results, each a URL, a title, a
1195
1322
  snippet of at most 3,000 characters and its date when Exa knows it, then a line asking the model to cite the URLs it
1196
1323
  relies on. Keyless Exa is the default for a harness with no native search when the server holds no Parallel key; `off`
@@ -1380,36 +1507,60 @@ picks which one a run gets, never the model.
1380
1507
  sign-in a forget finds. It is kept only so a later server still cuts it from what a run that was handed it said: one
1381
1508
  that ended before the forget, or one opened again since on a new sign-in. Archiving an agent keeps its sign-ins; this server has no route that deletes an agent.
1382
1509
 
1383
- `monid.discover`, `monid.inspect` and `monid.run` give an agent [monid](https://monid.ai)'s whole catalog of data
1384
- endpoints on one key, `MONID_API_KEY`: it finds an endpoint in plain words, reads its input schemas and price, and runs
1385
- it. Each run is paid per call from the monid workspace's wallet, and is sent once, never retried. An async provider's
1510
+ <a id="monid"></a>
1511
+ An agent is granted [monid](https://monid.ai)'s data endpoints on one key, `MONID_API_KEY`, by name:
1512
+ `monid:<provider>/<endpoint>` (one, such as `monid:apollo/people/match`) or `monid:<provider>/*` (every endpoint monid
1513
+ lists for the provider, at most 50). Each grant is read against monid's listing when the agent is saved, and pinned on
1514
+ that revision with the endpoint's description, its input schema (`pathParams`, `queryParams`, `body`) and its price; a
1515
+ provider or endpoint monid does not list, or a grant saved with no monid key, is refused at the save in words. An
1516
+ endpoint monid prices by usage (per result, per unit, metered, or a matrix or tier with a usage part) is pinned too,
1517
+ named or from a wildcard, and the save's `warnings` name each one (`reason` `priced_by_usage`): "monid:<provider>/<endpoint>
1518
+ is priced by usage: monid can't cap what it charges, so a call can cost more than its estimate and more than the run's
1519
+ cap allows." What one such call costs is known only after it has run, and monid's `maxCost` checks only its estimate,
1520
+ which such a call can pass. Which endpoints an agent may call is the control: grant them by name or by provider, and
1521
+ set each to deny or ask in tool settings. An edit pins again. A workflow's nodes do not bind monid endpoints yet. Each pinned endpoint is a tool of its own on every
1522
+ harness, named on the wire with `__` for `:` and `/` (`monid__apollo__people__match`), asked about by default, and set by
1523
+ its own name or its provider's wildcard in tool settings.
1524
+ Each run is paid per call from the monid workspace's wallet, and is sent once, never retried. An async provider's
1386
1525
  run is read until it ends, about two minutes at most, and asked to stop at monid when the run stops or it outlasts that.
1387
1526
  A refusal comes back as `{error, status?}` in words: the wallet too low (402), a workspace control such as its budget
1388
1527
  (`BLOCKED`), `FAILED`, `TIMED_OUT`, the provider's own error (not charged). The model reads each answer as JSON cut at
1389
1528
  60,000 characters, the whole of it then filed under the run's `work/evidence/monid/`. An answer carries what monid
1390
1529
  charged (`cost`, in dollars), and that charge is the run's spend: booked once in the run's own records as a tool cost
1391
- (`agentrun.tool_cost`: `tool` `monid.run`, `charged_by` `"monid"`, `usd`), shown in its timeline on a line of its own
1392
- (`Tool cost: monid charged $0.0030 for monid.run`) and summed into its cost, the total its [spend cap](#spend-cap)
1393
- reads, and `/usage` grouped by meter shows it as its own meter, `tools`, apart from `tokens`. Each run is marked in the
1394
- run's records before it is sent, held at the price an earlier `monid.inspect` of the run quoted for that endpoint, else
1395
- at an allowance of $1; its charge settles the mark. A mark a crash left unsettled leaves the run's cost unknown, as a
1530
+ (`agentrun.tool_cost`: `tool` the endpoint's name, `charged_by` `"monid"`, `usd`), shown in its timeline on a line of its
1531
+ own (`Tool cost: monid charged $0.0260 for monid:apollo/people/match`) and summed into its cost, the total its
1532
+ [spend cap](#spend-cap) reads, and `/usage` grouped by meter shows it as its own meter, `tools`, apart from `tokens`.
1533
+ Each run is marked in the run's records before it is sent, held at its pinned price (a per-call price; the dearest
1534
+ variant of a matrix; a tiered price's default and every tier), and its approval card shows that hold; its charge
1535
+ settles the mark. It is sent with that hold as monid's `maxCost`, so an endpoint monid prices higher now than when the
1536
+ agent was saved is refused by monid unrun and uncharged, never booked past its hold. Once the cap lets it go, its
1537
+ price is read again from monid (an inspect, which monid does not charge). One monid has moved to usage pricing since
1538
+ the save is still held and sent at its pinned price, so monid runs it only at an estimate within it; its charge can
1539
+ pass it (below). A call of an endpoint pinned as priced by usage is held at monid's estimate for the call's own input
1540
+ instead. Its approval card reads "Priced by usage: monid estimates the cost when the call runs, and can charge more."
1541
+ (`pending.price` `"priced by usage"`), and monid is sent nothing while the call waits. Once the call may run (after
1542
+ the person's allow, or at once when it needs no ask), the call is first sent with `maxCost` 0, which monid refuses unrun
1543
+ and uncharged, naming its estimate; that estimate is the hold, and the call is sent with it as `maxCost`. That read is
1544
+ itself a paid step of the call, marked at $0 on the run's ledger before it is sent (a crash while monid holds it leaves
1545
+ its charge unknown, as any cut call's) and given back when monid refused it unrun; a read monid ran (an estimate of $0,
1546
+ which `maxCost` 0 lets through) is the call, settled at its charge. Under a cap, a read that ends with its charge unknown
1547
+ (no answer, or `FAILED` with no cost) stops the run at once, "monid may have charged for <name> and did not say how
1548
+ much, so this run's cap can't be kept; the run stopped": its $0 hold bounds nothing. Its charge can pass the estimate: then it is booked
1549
+ as charged, and the run stops at once, failed, in the words "monid charged $X, more than the $Y held; the run stopped".
1550
+ A run's spend cap is a hard stop for everything but that one charge. A mark a crash left unsettled leaves the run's cost unknown, as a
1396
1551
  model request a crash cut does, and its cap counts it at its held figure, never $0. A run that may have charged and says
1397
1552
  no cost (`FAILED`, `TIMED_OUT`, one stopped by the run or the wait, one whose sending failed) books an unknown charge,
1398
1553
  never $0: the run's cost reads `null`, and under a cap it counts at its held figure, the bound the cap let it go at, as
1399
1554
  a crash-cut mark does, so the run goes on while its cap allows, in its process and in one opened again from its store;
1400
1555
  one monid says it did not charge (refused as sent, `BLOCKED`, `STOPPED`, the provider's error) books nothing. Under a
1401
- cap, each `monid.run` is held as a model request is: unless what the run has spent plus what the run is held at (the
1402
- price an inspect quoted, else the $1 allowance) fits its `max_cost_usd`, or when the spend is unknown, the call is
1403
- refused with a `spend_cap_reached` error the model reads, naming its price and the cap (and, when the allowance was
1404
- used, that `monid.inspect` gives a quote), and monid is never called. Runs go one at a time under a cap, and on
1556
+ cap, each endpoint's call is held as a model request is: unless what the run has spent plus what the call is held at
1557
+ fits its `max_cost_usd`, or when the spend is unknown, the call is refused with a `spend_cap_reached` error the model
1558
+ reads, naming the endpoint, its hold and the cap, the run pauses on its cap, and the call is never sent (one priced by usage has had only its estimate read). Runs go one at a time under a cap, and on
1405
1559
  claude-agent and codex the check holds each model request still in flight at its worst case. A run sent holds its
1406
1560
  figure until its charge is in, on every harness: a model request checked meanwhile counts it beside what the run has
1407
- spent, and a run that fails without an answer counts at it. `discover` and `inspect`
1408
- cost nothing and are never refused. They run on every harness: pi binds them, and claude-agent and codex call them as
1409
- host tools in the run's process, where a `monid.run` call a crash cut off is answered interrupted, never sent again
1410
- (`discover` and `inspect` may run again). On each, the model, the call's journal and the run's timeline name them
1411
- `monid_discover`, `monid_inspect` and `monid_run`: a model API takes no dot in a tool's name. The key is a secret like
1412
- the model keys: a run's process gets it over its pipe, never in its environment.
1561
+ spent, and a run that fails without an answer counts at it. Every harness calls an endpoint as a host tool in the run's
1562
+ process, where a call a crash cut off is answered interrupted, never sent again. The key is a secret like the model
1563
+ keys: a run's process gets it over its pipe, never in its environment.
1413
1564
 
1414
1565
  ## Tool keys
1415
1566
 
@@ -1517,7 +1668,9 @@ out an action it was allowed (it did for `HACKERNEWS_GET_FRONTPAGE`), so the ans
1517
1668
  action the saved server doesn't list. Both routes are the owner's
1518
1669
  session alone, and a saved Composio server is gated, approved and shown on the Timeline as any MCP server's tools are,
1519
1670
  "not metered" until you price them. Composio's own meta tools stay refused, and the helper actions that connect an
1520
- account are left off the server's address.
1671
+ account are left off the server's address. Deleting the server in Settings deletes the Composio MCP server it made too, with the saved key (Composio's "already gone" is fine); if Composio refuses or does not answer, the server is still forgotten here, and the `DELETE` answers `200 {deleted: true, composio: {removed: false, note}}` saying what to remove in Composio yourself, which the console shows.
1672
+ [Connect Composio tools and triggers](../../docs/tutorials/composio.md) walks through the preset and a Composio
1673
+ trigger in the console, with each step's API call.
1521
1674
 
1522
1675
  What can go wrong, told apart:
1523
1676
 
@@ -1541,6 +1694,14 @@ data directory's store, which holds no value in the clear. The server does not s
1541
1694
  sends no `token` (or no `headers`) keeps the sealed credential, as long as the auth type and the URL's origin stay the
1542
1695
  same: a saved credential never goes to another origin unless you send it again.
1543
1696
 
1697
+ Each saved server records where its tools come from, `source` and `toolkit`, which a template's `mcp` needs are matched
1698
+ on at apply ([templates](templates/README.md#agentmd)). The source is what made the server, recorded when it is saved
1699
+ and never read off its address or its name: the Composio preset records `composio` and its toolkit, a `github_app`
1700
+ server is `github`/`github`, and any other is `url` with no toolkit until you set one (`toolkit` in the `PUT`, in
1701
+ `POST .../oauth/start` for a server you sign in to, or Settings → MCP servers). A `PUT` with no `toolkit` keeps the
1702
+ record, and `DELETE` removes it with the server. A record counts only for the server it was saved with: a server saved
1703
+ again under the same name after a `DELETE` starts afresh.
1704
+
1544
1705
  `GET /v2/settings/mcp-servers` and `GET .../{name}` show each server with `credential`: `sealed`, `unreadable` (sealed
1545
1706
  under another key, or damaged: a `PUT` with the credential seals it again) or `expired` (an OAuth sign-in whose refresh
1546
1707
  its authorization server refused: sign in again), null for `auth.type` none. No read, log line or error shows a
@@ -1639,11 +1800,18 @@ method, tool and whether an `Authorization` header came, never its value.
1639
1800
  ### Agents call a server's tools
1640
1801
 
1641
1802
  An agent grants a saved server's tool by its catalog name, `mcp:<server>/<tool>`, in `definition.tools`
1642
- (`"tools": ["mcp:github/list_issues"]`). A save checks each one against the server's saved tools: a server that is not
1643
- saved, or a tool it did not list, is `422` naming the server's tools, and so is a name whose wire name,
1644
- `mcp__<server>__<tool>`, is over 52 characters, or a tool whose `x-mcp-header` declaration cannot be sent (on a
1645
- property not reached through `properties` alone, not a string, integer or boolean, not a header name, or declared twice). pi, claude-agent and codex run them (`features.mcp_client.harnesses`); on
1646
- another harness the save warns that they are not bound there yet, and a run is refused. A workflow's nodes bind no MCP
1803
+ (`"tools": ["mcp:github/list_issues"]`). A save lists each server it grants a tool of, once, and checks each grant
1804
+ against that listing: a server that is not saved, or can't be listed right now, is `422` naming it ("save again once it
1805
+ answers"; an edit that grants nothing new from it keeps the agent's current pin for it instead), a tool it does not list
1806
+ is `422` naming the server's tools, and so is a tool whose `x-mcp-header` declaration cannot be sent (on a
1807
+ property not reached through `properties` alone, not a string, integer or boolean, not a header name, or declared twice).
1808
+ A harness calls a tool `mcp__<server>__<tool>`; one whose name is past the 52 characters every harness's tool names
1809
+ share (Composio's `SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION` on a server `slack`) is called by that name cut to
1810
+ fit with a hash of its catalog name after it, and its rows, settings and approvals still name it `mcp:<server>/<tool>`.
1811
+ Two grants that would be called by one such name are `422`, naming both. pi, claude-agent and codex run them (`features.mcp_client.harnesses`); on
1812
+ another harness the save warns that they are not bound there yet, and a run is refused. On claude-agent, a run with MCP
1813
+ tools has the Claude CLI's own tool search on: the server's tools reach the model only once its ToolSearch finds them,
1814
+ and the run's other tools load as they always do. A workflow's nodes bind no MCP
1647
1815
  tool yet: a workflow that grants one, in its `tools` or on a node, is `422` ("a workflow's nodes don't bind MCP tools
1648
1816
  here yet; grant it to an agentic agent").
1649
1817
 
@@ -1657,28 +1825,29 @@ action it runs and deny could target none. Reads mark it `grantable: false` with
1657
1825
  `details.not_grantable` (each with its `tool` and `reason`), and a run that pinned one before is refused at its launch. Use the server's direct tools instead:
1658
1826
  each of these providers has a direct mode. The list is closed: a meta tool it doesn't know is an MCP tool like any other,
1659
1827
  asked by default.
1660
-
1661
- - **Pinned.** A run's first launch keeps each granted tool as the server listed it when you saved it (its description
1662
- and schema) and the server's URL then, in the run's directory (`mcp-tools.json`). A refresh or a new save never
1663
- changes a running agent's tools. If the server's URL has changed since, that run's calls answer "the server's
1828
+ A saved server's read also gives each tool its `grant_problems` when a grant of it is refused where it would run, in the words the
1829
+ save's `422` says, under a harness id when that harness's own MCP client would drop or retype its schema.
1830
+
1831
+ - **Pinned.** The save keeps each granted tool on the new revision as the server listed it then (its name,
1832
+ description, input schema, annotations and price) with the server's URL then, shown as the agent's `mcp_pin` (never
1833
+ the URL); each run of that revision calls those tools, and no run lists the server. A refresh never changes a
1834
+ revision's tools; saving the agent again re-pins (an unchanged definition whose server changed a granted
1835
+ tool is a new revision). A server that keeps no credential of its own (`per_run`), or an OAuth server, that refuses the
1836
+ save's listing for its credential is pinned as its last save or refresh listed it. If the server's URL has changed since, that run's calls answer "the server's
1664
1837
  address changed since this run started" and nothing is sent, the new credential least of all.
1665
1838
  - **The credential.** A run whose revision grants a server's tool is handed that server's credential at each launch
1666
1839
  (so a new one counts at the next), over its secrets pipe, never its environment; a run that grants none of a
1667
1840
  server's tools gets none of it. It stays in the run's process: no harness's CLI, file or log holds it, and a run
1668
1841
  that writes it into a learned note is refused by the secret scan.
1669
- - **pi** binds each granted tool in the run's process as `mcp__<server>__<tool>`, with the pinned description and
1670
- schema, and calls the server from there.
1671
- - **claude-agent** uses the Claude CLI's own MCP client: one HTTP server entry per granted server at the session's
1672
- model proxy, `/mcp/<server>`, behind the session's key, sent over the CLI's stdin (never its arguments), with only
1673
- those servers (`strictMcpConfig`) and only the granted tools allowed. The proxy answers the MCP exchange itself and
1674
- makes the call with the credential. The CLI's tool search is off in such a session, so the granted tools are
1675
- offered whole. The proxy answers the handshake and the tool list itself, so a remote server that can't be reached
1676
- shows at the first call, as that call's error; only a proxy route the CLI can't connect to fails the turn.
1677
- - **codex** uses Codex's own MCP client the same way: the harness writes each granted server in Codex's
1678
- `mcp_servers` (an agent's own `config` still may not), at the session's model proxy with the session's key, with
1679
- only the granted tools enabled. Each call runs without Codex asking (`default_tools_approval_mode = "approve"`): the
1680
- proxy is the gate. Codex sends a call as soon as it starts it, so the proxy records the call in the session before
1681
- it sends anything. Each server is `required`, but the proxy answers its handshake, so a remote server that can't be reached shows at the first call, as that call's error; only a proxy route Codex can't reach fails the turn. A tool whose schema Codex would drop or retype (a `not`, `patternProperties`, ...) is `422` at the save, naming the place and why.
1842
+ - **Every harness** gets each granted tool as a host tool, `mcp__<server>__<tool>`, with the pinned description and
1843
+ schema, on its own channel for host tools: pi binds it in the run's process, claude-agent serves it from its `hands`
1844
+ MCP server (`mcp__hands__mcp__<server>__<tool>`; the CLI's tool search is off in such a session, so the granted tools
1845
+ are offered whole), codex hands it to Codex as a dynamic tool named `mcp_<server>__<tool>` (Codex refuses a
1846
+ dynamic tool named `mcp__*`), and opencode serves it from its `hands` MCP server. No harness's own MCP client is
1847
+ handed a server. Each call passes the run's one tool gate before anything is sent, is booked and recorded like any
1848
+ host tool, and the runner calls the server with the credential: a call set to ask parks the run with nothing sent,
1849
+ and the claim that resumes it runs the call once on the person's allow, or refuses it in their words. A tool whose
1850
+ schema Codex would drop or retype (a `not`, `patternProperties`, ...) is `422` at the save, naming the place and why.
1682
1851
  - **A call** goes to the pinned URL alone, the 2026-07-28 revision first and a 2025-era server through its
1683
1852
  `initialize`; on 2026-07-28 each `x-mcp-header` parameter of the pinned tool is sent as its `Mcp-Param-*` header. No
1684
1853
  redirect is followed, at most 4 MiB is read, and it may take 120 s. The
@@ -1708,7 +1877,17 @@ asked by default.
1708
1877
  list of 1 to 16 of them, the argument one of the list, compared strictly:
1709
1878
  `{"mcp:slack/slack_send_message": {"permission": "allow", "pin": {"channel_id": "C0123"}}}`,
1710
1879
  `{"mcp:github/pull_request_review_write": {"pin": {"event": [null, "COMMENT"], "method": ["create", "delete_pending", "submit_pending"]}}}`
1711
- (the `code-review` template's pin). The gate checks a pinned
1880
+ (the `code-review` template's pin). An object argument may be pinned to its keys instead: `{"keys": [...]}`, 1 to 16
1881
+ key names, holds a call whose argument, when given, is an object of those keys alone, any values (left out or `null`
1882
+ holds too), so `{"mcp:hubspot/HUBSPOT_UPDATE_CONTACT": {"pin": {"properties": {"keys": ["hs_lead_score"]}}}}` lets a
1883
+ write set that one field and no other, and refuses one that sets another with "properties keys in (hs_lead_score)".
1884
+ Two layers' keys pins of one argument hold as the keys in both. A pinned tool takes only its listed arguments: a
1885
+ call of a tool with a pin in either layer may carry only the top-level arguments its listing declares under its
1886
+ inputSchema's `properties` (the listing the run pinned when it started, the one its model is offered), beside the
1887
+ pinned ones. So an alias a server takes for a pinned argument, one its listing does not declare (Gmail's `to` for
1888
+ `recipient_email`, Slack's `channel_id` for `channel`), is refused with "`to` is not an argument of
1889
+ GMAIL_SEND_EMAIL; a pinned tool takes only its listed arguments (recipient_email is pinned)", and a pin need not
1890
+ null aliases by hand. A listing with no `properties` object closes nothing, and a tool with no pin is not closed. The gate checks a pinned
1712
1891
  tool's call before it runs or asks anyone, whatever the permission (an allow, an ask, a grant): a call whose arguments
1713
1892
  are not as pinned is refused, never sent and never asked about, and the model reads "mcp:slack/slack_send_message may
1714
1893
  only be called with channel_id = C0123: its destination is fixed by the agent's settings". The run's process logs a
@@ -1897,20 +2076,8 @@ delivery on the payload's tag, for tracing. A request that carries no scheme's s
1897
2076
  one, or is signed under a scheme other than its trigger's, is the same `401` as a bad signature, and the headers are
1898
2077
  checked before the body is read.
1899
2078
 
1900
- `composio` takes [Composio](https://composio.dev) trigger events. Register the trigger's `hook_url` as Composio's webhook
1901
- subscription (`POST /api/v3.1/webhook_subscriptions` with `enabled_events: ["composio.trigger.message"]`); Composio
1902
- answers with a `secret` it makes, which you give here, whole and as Composio shows it, with `POST /v2/triggers/{id}/secret`
1903
- and the body `{"secret": "..."}` (the same call replaces it when you rotate it in Composio). A composio trigger is made with no
1904
- secret (the URL carries its id, so Composio can only make the secret after); until one is set every request is refused. It is sealed as a minted one is and never shown again; this server never
1905
- makes one for a composio trigger. Composio signs as Standard Webhooks does (`webhook-id`, `webhook-timestamp`, `webhook-signature`) but keyed by the
1906
- UTF-8 bytes of that secret string, not a decoded `whsec_` key, which is why a `standard` trigger cannot take it. The
1907
- firing's key is `webhook-id`, the event is the body's `metadata.trigger_slug`, so `accept: [{"event":
1908
- "GITHUB_ISSUE_ADDED_EVENT"}]` takes one Composio trigger's events, and a rule's `where` pointers read the payload under
1909
- `/data`. The subscription also delivers account events (`composio.connected_account.expired`,
1910
- `composio.connected_account.activated`, `composio.trigger.disabled`), signed the same way, with no slug: their event is the
1911
- body's top-level `type`, so `accept` can take them too. A Composio project's subscription posts every event to the one URL it names, so it fires that one composio
1912
- trigger and its agent: other triggers never see those deliveries, whatever their `accept`. The tag also names
1913
- `trigger_id` and `user_id`.
2079
+ A webhook trigger takes no `composio` signature (`422`, pointing to the console's Triggers → New app trigger): Composio's
2080
+ events start runs through a [Composio trigger](#composio-triggers), whose server makes and keeps the subscription.
1914
2081
 
1915
2082
  `accept` makes a trigger take only the events it names, from the delivery alone:
1916
2083
 
@@ -1976,6 +2143,44 @@ never opens a completed run again for one it already has. A firing to a run that
1976
2143
  5 s), and a trigger holds at most 20 firings due: past them a webhook event and a run now answer `429 rate_limited`
1977
2144
  with `Retry-After: 30`, recording nothing, and a schedule's time is `skipped`.
1978
2145
 
2146
+ ### Composio triggers
2147
+
2148
+ A trigger with `source: {kind: "composio", server, event, config}` starts a run on an event in an app that a saved
2149
+ [Composio](#composio) server connects: `server` names the saved server, `event` is one of its toolkit's events
2150
+ (Composio's trigger slug, `GITHUB_ISSUE_CREATED_TRIGGER`), listed with each one's config schema by `GET
2151
+ /v2/settings/mcp-servers/{name}/composio/events`, and `config` is that event's config (`{owner, repo}` for a GitHub
2152
+ issue). The console makes one in Triggers → New app trigger. The create does the Composio side with the server's saved
2153
+ key, in order, and undoes what it made when a later step fails:
2154
+
2155
+ - The Composio project's webhook subscription (one a project), at this server's address `/v2/hooks/composio/{hook}`,
2156
+ the first time a trigger needs one, and reused after. Composio's secret for it is sealed under the hook's scope and
2157
+ never answered, logged or put in an event.
2158
+ - The event's trigger instance, by upsert, for the account the server is connected as. Triggers with the same server,
2159
+ event and config share Composio's one instance: it is turned off only when every trigger holding it is off, and
2160
+ deleted with the last.
2161
+ - The trigger here. Its `source` names what was made: `instance_id` and `hook`.
2162
+
2163
+ The create is refused before Composio is asked anything with `409 composio_no_public_url` when the server has no public
2164
+ address (`AGENTRUN_PUBLIC_URL`): Composio could not reach it. `features.triggers.public_url` on `GET /v2/capabilities`
2165
+ says whether there is one, never the address, and the console turns New app trigger off without one, with the line
2166
+ "App triggers need this server's public address: set AGENTRUN_PUBLIC_URL and restart." A subscription at another
2167
+ address is `409 composio_subscription_elsewhere` with `details.webhook_url`, in the words "Composio sends this
2168
+ project's events to <url> now. Moving them here stops them arriving there: anything listening at <url> (another
2169
+ AgentRun server, or a tool of yours) gets no more events." The same create with `source.move_subscription: true` moves
2170
+ it here. `409 composio_not_connected` (with `details.connect_url`, Composio's page to connect it) when the server's
2171
+ Composio user has no connected account, `409 composio_account_ambiguous` (`details.accounts`) when it has several: a
2172
+ trigger runs as one, never one picked.
2173
+
2174
+ Every event of the project comes to its one route, checked by the `composio` scheme: the Standard Webhooks headers
2175
+ and message, keyed by the UTF-8 bytes of the subscription's whole secret string, with the same 5-minute window, and
2176
+ `webhook-id` as the firing's key. The delivery fires each trigger whose instance is its `metadata.trigger_id` and whose
2177
+ `accept` takes it, each its own run. Its event is the body's `metadata.trigger_slug`, and a rule's `where` pointers
2178
+ read the payload under `/data`. The agent gets the body inside `<trigger-payload source="composio" scheme="composio"
2179
+ event="..." trigger_id="..." user_id="..." untrusted>`. Pausing, resuming and deleting a trigger, and the server turning
2180
+ one off itself, follow on Composio once the change holds here; what Composio could not do is said, with what to do by
2181
+ hand. `GET /v2/settings/mcp-servers/{name}/composio/triggers` lists a server's Composio triggers with whether Composio
2182
+ has each instance on, and the subscription's place.
2183
+
1979
2184
  ### GitHub triggers (Connect GitHub)
1980
2185
 
1981
2186
  A server has at most one GitHub App, made with GitHub's app-manifest flow, and every `github` trigger (and every
@@ -2106,7 +2311,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2106
2311
  | `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
2107
2312
  | `GET /openapi.json` | Without a credential: this API as an OpenAPI 3.1 document, the `agentrun.v2/0` contract (vendored in `src/openapi/`, its source in `info`) with this server's own routes marked `x-agentrun-serve` the operations it answers `501` marked `x-agentrun-serve-unsupported`, and a contract operation that takes more than the contract gives marked `x-agentrun-serve-changed` with each change named; `links.openapi` in capabilities points at it. |
2108
2313
  | `GET /capabilities` | Without a credential. `backend: local`, every feature flag present and true only when it works; `tools`, the tools an agentic revision may name; `workflows`, what a workflow revision's model nodes get and, in `workflows.decisions.providers`, the decision providers its typed questions run on; `models`, where models come from and the model of each tier. |
2109
- | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)), `max_tool_calls` (agentic only, on pi): the tool calls each conversation of a run may make ([tool-call budget](#tool-call-budget)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
2314
+ | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0 ([spend cap](#spend-cap)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
2110
2315
  | `PUT /agents/{id}/definition` | The same body, checked [the same way](#models): a new revision, its parent the current one, made current. Without `skills` the current revision's skill files carry over. A definition that is the current revision already writes nothing, so a PUT sent twice makes one revision. An agent's id, name and description stay those it was made with. `If-Match` that is not the current ETag is `412 precondition_failed`; the store compares it again inside the commit, so of two edits that read the same revision exactly one lands. The contract's body is taken too: the definition itself, with `If-Match` required (`412` without it) and `definition.version` greater than the current one (`422`). Any such version is taken, and always makes a new revision, the same definition included; the revision is numbered as this server numbers them, the next, and the answer says which; the route reads a body holding `definition` as this one, any other as the contract's. |
2111
2316
  | `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
2112
2317
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
@@ -2197,7 +2402,9 @@ A run names up to `limits.max_files_per_run`, 20, ready files in `file_ids`: an
2197
2402
  `422` at `file_ids` before anything starts. Each is copied, never linked, into the run's `work/inputs/` at its `path`,
2198
2403
  folders kept, before the run's process starts, whatever its harness; a name already taken gets a suffix (`notes-2.txt`,
2199
2404
  `docs-2/`), the same for the same files in the same order. The run reads them as any file of its workspace, and
2200
- `GET /v2/runs/{id}/files` lists them. An agentic run is told of them in its first message, on every harness: after the
2405
+ `GET /v2/runs/{id}/files` lists them. A run's opening message is saved beside them as `inputs/message.md`, its
2406
+ `content` byte for byte, so an agent can name it to a subagent instead of copying it (a run with no text `content` has
2407
+ none; an upload at that path takes `message-2.md`); the files line never names it. An agentic run is told of them in its first message, on every harness: after the
2201
2408
  input's `content` and a blank line, one line,
2202
2409
  `Files for this run: "inputs/notes.txt" (32 B), "inputs/docs/plan.md" (1.5 KB).`, each file by the path the run's tools
2203
2410
  take, quoted as a JSON string with a control, format or separator character as its `\uXXXX` escape (so no name forges an
@@ -2282,7 +2489,8 @@ model). A definition naming a
2282
2489
  harness this server does not run yet saves with a warning on `definition.harness`, and a run of it is
2283
2490
  `409 agent_not_runnable` with `details.harness`; it never runs on pi instead. This server runs pi always, and
2284
2491
  `claude-agent`, `codex` and `opencode` when each adapter's package, pins and provider endpoint check out; the harness's
2285
- `reason` says what is missing. `claude-agent` and `codex` install themselves on first use: AgentRun never ships the
2492
+ `reason` says what is missing. With a ChatGPT plan signed in, pi and codex need no key
2493
+ ([on a ChatGPT plan](#on-a-chatgpt-plan)); claude-agent and opencode still do. `claude-agent` and `codex` install themselves on first use: AgentRun never ships the
2286
2494
  Claude Agent SDK or the Codex CLI, and the first run on each (or the first agent saved on it) installs the version AgentRun
2287
2495
  pins (`@anthropic-ai/claude-agent-sdk@0.3.286`, `@openai/codex@0.164.0`) from npm into `<data>/harnesses/claude-agent`
2288
2496
  or `<data>/harnesses/codex`, with the npm that runs the server, once. Each install is pinned by the lock the server
@@ -2424,12 +2632,23 @@ An agent or a run is archived, never deleted: `DELETE` stays `405`. These routes
2424
2632
  Open the link the server prints, once, in a browser. `/` is the console (`apps/console` in the repository), on the
2425
2633
  server's own origin, under a CSP that allows that origin only, but for the provider icons on the Keys page (below):
2426
2634
 
2427
- - **Mission Control**: the store's counts and the latest runs.
2428
- - **Agents**: each agent with its kind and harness, archived ones behind **Archived**. **New agent** and an agent's page:
2429
- a name, a description, a prompt (with its model, thinking level and tools) or a workflow, sent to `POST /v2/agents`;
2430
- an edit is `PUT /v2/agents/{id}/definition` with `If-Match` set to the revision it started from (412 when another came
2431
- first). Its revisions, with **Make current** (`POST /v2/agents/{id}/current`), and **Archive** or **Unarchive**.
2432
- - **Playground**: a run of an agent, on the revision you pick, with its input, followed as it goes.
2635
+ - **Mission Control**: the store's counts, imported history, analytics and the latest runs, available before the first
2636
+ server-run agent and without a model-provider key. Its introduction is dismissible. Connect agent and Query use
2637
+ the coding-agent selector; the page refreshes when you return from your coding agent.
2638
+ - **Agents**: **Build** opens a description composer and local starter templates; **Connected agents** lists definitions,
2639
+ with archived ones behind **Archived**. Build, edit and run actions share the remembered coding-agent dropdown,
2640
+ including **API playground**. Choosing a template prepares its full definition without creating or running it.
2641
+ Each agent opens an overview beside its runs, versions and supported workflow, learning and analytics tabs.
2642
+ - **Learning Dojo** (`#/dojo`): learning across connected agents, read from this server. It shows retained notes,
2643
+ learned skills and workflow drafts, pending reviews, and recent changes with their source runs. Open an agent's
2644
+ Learning tab to inspect its knowledge, enable learning, or review a pending change. Counts say when a read is
2645
+ incomplete; missing results are not shown as zero.
2646
+ - **API playground**: create an agent with `POST /v2/agents`, edit its definition with
2647
+ `PUT /v2/agents/{id}/definition`, query runs with `GET /v2/runs` (or one agent's runs), or start a run on the revision
2648
+ you pick and follow it live. Query links retain the agent, state and archive filters. Build descriptions and
2649
+ templates carry into the editable create request. Edits preserve other configuration and use `If-Match` (412 when
2650
+ another revision came first). Definition management does not require a model-provider key. The existing detailed
2651
+ editor remains available at `#/agents/{id}/edit`, including making an older revision current.
2433
2652
  - **Runs**: every run, newest first, filtered by agent and by state, archived runs behind **Archived**; the address
2434
2653
  keeps the filters. A run's page follows `GET /v2/runs/{id}/timeline` with a long poll, sends messages (an answer while
2435
2654
  it waits on `ask_person`), stops or cancels the run, shows its files and a workflow's graph, and has **Archive** or
@@ -2439,6 +2658,11 @@ server's own origin, under a CSP that allows that origin only, but for the provi
2439
2658
  its credential's state, **Refresh**, **Change** (a credential left empty keeps the saved one) and **Delete**. An
2440
2659
  agent's Tools step lists each saved server's tools; a box ticked grants `mcp:<server>/<tool>`.
2441
2660
 
2661
+ A run that reports learning also has a **Learning result** panel: the outcome, the grader's reasons for keeping or
2662
+ rejecting each proposed item, validation problems, seed and merge revisions, and reported grading usage. Its changed
2663
+ files remain available beside the result. The agent's Learning tab refreshes after returning to the console and
2664
+ while visible, without replacing an open edit or review.
2665
+
2442
2666
  Its files (`index.html`, and Vite's hashed files under `/assets/`) are public and hold no data: everything it shows
2443
2667
  comes through `/v2`. With accounts on (the default) the console asks for the owner's password
2444
2668
  ([your password](#your-password)) and the browser holds the owner's session cookie; a `?token=` link sets no cookie: the
@@ -2499,6 +2723,20 @@ cookie to every server on the same host name, whatever its port, so another app
2499
2723
 
2500
2724
  ## Importing your sessions
2501
2725
 
2726
+ For completed history on another machine, use **Connect agent → Another machine** with **History only** scope.
2727
+ The matching source connector previews the selected project and runtime, then uploads only with the source
2728
+ operator's approval and a destination owner grant that permits history. It starts no execution worker or paid task.
2729
+ See [the remote history guide](../../docs/native-agents.md#import-selected-history). Imports remain history, not live
2730
+ connections or automatic learning.
2731
+
2732
+ The separate local-store CLI importer below requires an approved maintenance window. Verify the source machine,
2733
+ this server's actual data directory, store configuration, seal key and supervisor without exposing credentials.
2734
+ Preview the scope with a dry run and inspect active work before stopping the existing server and runners through
2735
+ their supervisor. Import into the same store, then restart and verify that service, including after an import failure.
2736
+ Never bypass the store lock. This local-store operation has no server endpoint that reads sessions from the browser's
2737
+ machine; importing into a different local store does not populate a remote console. Build, edit, run, query and
2738
+ connection handoffs use the shared coding-agent selector and target this server's matching skill, MCP endpoint and API.
2739
+
2502
2740
  `agentrun-serve import --data DIR` reads the Claude Code, Codex and pi sessions in your own home (`~/.claude/projects`,
2503
2741
  `~/.codex/sessions`, `~/.pi/agent/sessions`) into the data directory, once. Each project folder becomes an agent, with its
2504
2742
  CLAUDE.md or AGENTS.md and its skill folders, and each session becomes a run you can read but not continue. Nothing leaves
@@ -2585,6 +2823,17 @@ definition that sets it keeps it on its revision, `false` included, and an edit
2585
2823
  that never sets it stores nothing, so its revision id is the one it had before the switch. The server's `--learning off`
2586
2824
  turns learning off for every run it starts, whatever the agent says.
2587
2825
 
2826
+ The console uses this existing loop: run, reflect, validate and grade the proposal, retain accepted knowledge, then
2827
+ seed later runs from that knowledge. It reads `GET /v2/agents/{id}/learning` for the agent's retained knowledge and
2828
+ history, and `GET /v2/runs/{id}/learning` and its `/diff` for an individual result. Observation requires no model key;
2829
+ producing new learning requires an agentic run through this server with learning enabled and a configured model.
2830
+
2831
+ Importing Claude Code, Codex or pi session history does not replay learning or connect a live learning stream. A
2832
+ run made directly in an external harness needs that harness to persist compatible learning results through a host
2833
+ integration before the console can display them. Learning Dojo shows this server's actual reflection results, not inferred
2834
+ training scores from imported conversations. Before/after cost and duration are observations, not an accuracy
2835
+ evaluation.
2836
+
2588
2837
  An agent that learns has a learning folder, `learning/` in its folder on the disk (`DATA/disk/agents/<key>/learning/`), in Claude Code's
2589
2838
  auto-memory format:
2590
2839
 
@@ -2879,7 +3128,7 @@ with the token, an archived agent's too:
2879
3128
  `learned_not_active`. Its files are checked again as a restore checks them, and its workflow as the learning checker
2880
3129
  checks a run's draft against the agent's tools and gate (400 with `problems`), then as any workflow revision's save
2881
3130
  (422, or 409 `agent_not_runnable`). The new agent's `tools` are the ones its call nodes call, and it keeps the source
2882
- agent's policy as it is now (its `tool_settings`, `approvals`, `max_cost_usd` and `cap_mode`), never more. Its id is the
3131
+ agent's policy as it is now (its `tool_settings`, `approvals` and `max_cost_usd`), never more. Its id is the
2883
3132
  workflow's name, with `-2`, `-3` and on past an agent's id or name already here, and its name `name` or the same. It
2884
3133
  answers 201 with the agent; the learned workflow stays in the folder, unchanged. It takes the owner's password session
2885
3134
  alone, as an approval does.
@@ -2922,28 +3171,17 @@ definition's `max_cost_usd` above 0 sets that default, and 0 clears it (no defau
2922
3171
  leaves the field out keeps the agent's default, as it keeps its harness and place: leaving a field out never removes a
2923
3172
  spend limit. A workflow definition keeps one the same way. The cap is checked in the run's own process
2924
3173
  before each model request, the agent's and a compaction's alike, on every harness: what the run has spent so far, plus
2925
- what each request still in flight is held at, plus what this request is expected to cost must stay within it, or the
2926
- request is not sent and the run pauses ([below](#a-run-paused-at-its-cap)). A request costs its input, plus the output it
2927
- is sent with at the output price, plus any fee its tokens do not show (below). How its input is priced is the run's
2928
- `cap_mode`: the run's own (`POST /agents/{id}/runs` with `cap_mode`), else its agent's (a definition's `cap_mode`, kept by
2929
- an edit that leaves it out), else `expected`; only a run with a cap takes one (`422 not_allowed` otherwise).
2930
-
2931
- - `expected`: priced from the previous request of its conversation, as that request's usage reported it. The input it
2932
- read from the cache or wrote to it (`cache_read_input_tokens` and `cache_creation_input_tokens` on Anthropic's API,
2933
- `input_tokens_details.cached_tokens` on the Responses API) at the cache-read price, if that request ended less than 4
2934
- minutes before (Anthropic keeps a cache 5); the rest (its input after the cache, plus what the conversation grew by
2935
- since, one token per byte) at the higher of the input and cache-write prices. With no previous request in hand, or one
2936
- older than 4 minutes, all of the input at that price. On claude-agent, codex and opencode the previous request is the
2937
- session's last on the same model in the run's current process, so a run's first request after a restart is priced
2938
- with nothing cached; on pi it is the conversation's last answer. Output never passes the cap (below); a request that
2939
- misses the cache can, by at most its bound: its input at full price less its input expected. The run's
2940
- `cost.overshoot_bound_usd` serves the bound of the requests in flight. A request's real cost is always booked, never
2941
- clipped: a run that passed its cap so is not failed for it, its timeline says `Went $X over its cap on a cache miss (at
2942
- most $Y).`, and its next request is refused, so it pauses at its cap as usual. A request whose cost never comes in (cut,
2943
- stopped, lost) counts at what it was held at, its expected cost, in this process and after a restart alike.
2944
- - `strict`: every input token at the higher of the input and cache-write prices (the provider may bill any of the input as
2945
- a cache write), the worst case: no request passes the cap, and a run whose requests read the cache pauses well before
2946
- it has spent its cap.
3174
+ what each request still in flight is held at, plus the most this request can cost must stay within it, or the
3175
+ request is not sent and the run pauses ([below](#a-run-paused-at-its-cap)). The cap is a hard stop for everything but
3176
+ the charge of a monid call priced by usage, which can pass the estimate it was held at: when it does, the run stops at
3177
+ once ([monid](#monid)). A request costs its input, plus the output it
3178
+ is sent with at the output price, plus any fee its tokens do not show (below). Its input is priced at its worst case:
3179
+ every input token at the higher of the input and cache-write prices, since the provider may bill any of it as a cache
3180
+ write and a cache can miss at any request. So no request passes the cap, a cache miss included: a request costs at most
3181
+ what it was held at. A request whose cost never comes in (cut, stopped, lost) counts at that hold, in this process and
3182
+ after a restart alike. A run whose requests read the cache spends less than its holds, so it pauses before it has
3183
+ spent its whole cap; output is clamped to what is left after the input (below), so a run is parked only when what is
3184
+ left cannot pay its next request's whole input and a least answer.
2947
3185
 
2948
3186
  Near its cap, a run's model is told once to finish: when what is left (the cap less what was spent and what requests
2949
3187
  in flight are held at) is under three times the run's typical request, the next request of the run's own model carries
@@ -2988,31 +3226,50 @@ where thinking takes one (Anthropic's, 1,024, the budget squeezed to it at the l
2988
3226
  budget, since its reasoning then shares the limit (minimal 1,024, low 2,048, medium 8,192, high 16,384). The input bound is one token per UTF-8 byte of what is sent (a byte-level tokenizer never makes
2989
3227
  a token of less than one byte), each image counted at what its model's provider bills it by its size in place of its
2990
3228
  base64's bytes, plus what the provider adds server-side (a tool-use prompt), from the same table the model proxy of
2991
- claude-agent, codex and opencode uses; there the proxy measures each request's body. On a route straight to Anthropic
3229
+ claude-agent, codex and opencode uses; there the proxy measures each request's body. On codex and opencode (the
3230
+ Responses API) the text the model reads as it is (a message, a call's arguments, a tool's output, a reasoning summary)
3231
+ counts at its own bytes, not the JSON escapes around it (`\"`, `\n`), which no token is billed for; tool definitions and
3232
+ encrypted reasoning keep every byte. For a model whose tokenizer is o200k_base (gpt-4o and later, the o-series, on
3233
+ codex and opencode, and on pi and claude-agent through serve's translation), each request is also counted on the host
3234
+ with that vocabulary, plus a stated margin (10% of the count, 16 tokens an item, 256 a request), on every route and with
3235
+ nothing asked of the provider, and its bound is that count when it is below the byte bound. On a route straight to Anthropic
2992
3236
  (`https://api.anthropic.com`, on pi and claude-agent), each answer request is also counted by Anthropic's own free
2993
3237
  token count (`POST /v1/messages/count_tokens`, with only the credential and version headers, and never through a
2994
3238
  gateway or any other base), and its bound is that count plus the tool-use prompt when that is below its bytes. A count
2995
- that fails or takes over 3 seconds leaves the byte bound; the request is never held up or refused for it.
3239
+ that fails or takes over 3 seconds leaves the byte bound; the request is never held up or refused for it. On any route
3240
+ with no count (a Claude model through a gateway), a Messages request on pi or claude-agent that carries the session's
3241
+ last answered request unchanged, apart from the messages it adds, is bounded by what the provider billed that request's
3242
+ whole input at (its answer's input, cache read and cache write tokens) plus the bytes of the messages it adds, each
3243
+ image among them at what it is billed as, when that is below its byte bound: the earlier request's system prompt, tools
3244
+ and messages bill alike in the later one, and what it adds is bounded as the byte bound bounds any body. A request that
3245
+ differs in anything else, or adds a document, keeps its other bounds.
2996
3246
 
2997
3247
  **The smallest cap that works.** The byte bound reads text as about two to three times the tokens it is billed as, and a
2998
- step is sent only when the run's spend plus that step's least (its input bound, priced by the cap mode, and a 1,024-token
2999
- answer) fits. So a small cap pauses a run well before it has spent it. Measured on a pi desktop run on Sonnet ($3 / $15,
3000
- cache write $3.75, cache read $0.30 a million) through the dispatch's own system prompt and tools, five requests (four
3001
- screenshots, then the answer), spending about $0.04 in all:
3002
-
3003
- | Cap mode | Route | First request needs | Five-step run needs | Each further step |
3004
- | --- | --- | --- | --- | --- |
3005
- | `strict` | Through a gateway (OpenRouter): the byte bound | $0.06 | $0.12 | about $0.013 |
3006
- | `strict` | Straight to Anthropic: Anthropic's count | $0.03 | $0.09 | about $0.012 |
3007
- | `expected` (the default) | Either | as `strict` | $0.06 | about $0.007 |
3008
-
3009
- In `strict` mode every step's whole input is priced at the cache-write price. In `expected` mode a step after the first is priced from what the session's previous request read from the cache, so a five-step run needs about $0.06 by either route, and about $0.007 a further step; the first request is priced as in `strict`, so its figure is the same. A claude-agent run's first request is of the same size (the pinned
3248
+ step is sent only when the run's spend plus that step's least (its whole input bound at the cache-write price, and a
3249
+ 1,024-token answer) fits. So a small cap pauses a run well before it has spent it. Measured on a pi desktop run on Sonnet
3250
+ ($3 / $15, cache write $3.75, cache read $0.30 a million) through the dispatch's own system prompt and tools (read,
3251
+ write, edit, the desktop's and `codemode`, with the desktop skill named in the system prompt), five requests (four
3252
+ screenshots, then the answer), spending about $0.04 in all. Through a gateway the first request's byte bound is 9,772
3253
+ tokens, so it needs $0.052; each later request is bounded by the last one's bill and the bytes it adds, so the whole run
3254
+ needs $0.082;
3255
+ straight to Anthropic the count is one recorded from a real desktop run on Sonnet (3,146 tokens at first), so it needs
3256
+ $0.030 and $0.083:
3257
+
3258
+ | Route | First request needs | Five-step run needs | Each further step |
3259
+ | --- | --- | --- | --- |
3260
+ | Through a gateway (OpenRouter): the byte bound, then the last bill | $0.06 | $0.09 | about $0.012 |
3261
+ | Straight to Anthropic: Anthropic's count | $0.03 | $0.09 | about $0.012 |
3262
+
3263
+ A claude-agent run's first request is of the same size (the pinned
3010
3264
  CLI's measured 6,926 bytes with five tools: $0.04 for its first request through a gateway). A cap below these pauses at
3011
- once with `Not sent: ... the next step needs at least $X`, and a raise to that figure sends it on. (In `strict` mode through a gateway, a run a cent under the five-step figure is not parked before its last step: the cap's wrap-up refuses its last screenshot, and the run answers from what it has.)
3265
+ once with `Not sent: ... the next step needs at least $X`, and a raise to that figure sends it on. A run a cent under the
3266
+ five-step figure does not get every step: straight to Anthropic it parks before its last step, its words naming that
3267
+ figure; through a gateway ($0.08) the wrap-up refuses its last screenshot, the answer's request carries the refusal in
3268
+ place of a screenshot and fits, and it answers.
3012
3269
  `packages/serve/test/cap-minimum.test.mjs` holds these figures to what the cap does. A request in flight holds what it was admitted at until it answers, so requests
3013
3270
  sent side by side cannot pass the cap together. Spent so far is read from the run's store each time its process starts, so it
3014
- survives a restart, plus each response since, and with them each charge a paid tool booked (`monid.run`, which is itself
3015
- refused once the spend reaches the cap; see [monid](#tools)).
3271
+ survives a restart, plus each response since, and with them each charge a paid tool booked (a monid endpoint's call, which is itself
3272
+ refused once the spend reaches the cap; see [monid](#monid)).
3016
3273
 
3017
3274
  The `browser` tool's session time is held the same way, before it runs, so no browser minute passes the cap. Its next
3018
3275
  stretch is the most a session can run before the run can check again: the provider's minimum (what its release may top
@@ -3108,6 +3365,22 @@ refused was never sent: the run's usage counts no request for it, and a run whos
3108
3365
  request sent". A reply the limit cut short says so on the run's timeline: "The reply stopped at 1,500 tokens: all that
3109
3366
  the $0.15 left of the run's $0.50 cap could buy."
3110
3367
 
3368
+ ### A limit on free requests
3369
+
3370
+ A request on a free model costs $0, so no dollar cap can stop one: a free model is one whose catalog price is all zeros
3371
+ (an OpenRouter `:free` model and the like, as `harnesses[].free_models` lists them; an OpenRouter router is none, since
3372
+ it bills the model it picks), with no fee beside the request. Its provider's shared daily quota is what a looping run
3373
+ burns. So a run has a limit on those requests: 60, or `AGENTRUN_FREE_MODEL_REQUESTS` (a whole number above 0; anything
3374
+ else refuses the server's start and the runner's). ChatGPT-plan requests don't count. Capabilities'
3375
+ `limits.free_model_requests` says it, and the console says "free model: up to 60 requests" beside the cap of an agent
3376
+ on a free model. A run may make that many; the next is not sent, and the run ends `failed` as one its
3377
+ cap ends, its error `spend_cap_reached`: "Not sent: this run reached its 60-request limit for free models." (the number
3378
+ is the limit). No raise lifts it, and it holds capped or not, on every harness: pi, claude-agent, codex, opencode and a
3379
+ workflow's agent nodes. Every such request of the run counts, its own model's, its subagents', its side calls' (a
3380
+ compaction, a title), and one a crash cut, which is booked at $0, a known cost; a paid request, a paid tool call and a
3381
+ workflow's decision never count, and are never refused by it. The count is read from the run's booking records at each
3382
+ request, so a restart or a claim moved to another runner keeps it.
3383
+
3111
3384
  ### A run paused at its cap
3112
3385
 
3113
3386
  A refusal for room (what is left of the cap cannot buy the next request's least) pauses the run instead of ending it: the
@@ -3168,16 +3441,16 @@ its held worst case.
3168
3441
 
3169
3442
  ### A workflow run under its cap
3170
3443
 
3171
- A workflow run is capped by the same checks, in its own process, each before the paid step is sent:
3444
+ A workflow run is capped by the same checks, on the run's one ledger (the kernel cap), each before the paid step is sent:
3172
3445
 
3173
3446
  | Step | Held at | Where |
3174
3447
  |---|---|---|
3175
- | A model node's request | its expected cost, as an agentic run's request | the run's models (`cap.ts` capModels) |
3448
+ | A model node's request | its worst case, as an agentic run's request | the run's ledger |
3176
3449
  | A call node's `llm` call | the same | the same, as a side request |
3177
- | A call node's paid tool call (Parallel's search or extract) | its fee | `paidCall`, as an agentic run's |
3450
+ | A call node's paid tool call (Parallel's search or extract) | its fee | the run's ledger, as an agentic run's |
3178
3451
  | A decision on Parallel | its list price for one request, $0.001 | before the driver admits it (`decision-cap.ts`) |
3179
3452
  | A decision on Jev | TypeSafe's published price, $0.042 a million input tokens, one token a byte of its state and questions | the same |
3180
- | A decision on an OpenRouter Decisions model | its catalog price: per request, per image, per input token, and per output token for 256 a question (`expected`) or the catalog's most (`strict`) | the same |
3453
+ | A decision on an OpenRouter Decisions model | its catalog price: per request, per image, per input token, and per output token for the catalog's most | the same |
3181
3454
 
3182
3455
  What a decision charged is booked in the run's store as the cap counted it, so a run opened again counts it once. A step
3183
3456
  the cap has no room for is not sent and waits where it stands: the run is `input_required`, state `waiting`, with
@@ -3194,15 +3467,6 @@ OpenRouter Decisions model the catalog lists no price for: `409 agent_not_runnab
3194
3467
  node's label and its fix. A step no cap fixes all the same (a spend no one knows) ends the run `failed`,
3195
3468
  `spend_cap_reached`, in the cap's words, after the node's label.
3196
3469
 
3197
- ## Tool-call budget
3198
-
3199
- An agentic definition's `max_tool_calls: N` gives each conversation of its runs on pi N tool calls: the run's own, and
3200
- each conversation a tool opens, counted apart. Past N the run's tool gate refuses every call before it runs, before
3201
- any setting or approval is read, with one fixed text: the budget is spent, don't call another tool, answer now from
3202
- what you have. That refusal is not counted and never ends the run, so the model's next answer is the turn's. The count
3203
- is read from the conversation's committed journal, so a restart or a claim moved to another runner keeps it. Above 0
3204
- sets the budget, 0 clears it, an edit that leaves it out keeps it; a workflow's, or one on another harness, is `422`.
3205
-
3206
3470
  ## The faux model
3207
3471
 
3208
3472
  `--faux MODULE` loads `MODULE` in each run's process. Its default export is called for every model request with the
@@ -3289,7 +3553,7 @@ carries no cost at all, as from a provider that does not price the model. The te
3289
3553
  `SENTRY_DSN`, `DB_PWD`; never `PWD` or `OLDPWD`), whether the launcher's list names it or not. The rule is
3290
3554
  `keyShaped` (`src/secret-cut.ts`), which an import's cut and a harness's log take too. The keys a
3291
3555
  run needs are read from the store at its claim, opened with the seal key, and are put on that run's environment alone.
3292
- It gets none of the boxes' keys ([Boxes](#boxes)). A tool key reaches it only when its
3556
+ It gets none of the boxes' keys ([Sandbox](#sandbox)). A tool key reaches it only when its
3293
3557
  revision names a tool the key unlocks (`MONID_API_KEY` a monid tool, `BROWSERBASE_API_KEY` and `KERNEL_API_KEY` `browser`; a workflow's
3294
3558
  tools are those its model and call nodes name), and a model key only when its model needs it ([Models](#models)), read
3295
3559
  from the revision at each claim, a resume after a restart included.