@parcha/agentrun-serve 0.1.0-beta.38 → 0.1.0-beta.40

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 (423) hide show
  1. package/CHANGELOG.md +455 -0
  2. package/README.md +376 -125
  3. package/dist/adapters.d.ts +4 -1
  4. package/dist/adapters.js +4 -2
  5. package/dist/agent-rows.d.ts +0 -2
  6. package/dist/agents-store.d.ts +5 -5
  7. package/dist/agents-store.js +14 -14
  8. package/dist/bash-read-only.js +2 -1
  9. package/dist/cap-short.d.ts +12 -0
  10. package/dist/cap-short.js +60 -0
  11. package/dist/cap.d.ts +3 -10
  12. package/dist/cap.js +2 -5
  13. package/dist/catalog.d.ts +0 -5
  14. package/dist/catalog.js +1 -5
  15. package/dist/chatgpt-plan.d.ts +163 -0
  16. package/dist/chatgpt-plan.js +549 -0
  17. package/dist/cli.js +26 -6
  18. package/dist/composio-preset.d.ts +8 -0
  19. package/dist/composio-preset.js +8 -7
  20. package/dist/composio-triggers.d.ts +113 -0
  21. package/dist/composio-triggers.js +411 -0
  22. package/dist/computer-calls.js +2 -2
  23. package/dist/computer-commands.d.ts +2 -0
  24. package/dist/computer-commands.js +7 -3
  25. package/dist/computer-live.d.ts +7 -2
  26. package/dist/computer-live.js +9 -5
  27. package/dist/computer-routes.d.ts +2 -2
  28. package/dist/computer-routes.js +2 -2
  29. package/dist/computer-setting.d.ts +3 -3
  30. package/dist/computer-setting.js +5 -5
  31. package/dist/computer-view.d.ts +15 -0
  32. package/dist/computer-view.js +16 -2
  33. package/dist/computer-viewer.js +14 -1
  34. package/dist/computers.d.ts +5 -2
  35. package/dist/computers.js +9 -5
  36. package/dist/console/assets/index-B8Zn1Iqn.css +1 -0
  37. package/dist/console/assets/index-Jbxjcmdp.js +705 -0
  38. package/dist/console/index.html +2 -2
  39. package/dist/console-links.js +3 -3
  40. package/dist/decision-cap.d.ts +2 -5
  41. package/dist/decision-cap.js +3 -6
  42. package/dist/decision-rows.js +11 -11
  43. package/dist/email/account.d.ts +83 -0
  44. package/dist/email/account.js +159 -0
  45. package/dist/email/answer.d.ts +15 -0
  46. package/dist/email/answer.js +217 -0
  47. package/dist/email/email-faux.d.ts +95 -0
  48. package/dist/email/email-faux.js +849 -0
  49. package/dist/email/labels.d.ts +1 -0
  50. package/dist/email/labels.js +84 -0
  51. package/dist/email/mail.d.ts +186 -0
  52. package/dist/email/mail.js +373 -0
  53. package/dist/email/names.d.ts +50 -0
  54. package/dist/email/names.js +74 -0
  55. package/dist/email/routes.d.ts +10 -0
  56. package/dist/email/routes.js +50 -0
  57. package/dist/email/tools.d.ts +27 -0
  58. package/dist/email/tools.js +562 -0
  59. package/dist/environment.d.ts +17 -2
  60. package/dist/environment.js +36 -8
  61. package/dist/errors.d.ts +6 -0
  62. package/dist/errors.js +12 -0
  63. package/dist/eval-mailbox.d.ts +103 -0
  64. package/dist/eval-mailbox.js +236 -0
  65. package/dist/graph-view.d.ts +9 -2
  66. package/dist/graph-view.js +6 -2
  67. package/dist/harness-install.d.ts +28 -2
  68. package/dist/harness-install.js +147 -59
  69. package/dist/harness-opencode/adapter.js +2 -26
  70. package/dist/harness-opencode/facts.js +5 -2
  71. package/dist/harness-opencode/host/policy.d.ts +2 -0
  72. package/dist/harness-opencode/host/policy.js +10 -5
  73. package/dist/harness-opencode/index.d.ts +1 -1
  74. package/dist/harness-opencode/index.js +1 -1
  75. package/dist/harness-opencode/versions.d.ts +6 -0
  76. package/dist/harness-opencode/versions.js +6 -0
  77. package/dist/harness-table.js +8 -5
  78. package/dist/harness.d.ts +12 -0
  79. package/dist/harness.js +15 -3
  80. package/dist/hosted-search.d.ts +3 -1
  81. package/dist/hosted-search.js +51 -11
  82. package/dist/import-sources.d.ts +1 -1
  83. package/dist/import-sources.js +3 -3
  84. package/dist/import.d.ts +21 -0
  85. package/dist/import.js +186 -1
  86. package/dist/key-check.d.ts +0 -2
  87. package/dist/key-check.js +3 -4
  88. package/dist/key-refusal.d.ts +8 -2
  89. package/dist/key-refusal.js +16 -13
  90. package/dist/learn/check.d.ts +18 -3
  91. package/dist/learn/check.js +328 -3
  92. package/dist/learn/compile.d.ts +12 -4
  93. package/dist/learn/compile.js +57 -20
  94. package/dist/learn/grade.d.ts +4 -0
  95. package/dist/learn/grade.js +4 -1
  96. package/dist/learn/promote.d.ts +130 -64
  97. package/dist/learn/promote.js +113 -202
  98. package/dist/learn/refit.d.ts +21 -12
  99. package/dist/learn/refit.js +51 -23
  100. package/dist/learn/replay-calls.js +1 -1
  101. package/dist/learn/skills.d.ts +2 -7
  102. package/dist/learn/skills.js +28 -14
  103. package/dist/learned-nodes.d.ts +15 -7
  104. package/dist/learned-nodes.js +29 -5
  105. package/dist/learned-workflow.d.ts +41 -31
  106. package/dist/learned-workflow.js +122 -63
  107. package/dist/learning-batch.js +3 -3
  108. package/dist/learning-cost.d.ts +35 -8
  109. package/dist/learning-cost.js +27 -9
  110. package/dist/learning-routes.d.ts +2 -4
  111. package/dist/learning-routes.js +20 -3
  112. package/dist/learning-words.d.ts +1 -1
  113. package/dist/learning-words.js +4 -1
  114. package/dist/learning.d.ts +5 -5
  115. package/dist/link-check.d.ts +27 -0
  116. package/dist/link-check.js +164 -0
  117. package/dist/local-models.d.ts +39 -2
  118. package/dist/local-models.js +49 -5
  119. package/dist/mcp-pin-first.js +6 -0
  120. package/dist/mcp-secret-writes.js +3 -0
  121. package/dist/mcp-servers-store.d.ts +25 -16
  122. package/dist/mcp-servers-store.js +23 -3
  123. package/dist/model-form.d.ts +11 -0
  124. package/dist/model-form.js +17 -1
  125. package/dist/model.d.ts +26 -6
  126. package/dist/model.js +126 -18
  127. package/dist/monid.d.ts +26 -31
  128. package/dist/monid.js +84 -79
  129. package/dist/native/binding.d.ts +13 -0
  130. package/dist/native/binding.js +57 -0
  131. package/dist/native/cli.d.ts +2 -0
  132. package/dist/native/cli.js +48 -0
  133. package/dist/native/connection.d.ts +8 -0
  134. package/dist/native/connection.js +94 -0
  135. package/dist/native/context.d.ts +6 -0
  136. package/dist/native/context.js +22 -0
  137. package/dist/native/discovery.d.ts +27 -0
  138. package/dist/native/discovery.js +404 -0
  139. package/dist/native/environment.d.ts +4 -0
  140. package/dist/native/environment.js +18 -0
  141. package/dist/native/history.d.ts +20 -0
  142. package/dist/native/history.js +147 -0
  143. package/dist/native/instructions.d.ts +21 -0
  144. package/dist/native/instructions.js +173 -0
  145. package/dist/native/remote-worker-bridge.d.ts +3 -0
  146. package/dist/native/remote-worker-bridge.js +278 -0
  147. package/dist/native/remote.d.ts +187 -0
  148. package/dist/native/remote.js +492 -0
  149. package/dist/native/runtime.d.ts +17 -0
  150. package/dist/native/runtime.js +316 -0
  151. package/dist/native/runtimes.d.ts +66 -0
  152. package/dist/native/runtimes.js +41 -0
  153. package/dist/native/schema.d.ts +46 -0
  154. package/dist/native/schema.js +41 -0
  155. package/dist/native/types.d.ts +87 -0
  156. package/dist/native/types.js +1 -0
  157. package/dist/observation/http.d.ts +4 -0
  158. package/dist/observation/http.js +140 -0
  159. package/dist/observation/observer.d.ts +301 -0
  160. package/dist/observation/observer.js +919 -0
  161. package/dist/observation/schema.d.ts +52 -0
  162. package/dist/observation/schema.js +154 -0
  163. package/dist/openapi.d.ts +2 -1
  164. package/dist/openapi.js +404 -93
  165. package/dist/paid-calls.d.ts +8 -3
  166. package/dist/paid-calls.js +6 -2
  167. package/dist/place-offers.d.ts +4 -8
  168. package/dist/place-offers.js +4 -9
  169. package/dist/port-models.d.ts +10 -2
  170. package/dist/port-models.js +6 -2
  171. package/dist/print.d.ts +4 -2
  172. package/dist/print.js +4 -3
  173. package/dist/propose.d.ts +1 -2
  174. package/dist/propose.js +10 -1
  175. package/dist/provider.d.ts +5 -1
  176. package/dist/provider.js +8 -0
  177. package/dist/push-handler.d.ts +3 -2
  178. package/dist/push-handler.js +20 -6
  179. package/dist/refusal-words.d.ts +14 -0
  180. package/dist/refusal-words.js +16 -2
  181. package/dist/run-launch.d.ts +12 -1
  182. package/dist/run-launch.js +13 -4
  183. package/dist/run-learning-served.d.ts +75 -2
  184. package/dist/run-manifest.d.ts +3 -0
  185. package/dist/run-manifest.js +13 -1
  186. package/dist/run-reads-over-store.d.ts +3 -3
  187. package/dist/run-reads-over-store.js +13 -10
  188. package/dist/run-timeline-served.d.ts +3 -2
  189. package/dist/run-timeline-served.js +8 -9
  190. package/dist/run-view.d.ts +44 -38
  191. package/dist/run-view.js +93 -56
  192. package/dist/runnable.d.ts +13 -5
  193. package/dist/runnable.js +69 -60
  194. package/dist/runner/adapter-loop.d.ts +48 -13
  195. package/dist/runner/adapter-loop.js +691 -254
  196. package/dist/runner/adapter-run-spec.d.ts +38 -12
  197. package/dist/runner/adapter-run-spec.js +175 -106
  198. package/dist/runner/adapters/pi.d.ts +24 -0
  199. package/dist/runner/adapters/pi.js +59 -9
  200. package/dist/runner/beside.d.ts +3 -1
  201. package/dist/runner/beside.js +24 -8
  202. package/dist/runner/claim-secrets.d.ts +3 -1
  203. package/dist/runner/claim-secrets.js +28 -4
  204. package/dist/runner/cli-run-spec.d.ts +30 -0
  205. package/dist/runner/cli-run-spec.js +95 -50
  206. package/dist/runner/computer-channel.d.ts +5 -2
  207. package/dist/runner/computer-channel.js +3 -2
  208. package/dist/runner/computer-journal.d.ts +6 -0
  209. package/dist/runner/computer-journal.js +8 -10
  210. package/dist/runner/conformance/harness.js +6 -3
  211. package/dist/runner/end-of-run.d.ts +2 -0
  212. package/dist/runner/end-of-run.js +3 -1
  213. package/dist/runner/feedback-round.d.ts +40 -13
  214. package/dist/runner/feedback-round.js +64 -16
  215. package/dist/runner/harness-loops.js +17 -0
  216. package/dist/runner/journal-kinds.d.ts +59 -13
  217. package/dist/runner/journal-kinds.js +48 -5
  218. package/dist/runner/learning-dispatch.d.ts +3 -2
  219. package/dist/runner/learning-dispatch.js +6 -6
  220. package/dist/runner/learning-end.d.ts +4 -0
  221. package/dist/runner/learning-end.js +64 -36
  222. package/dist/runner/learning-factory.d.ts +3 -0
  223. package/dist/runner/learning-factory.js +8 -2
  224. package/dist/runner/learning-loop.d.ts +2 -0
  225. package/dist/runner/learning-loop.js +19 -4
  226. package/dist/runner/loop.d.ts +18 -0
  227. package/dist/runner/loop.js +34 -0
  228. package/dist/runner/main.d.ts +6 -1
  229. package/dist/runner/main.js +26 -4
  230. package/dist/runner/mcp-run.d.ts +4 -1
  231. package/dist/runner/mcp-run.js +11 -5
  232. package/dist/runner/meta-tools.d.ts +10 -3
  233. package/dist/runner/meta-tools.js +112 -36
  234. package/dist/runner/metrics.d.ts +80 -21
  235. package/dist/runner/metrics.js +114 -39
  236. package/dist/runner/model-route.d.ts +14 -3
  237. package/dist/runner/model-route.js +155 -19
  238. package/dist/runner/monid-run.d.ts +8 -6
  239. package/dist/runner/monid-run.js +117 -43
  240. package/dist/runner/native-loop.d.ts +11 -0
  241. package/dist/runner/native-loop.js +438 -0
  242. package/dist/runner/promotion.d.ts +76 -10
  243. package/dist/runner/promotion.js +476 -154
  244. package/dist/runner/redact.js +3 -0
  245. package/dist/runner/reflect-hook.js +9 -0
  246. package/dist/runner/runner.d.ts +7 -1
  247. package/dist/runner/runner.js +8 -4
  248. package/dist/runner/sdk-loop.d.ts +7 -0
  249. package/dist/runner/sdk-loop.js +470 -0
  250. package/dist/runner/spec-holds.d.ts +16 -2
  251. package/dist/runner/spec-holds.js +42 -14
  252. package/dist/runner/store-secrets.js +17 -2
  253. package/dist/runner/workflow-first.d.ts +30 -20
  254. package/dist/runner/workflow-first.js +22 -32
  255. package/dist/runner/workflow-loop.d.ts +1 -1
  256. package/dist/runner/workflow-loop.js +18 -12
  257. package/dist/runner/workflow-spec.d.ts +4 -1
  258. package/dist/runner/workflow-spec.js +56 -45
  259. package/dist/runs-over-store.d.ts +30 -2
  260. package/dist/runs-over-store.js +46 -14
  261. package/dist/sdk/runs.d.ts +115 -0
  262. package/dist/sdk/runs.js +422 -0
  263. package/dist/sdk/schema.d.ts +175 -0
  264. package/dist/sdk/schema.js +138 -0
  265. package/dist/sdk/workflows.d.ts +22 -0
  266. package/dist/sdk/workflows.js +39 -0
  267. package/dist/secrets.d.ts +2 -0
  268. package/dist/secrets.js +19 -1
  269. package/dist/server.d.ts +48 -32
  270. package/dist/server.js +568 -137
  271. package/dist/skill-route.d.ts +3 -0
  272. package/dist/skill-route.js +16 -0
  273. package/dist/skills/agentrun-serve/SKILL.md +368 -0
  274. package/dist/stats.d.ts +10 -10
  275. package/dist/store/agent-body.d.ts +12 -8
  276. package/dist/store/agent-body.js +9 -4
  277. package/dist/store/dialect.d.ts +3 -0
  278. package/dist/store/dialect.js +1 -0
  279. package/dist/store/index.d.ts +1 -1
  280. package/dist/store/native-command-owner.d.ts +10 -0
  281. package/dist/store/native-command-owner.js +47 -0
  282. package/dist/store/postgres/connection.d.ts +11 -5
  283. package/dist/store/postgres/connection.js +44 -17
  284. package/dist/store/postgres/dialect.js +5 -0
  285. package/dist/store/postgres/migrations/0012_revision_monid_pin.sql +4 -0
  286. package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
  287. package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
  288. package/dist/store/postgres/store.d.ts +7 -3
  289. package/dist/store/postgres/store.js +4 -0
  290. package/dist/store/schema.d.ts +7 -0
  291. package/dist/store/schema.js +20 -1
  292. package/dist/store/sqlite/connection.js +72 -8
  293. package/dist/store/sqlite/run-launch.d.ts +11 -0
  294. package/dist/store/sqlite/run-launch.js +8 -0
  295. package/dist/store/sqlite/run-patch.d.ts +8 -1
  296. package/dist/store/sqlite/run-patch.js +14 -3
  297. package/dist/store/sqlite/store.js +170 -34
  298. package/dist/store/sqlite/worker.d.ts +2 -0
  299. package/dist/store/sqlite/worker.js +13 -10
  300. package/dist/store/store.d.ts +67 -7
  301. package/dist/store-reads/analytics.d.ts +7 -7
  302. package/dist/store-reads/analytics.js +23 -5
  303. package/dist/store-reads/cap.js +8 -6
  304. package/dist/store-reads/journal.d.ts +5 -0
  305. package/dist/store-reads/journal.js +85 -41
  306. package/dist/store-reads/learning.d.ts +115 -18
  307. package/dist/store-reads/learning.js +170 -68
  308. package/dist/store-reads/runs.d.ts +5 -0
  309. package/dist/store-reads/runs.js +3 -2
  310. package/dist/store-view.js +75 -21
  311. package/dist/template-eval.d.ts +73 -11
  312. package/dist/template-eval.js +535 -75
  313. package/dist/templates.d.ts +84 -21
  314. package/dist/templates.js +254 -47
  315. package/dist/text-urls.d.ts +38 -0
  316. package/dist/text-urls.js +170 -0
  317. package/dist/timeline/index.d.ts +3 -2
  318. package/dist/timeline/index.js +3 -2
  319. package/dist/timeline/labels.d.ts +5 -2
  320. package/dist/timeline/labels.js +29 -6
  321. package/dist/timeline/origin.d.ts +1 -1
  322. package/dist/timeline/origin.js +2 -2
  323. package/dist/timeline/render-text.js +1 -1
  324. package/dist/timeline/timeline.d.ts +66 -4
  325. package/dist/timeline/timeline.js +160 -30
  326. package/dist/timeline/util.d.ts +5 -0
  327. package/dist/timeline/util.js +44 -8
  328. package/dist/timeline/web-calls.d.ts +17 -0
  329. package/dist/timeline/web-calls.js +106 -0
  330. package/dist/tool-gate.d.ts +46 -44
  331. package/dist/tool-gate.js +101 -92
  332. package/dist/tool-list.d.ts +4 -1
  333. package/dist/tool-list.js +8 -1
  334. package/dist/tool-names.d.ts +18 -13
  335. package/dist/tool-names.js +19 -17
  336. package/dist/tool-plane.d.ts +17 -13
  337. package/dist/tool-plane.js +12 -5
  338. package/dist/tools.d.ts +57 -16
  339. package/dist/tools.js +33 -28
  340. package/dist/trigger-adapter.d.ts +56 -5
  341. package/dist/trigger-adapter.js +6 -0
  342. package/dist/trigger-adapters.js +3 -1
  343. package/dist/trigger-composio.d.ts +10 -0
  344. package/dist/trigger-composio.js +122 -0
  345. package/dist/trigger-email.d.ts +4 -0
  346. package/dist/trigger-email.js +181 -0
  347. package/dist/trigger-signatures.d.ts +6 -10
  348. package/dist/trigger-signatures.js +16 -16
  349. package/dist/trigger-targets.d.ts +1 -1
  350. package/dist/trigger-targets.js +4 -3
  351. package/dist/trigger-webhook.js +6 -4
  352. package/dist/triggers.d.ts +105 -8
  353. package/dist/triggers.js +286 -62
  354. package/dist/uploads.d.ts +9 -0
  355. package/dist/uploads.js +27 -0
  356. package/dist/validate.js +1 -7
  357. package/dist/web-fake.d.ts +56 -0
  358. package/dist/web-fake.js +102 -0
  359. package/dist/web-fetch-direct.d.ts +3 -0
  360. package/dist/web-fetch-direct.js +4 -1
  361. package/dist/web-fetch.d.ts +5 -1
  362. package/dist/web-fetch.js +8 -31
  363. package/dist/web-search.d.ts +51 -2
  364. package/dist/web-search.js +116 -18
  365. package/dist/webhooks.d.ts +2 -1
  366. package/dist/webhooks.js +5 -1
  367. package/dist/workflow/decision-recovery.js +5 -2
  368. package/dist/workflow/decisions.d.ts +7 -0
  369. package/dist/workflow/node-runner.js +10 -2
  370. package/dist/workspace/archil-claim.d.ts +3 -0
  371. package/dist/workspace/archil-claim.js +9 -2
  372. package/dist/workspace/computer-deps.d.ts +22 -9
  373. package/dist/workspace/computer-deps.js +78 -37
  374. package/dist/workspace/computer-for-claim.d.ts +54 -4
  375. package/dist/workspace/computer-for-claim.js +179 -39
  376. package/dist/workspace/computer-janitor.d.ts +10 -3
  377. package/dist/workspace/computer-janitor.js +96 -29
  378. package/dist/workspace/computer-kept.d.ts +82 -0
  379. package/dist/workspace/computer-kept.js +147 -0
  380. package/dist/workspace/computer-mcp.js +4 -3
  381. package/dist/workspace/computer-ports.d.ts +23 -3
  382. package/dist/workspace/computer-ports.js +115 -5
  383. package/dist/workspace/index.d.ts +1 -2
  384. package/dist/workspace/index.js +1 -2
  385. package/dist/workspace/kind-skills/desktop/SKILL.md +25 -18
  386. package/dist/workspace/kind-skills/phone/SKILL.md +28 -17
  387. package/dist/workspace/resolve-computer.d.ts +15 -3
  388. package/dist/workspace/resolve-computer.js +10 -7
  389. package/dist/workspace/revision-skills.d.ts +6 -2
  390. package/dist/workspace/revision-skills.js +12 -5
  391. package/dist/workspace/run-end-computers.d.ts +30 -0
  392. package/dist/workspace/run-end-computers.js +137 -0
  393. package/dist/workspace/run-tools.d.ts +28 -29
  394. package/dist/workspace/run-tools.js +29 -30
  395. package/dist/wrap-up.d.ts +19 -5
  396. package/dist/wrap-up.js +31 -4
  397. package/package.json +13 -9
  398. package/skills/agentrun-serve/SKILL.md +248 -10
  399. package/templates/README.md +117 -23
  400. package/templates/TOOLS.md +168 -0
  401. package/templates/code-review/agent.md +18 -4
  402. package/templates/code-review/evals/mentions-defused/case.yaml +1 -1
  403. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +2 -1
  404. package/templates/code-review/evals/other-repo/case.yaml +1 -1
  405. package/templates/code-review/evals/pasted-by-reference/case.yaml +5 -0
  406. package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
  407. package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
  408. package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -0
  409. package/templates/code-review/skills/review/DEEP.md +2 -2
  410. package/templates/code-review/skills/review/REVIEWER.md +2 -2
  411. package/templates/code-review/skills/review/SKILL.md +7 -3
  412. package/templates/release-notes/evals/draft-not-publish/case.yaml +1 -1
  413. package/templates/release-notes/evals/issue-write-refused/case.yaml +1 -1
  414. package/templates/release-notes/evals/late-arrival/case.yaml +1 -1
  415. package/templates/release-notes/evals/other-repo/case.yaml +1 -1
  416. package/dist/console/assets/index-CjqQirbo.css +0 -1
  417. package/dist/console/assets/index-b6-XY5A9.js +0 -576
  418. package/dist/host-calls.d.ts +0 -20
  419. package/dist/host-calls.js +0 -12
  420. package/dist/runner/adapters/pi-computer.d.ts +0 -9
  421. package/dist/runner/adapters/pi-computer.js +0 -51
  422. package/dist/workspace/computer-script.d.ts +0 -53
  423. package/dist/workspace/computer-script.js +0 -172
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:
@@ -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
 
@@ -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,8 +310,8 @@ 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
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.
@@ -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
@@ -738,13 +767,16 @@ passes the binding's conformance cases (below) needs no change here.
738
767
  region and that region's S3 URL (and an exec image pinned by digest, if you want one other than serve's default);
739
768
  `DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by digest (git 2.47),
740
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
741
- git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Modal, E2B or Agent37 sandbox would mount
742
- the run's folder from its disk, but it needs Archil's image in your own vendor account, and this server can't put it
743
- there yet. Settings shows them not ready, an agent's save warns, and a run's start refuses them (409) before any
744
- computer is made. Docker's sandbox is refused, since
745
- it cannot mount the disk, and so is Daytona's, since Archil's client hangs on its sandboxes. So in Mode 2 no sandbox
746
- runs for now. An E2B or Agent37 desktop would mount the folder as well (it has files and exec), so it is not ready
747
- and refused at the start in the same words.
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.
748
780
 
749
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
750
782
  `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
@@ -812,10 +844,10 @@ DAYTONA_API_KEY=... python3 packages/computer/box/build-daytona.py # prints sn
812
844
  A Daytona computer takes no Archil mount, so this server never holds a run's folder on one (see Mode 2 above). A
813
845
  Daytona [box](#sandbox) never reads it.
814
846
 
815
- A desktop, a phone and a browser run in either mode, except a desktop that would mount the owner's disk in Mode 2 (E2B's,
816
- Agent37's), which needs Archil's image in your vendor account first (see Mode 2 above). The run's folder is at
847
+ A desktop, a phone and a browser run in either mode. The run's folder is at
817
848
  `/workspace` in every computer that mounts it: a sandbox always, and a desktop whose provider mounts the mode's folder
818
- (Docker's in Mode 1). A phone and a browser never mount it.
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.
819
851
 
820
852
  **Where `bash` runs.** It follows the mount:
821
853
 
@@ -845,9 +877,12 @@ no computer.
845
877
  registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. From a
846
878
  server in a container the proxy also refuses the Docker host's own addresses, which the server reads through the socket
847
879
  ([in the published image](#in-the-published-image)). A
848
- Daytona, Modal, E2B or Agent37 sandbox has no network of its own (loopback only). A phone and a hosted browser are on their
849
- vendor's own network, whatever the list says. Local Chrome is open unless this server sets `AGENTRUN_BOX_ALLOW`; then
850
- 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
851
886
  `AGENTRUN_BOX_ALLOW=none`, each of these is refused at the run's start, in words that name the setting.
852
887
 
853
888
  **Docker.** A Docker computer runs where this server's Docker answers. With `AGENTRUN_BOXES` not set at all (a plain
@@ -876,11 +911,11 @@ its provider's capable everyday model, not its dearest ($2 in and $10 out per mi
876
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`
877
912
  or `strong`), and the host maps it, `fast` to `AGENT_MODEL_FAST` and `strong` to `AGENT_MODEL_STRONG`, each falling back
878
913
  to `AGENT_MODEL`. Capabilities show the mapping in `models` (`{source, route_prefix, fast, default, strong}`):
879
- `source` is `gateway`, `providers` or `faux` (the published document marks these as `models/2`, beyond the contract's
880
- `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
881
916
  model ids (`agent-model`), which a client takes off to show the gateway's own id, and null with any other source.
882
917
  `models` also says `ready`, whether a revision that names no model runs here, and when it does not, `needs`: `key` (no
883
- 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
884
919
  know); and `priced`, whether that model has a price here, which a run's `max_cost_usd` needs (false for a gateway
885
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:
886
921
 
@@ -911,6 +946,8 @@ model with no price set that the catalog does not list in any form; null while `
911
946
  gets that as a warning. One
912
947
  without a cap runs, on every harness, with each request's cost unknown: codex's and opencode's proxy books it unknown,
913
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.
914
951
  - Otherwise pi-ai's providers serve them, each with its key from the environment (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
915
952
  `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, Bedrock's `AWS_*` keys, ...), and its catalog prices the run. The `AGENT_MODEL`
916
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
@@ -945,6 +982,52 @@ above the harness's highest runs at that highest (Codex and OpenCode stop at `xh
945
982
  (`src/effort-guidance.ts`): `low` answers directly, `medium` plans briefly and checks once, `high` plans each part, fills
946
983
  the gaps and reviews. A run with no level, or one above `high`, gets no note.
947
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
+
948
1031
  ## Tools
949
1032
 
950
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
@@ -998,8 +1081,11 @@ length, and no `original_chars`, its text is the start of the page, and the last
998
1081
  1,000,000 characters of HTML before reading; the rest wasn't read.` `converted: "text"` says the text is the page's
999
1082
  plain text, its conversion to markdown having run out of time. A page is read to its first 1,000,000 characters: an
1000
1083
  `offset` at or past them is refused, and the last part a read reaches of a longer page has `beyond_read`. The links,
1001
- absolute http(s) only, come with the part at offset 0: at most 200, in 20,000 characters, with `links_omitted`
1002
- 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
1003
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
1004
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
1005
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
@@ -1022,27 +1108,37 @@ A run lists every tool to the model in full until its catalog tools (an MCP serv
1022
1108
  (`DEFER_CATALOG_OVER`, `defersCatalog` in the kernel). Then they are deferred: not listed, found with `tools_search` and
1023
1109
  run with `tools_call` (built-ins and pi's own tools are always listed). Under 20, there is no search or call: they
1024
1110
  would find tools the model already has, at about 640 tokens on every request. Claude Code defers MCP tools itself (its
1025
- ToolSearch, on under the same test), so it is offered neither of the two; Codex has them and keeps its own code mode.
1026
- `codemode` is offered on every run (not Codex). Each of the three has a tool-settings key of its own, allow by default:
1027
- set to `deny`, it is not offered at all, and a call to it is refused. None of them goes around the run's tool settings:
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:
1028
1119
 
1029
1120
  - `tools_search {query, limit?}` ranks the run's tools by what they do and answers each match's name, description and
1030
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
1031
1122
  three.
1032
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
1033
- gate by that tool's name, and recorded and booked under `<callId>/call`. An ask parks the run, a deny refuses it in the gate's words, and a name the run has no tool by (or one of these three)
1034
- is refused in words with nothing run.
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.
1035
1126
  - `codemode {script}` runs a JavaScript script (the body of an async function) in a QuickJS sandbox. Its
1036
- `await tools.<name>(args)` calls are each the tool's own call, under `<callId>/s<n>`, answered one at a time. The
1037
- sandbox has the tools and nothing else of the run: no environment, key, file, network or timer. A script runs at most
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
1038
1133
  10 minutes in 256 MiB. A call that needs approval parks the run, and the script follows Codex's rule. Once a person
1039
1134
  answers, the script runs again from its start, and the calls it already made answer from their records. The parked
1040
- call runs once (or is refused), its outcome is the script's answer, and the rest of the script does not run. A
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
1041
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.
1042
1138
 
1043
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
1044
- call is, so the cap holds it. On pi with a desktop or a phone, `codemode` is pi's own code mode (see
1045
- [Computers](#computers)), offered in place of this one.
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)).
1046
1142
 
1047
1143
  ### Subagents
1048
1144
 
@@ -1219,7 +1315,9 @@ Keyless Exa, where `web_search` resolves to it, searches through Exa's public MC
1219
1315
  the search query (cut at 200 characters) and the number of results asked for (1 to 8, 5 by default), nothing else
1220
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,
1221
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
1222
- 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
1223
1321
  included, so a call never hangs. The answer is the query and its results, each a URL, a title, a
1224
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
1225
1323
  relies on. Keyless Exa is the default for a harness with no native search when the server holds no Parallel key; `off`
@@ -1414,12 +1512,13 @@ An agent is granted [monid](https://monid.ai)'s data endpoints on one key, `MONI
1414
1512
  `monid:<provider>/<endpoint>` (one, such as `monid:apollo/people/match`) or `monid:<provider>/*` (every endpoint monid
1415
1513
  lists for the provider, at most 50). Each grant is read against monid's listing when the agent is saved, and pinned on
1416
1514
  that revision with the endpoint's description, its input schema (`pathParams`, `queryParams`, `body`) and its price; a
1417
- provider or endpoint monid does not list, or a grant saved with no monid key, is refused at the save in words. Only an
1418
- endpoint with a fixed price is pinned: one monid prices by usage (per result, per unit, metered) costs what it used,
1419
- known only after it has run, and monid bounds no such call's charge (its `maxCost` checks only its estimate, which such
1420
- a call can pass), so no hold could keep a run's cap. It is refused at the save as a named grant, naming the endpoint
1421
- and why, and a provider's wildcard leaves it out, each left-out endpoint named in the save's `warnings`; a wildcard that
1422
- leaves every endpoint out is refused. 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
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
1423
1522
  harness, named on the wire with `__` for `:` and `/` (`monid__apollo__people__match`), asked about by default, and set by
1424
1523
  its own name or its provider's wildcard in tool settings.
1425
1524
  Each run is paid per call from the monid workspace's wallet, and is sent once, never retried. An async provider's
@@ -1434,9 +1533,21 @@ own (`Tool cost: monid charged $0.0260 for monid:apollo/people/match`) and summe
1434
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
1435
1534
  variant of a matrix; a tiered price's default and every tier), and its approval card shows that hold; its charge
1436
1535
  settles the mark. It is sent with that hold as monid's `maxCost`, so an endpoint monid prices higher now than when the
1437
- agent was saved is refused by monid unrun and uncharged, never booked past its hold. Before it is sent, its price is
1438
- read again from monid (an inspect, which monid does not charge): one monid now prices by usage, whose estimate could
1439
- pass that `maxCost` while its charge does not, is refused unsent, in words naming how monid prices it now. A mark a crash left unsettled leaves the run's cost unknown, as a
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
1440
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
1441
1552
  no cost (`FAILED`, `TIMED_OUT`, one stopped by the run or the wait, one whose sending failed) books an unknown charge,
1442
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
@@ -1444,7 +1555,7 @@ a crash-cut mark does, so the run goes on while its cap allows, in its process a
1444
1555
  one monid says it did not charge (refused as sent, `BLOCKED`, `STOPPED`, the provider's error) books nothing. Under a
1445
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
1446
1557
  fits its `max_cost_usd`, or when the spend is unknown, the call is refused with a `spend_cap_reached` error the model
1447
- reads, naming the endpoint, its hold and the cap, the run pauses on its cap, and monid is never called. Runs go one at a time under a cap, and on
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
1448
1559
  claude-agent and codex the check holds each model request still in flight at its worst case. A run sent holds its
1449
1560
  figure until its charge is in, on every harness: a model request checked meanwhile counts it beside what the run has
1450
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
@@ -1692,9 +1803,12 @@ An agent grants a saved server's tool by its catalog name, `mcp:<server>/<tool>`
1692
1803
  (`"tools": ["mcp:github/list_issues"]`). A save lists each server it grants a tool of, once, and checks each grant
1693
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
1694
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
1695
- is `422` naming the server's tools, and so is a name whose wire name,
1696
- `mcp__<server>__<tool>`, is over 52 characters, or a tool whose `x-mcp-header` declaration cannot be sent (on a
1697
- 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
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
1698
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
1699
1813
  tools has the Claude CLI's own tool search on: the server's tools reach the model only once its ToolSearch finds them,
1700
1814
  and the run's other tools load as they always do. A workflow's nodes bind no MCP
@@ -1712,8 +1826,7 @@ action it runs and deny could target none. Reads mark it `grantable: false` with
1712
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,
1713
1827
  asked by default.
1714
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
1715
- save's `422` says: under `*` for every harness (its wire name `mcp__<server>__<tool>` is past the 52 characters every harness's
1716
- tool names share), or under a harness id when that harness's own MCP client would drop or retype its schema.
1829
+ save's `422` says, under a harness id when that harness's own MCP client would drop or retype its schema.
1717
1830
 
1718
1831
  - **Pinned.** The save keeps each granted tool on the new revision as the server listed it then (its name,
1719
1832
  description, input schema, annotations and price) with the server's URL then, shown as the agent's `mcp_pin` (never
@@ -1963,20 +2076,8 @@ delivery on the payload's tag, for tracing. A request that carries no scheme's s
1963
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
1964
2077
  checked before the body is read.
1965
2078
 
1966
- `composio` takes [Composio](https://composio.dev) trigger events. Register the trigger's `hook_url` as Composio's webhook
1967
- subscription (`POST /api/v3.1/webhook_subscriptions` with `enabled_events: ["composio.trigger.message"]`); Composio
1968
- answers with a `secret` it makes, which you give here, whole and as Composio shows it, with `POST /v2/triggers/{id}/secret`
1969
- and the body `{"secret": "..."}` (the same call replaces it when you rotate it in Composio). A composio trigger is made with no
1970
- 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
1971
- makes one for a composio trigger. Composio signs as Standard Webhooks does (`webhook-id`, `webhook-timestamp`, `webhook-signature`) but keyed by the
1972
- UTF-8 bytes of that secret string, not a decoded `whsec_` key, which is why a `standard` trigger cannot take it. The
1973
- firing's key is `webhook-id`, the event is the body's `metadata.trigger_slug`, so `accept: [{"event":
1974
- "GITHUB_ISSUE_ADDED_EVENT"}]` takes one Composio trigger's events, and a rule's `where` pointers read the payload under
1975
- `/data`. The subscription also delivers account events (`composio.connected_account.expired`,
1976
- `composio.connected_account.activated`, `composio.trigger.disabled`), signed the same way, with no slug: their event is the
1977
- 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
1978
- trigger and its agent: other triggers never see those deliveries, whatever their `accept`. The tag also names
1979
- `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.
1980
2081
 
1981
2082
  `accept` makes a trigger take only the events it names, from the delivery alone:
1982
2083
 
@@ -2042,6 +2143,44 @@ never opens a completed run again for one it already has. A firing to a run that
2042
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`
2043
2144
  with `Retry-After: 30`, recording nothing, and a schedule's time is `skipped`.
2044
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
+
2045
2184
  ### GitHub triggers (Connect GitHub)
2046
2185
 
2047
2186
  A server has at most one GitHub App, made with GitHub's app-manifest flow, and every `github` trigger (and every
@@ -2140,12 +2279,62 @@ carries one line: the checkout's facts, or why there is none (no pull request na
2140
2279
  last words), so its instructions can read the change through the GitHub MCP instead. The checkout is removed when the
2141
2280
  claim ends, and the next claim of the run makes it again.
2142
2281
 
2282
+ ### Email (the server's own account)
2283
+
2284
+ Two ways to give an agent email: Email (IMAP/SMTP, runs on your server, no public URL) vs Composio Gmail (OAuth through
2285
+ Composio, needs a public URL). Email is one account per server: the server signs in to its mail servers itself with the
2286
+ account's app password, reads the mailbox on a timer and sends over SMTP, so nothing outside has to reach the server.
2287
+ Composio Gmail connects the account through Composio's OAuth and calls Gmail through Composio's tools; its events start
2288
+ runs through a [Composio trigger](#composio-triggers), which Composio reaches at the server's public URL.
2289
+
2290
+ **The account.** `PUT /v2/settings/email` saves it, from the owner's signed-in session only (the token is 403). A preset
2291
+ fills the servers: `gmail`, `fastmail` or `icloud`; `other` takes `imap` and `smtp` (`{host, port}`) from the body.
2292
+ `outlook` is refused in words ("Outlook needs Microsoft sign-in, which this server doesn't do yet."). The password is the
2293
+ account's app password (Gmail, iCloud and Fastmail each make one in the account's security settings; the account's own
2294
+ sign-in password is refused by most providers), at most 1,024 characters. It is sealed under the server's seal key
2295
+ (`AGENTRUN_SEAL_KEY`) and is in no answer, event or log line. Every connection is TLS: 993 and 465 from the start, any
2296
+ other port with STARTTLS required. Only `127.0.0.1` is reached in the clear. `POST /v2/settings/email/test` signs in to
2297
+ both servers and sends nothing; `DELETE` forgets the account.
2298
+
2299
+ **The trigger.** `{kind: "email", mailbox?: "INBOX", every_s?: 60, accept?}` reads the mailbox every `every_s` seconds
2300
+ and starts a run for each new message its `accept` takes (a rule's `where` reads `/from`, `/to`, `/subject`, `/text`).
2301
+ It watches from when it is made or turned on: the messages already there, and any that came while it was off, start no
2302
+ runs, and its note says so ("Watching INBOX from now: the 3 messages already there won't start runs."). A create or a
2303
+ turn-on waits for its first check (10 seconds at most), so the answer carries `last_check`. When the first checks fail, the first that signs in says
2304
+ "Couldn't check INBOX until now; watching from now: ...". An edit of its filter or `every_s` keeps its place. Mail this
2305
+ server sent starts none. A mail server out of reach is said in `last_check` and tried at the next time; one that refuses the
2306
+ sign-in 3 times in a row (its first check's among them) turns the trigger off (`sign_in_refused`) until the account is
2307
+ fixed and it is turned on again.
2308
+
2309
+ **The tools.** `email_search`, `email_read`, `email_draft`, `email_send` and `email_file`, host tools on every harness.
2310
+ Reading leaves mail unread, `email_draft` sends nothing, and `email_file` files under a label or folder and never deletes.
2311
+ `email_send` asks a person by default; the others are allowed.
2312
+
2313
+ **Thread scope.** On a run an email trigger started, `email_search`, `email_read` and `email_file` reach only the thread
2314
+ of the message that started it: that message, and every message whose References or In-Reply-To links it, in any
2315
+ mailbox, that its sender took part in. Anything else is answered "outside this run's thread" and never fetched. So the
2316
+ words of an email can't send the agent through the rest of the inbox. An agent's own tool setting `scope: "mailbox"` on
2317
+ one of those three tools reaches the whole account; a run no email started reaches the whole account either way.
2318
+ Composio Gmail tools on the same agent are not thread-scoped.
2319
+
2320
+ **What email_send asks, even on allow.** With `email_send` set to allow, a run's first 5 sends go unasked and each one
2321
+ after asks, saying "this run has sent 5 emails" (the count is the run's own record, so a pause doesn't reset it). This
2322
+ stops two auto-responders answering each other. On a run an email started whose `email_read` is thread-scoped (no
2323
+ `scope: "mailbox"`), a send to anyone outside the thread's people
2324
+ (the account's own address and every From, To and Cc of the thread's messages) asks too, naming them ("eve@example.com
2325
+ is outside this email's thread"). The approval's `summary` ends "Asks because ...". With accounts off, where no one can
2326
+ approve, such a send is refused in those words.
2327
+
2143
2328
  ## Templates
2144
2329
 
2145
2330
  A template package makes a working agent in one call: its definition, its skills and rules, and its triggers, from a
2146
2331
  folder the server ships. `GET /v2/templates` lists them; `POST /v2/templates/{name}/apply` with `{parameters,
2147
2332
  overrides?: {model}}` makes one, or nothing when a check fails (a trigger refused archives the agent it made). A
2148
- package's `version` is SemVer and never `definition.version`, the agent's revision number. The first package is `code-review`, a code review agent for one GitHub repository. The format and the
2333
+ package's `version` is SemVer and never `definition.version`, the agent's revision number. A package's `composio` trigger names its
2334
+ need's toolkit as its `server` (`server: github` for a required `{source: composio, toolkit: github}` need), and apply makes it
2335
+ on the saved Composio server that need maps to, its `config` filled from the parameters it names
2336
+ (`repo: "${parameters.repo}"`); one this server can't set up yet (no public URL, say) is skipped with a
2337
+ warning, as a github trigger is with GitHub not connected. The first package is `code-review`, a code review agent for one GitHub repository. The format and the
2149
2338
  rules of an apply are in [templates/README.md](https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/templates/README.md);
2150
2339
  `agentrun template validate DIR` checks a folder as the server does.
2151
2340
 
@@ -2172,7 +2361,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2172
2361
  | `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
2173
2362
  | `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. |
2174
2363
  | `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. |
2175
- | `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)), 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)). |
2364
+ | `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)). |
2176
2365
  | `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. |
2177
2366
  | `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
2178
2367
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
@@ -2263,7 +2452,9 @@ A run names up to `limits.max_files_per_run`, 20, ready files in `file_ids`: an
2263
2452
  `422` at `file_ids` before anything starts. Each is copied, never linked, into the run's `work/inputs/` at its `path`,
2264
2453
  folders kept, before the run's process starts, whatever its harness; a name already taken gets a suffix (`notes-2.txt`,
2265
2454
  `docs-2/`), the same for the same files in the same order. The run reads them as any file of its workspace, and
2266
- `GET /v2/runs/{id}/files` lists them. An agentic run is told of them in its first message, on every harness: after the
2455
+ `GET /v2/runs/{id}/files` lists them. A run's opening message is saved beside them as `inputs/message.md`, its
2456
+ `content` byte for byte, so an agent can name it to a subagent instead of copying it (a run with no text `content` has
2457
+ 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
2267
2458
  input's `content` and a blank line, one line,
2268
2459
  `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
2269
2460
  take, quoted as a JSON string with a control, format or separator character as its `\uXXXX` escape (so no name forges an
@@ -2348,7 +2539,8 @@ model). A definition naming a
2348
2539
  harness this server does not run yet saves with a warning on `definition.harness`, and a run of it is
2349
2540
  `409 agent_not_runnable` with `details.harness`; it never runs on pi instead. This server runs pi always, and
2350
2541
  `claude-agent`, `codex` and `opencode` when each adapter's package, pins and provider endpoint check out; the harness's
2351
- `reason` says what is missing. `claude-agent` and `codex` install themselves on first use: AgentRun never ships the
2542
+ `reason` says what is missing. With a ChatGPT plan signed in, pi and codex need no key
2543
+ ([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
2352
2544
  Claude Agent SDK or the Codex CLI, and the first run on each (or the first agent saved on it) installs the version AgentRun
2353
2545
  pins (`@anthropic-ai/claude-agent-sdk@0.3.286`, `@openai/codex@0.164.0`) from npm into `<data>/harnesses/claude-agent`
2354
2546
  or `<data>/harnesses/codex`, with the npm that runs the server, once. Each install is pinned by the lock the server
@@ -2490,12 +2682,23 @@ An agent or a run is archived, never deleted: `DELETE` stays `405`. These routes
2490
2682
  Open the link the server prints, once, in a browser. `/` is the console (`apps/console` in the repository), on the
2491
2683
  server's own origin, under a CSP that allows that origin only, but for the provider icons on the Keys page (below):
2492
2684
 
2493
- - **Mission Control**: the store's counts and the latest runs.
2494
- - **Agents**: each agent with its kind and harness, archived ones behind **Archived**. **New agent** and an agent's page:
2495
- a name, a description, a prompt (with its model, thinking level and tools) or a workflow, sent to `POST /v2/agents`;
2496
- an edit is `PUT /v2/agents/{id}/definition` with `If-Match` set to the revision it started from (412 when another came
2497
- first). Its revisions, with **Make current** (`POST /v2/agents/{id}/current`), and **Archive** or **Unarchive**.
2498
- - **Playground**: a run of an agent, on the revision you pick, with its input, followed as it goes.
2685
+ - **Mission Control**: the store's counts, imported history, analytics and the latest runs, available before the first
2686
+ server-run agent and without a model-provider key. Its introduction is dismissible. Connect agent and Query use
2687
+ the coding-agent selector; the page refreshes when you return from your coding agent.
2688
+ - **Agents**: **Build** opens a description composer and local starter templates; **Connected agents** lists definitions,
2689
+ with archived ones behind **Archived**. Build, edit and run actions share the remembered coding-agent dropdown,
2690
+ including **API playground**. Choosing a template prepares its full definition without creating or running it.
2691
+ Each agent opens an overview beside its runs, versions and supported workflow, learning and analytics tabs.
2692
+ - **Learning Dojo** (`#/dojo`): learning across connected agents, read from this server. It shows retained notes,
2693
+ learned skills and workflow drafts, pending reviews, and recent changes with their source runs. Open an agent's
2694
+ Learning tab to inspect its knowledge, enable learning, or review a pending change. Counts say when a read is
2695
+ incomplete; missing results are not shown as zero.
2696
+ - **API playground**: create an agent with `POST /v2/agents`, edit its definition with
2697
+ `PUT /v2/agents/{id}/definition`, query runs with `GET /v2/runs` (or one agent's runs), or start a run on the revision
2698
+ you pick and follow it live. Query links retain the agent, state and archive filters. Build descriptions and
2699
+ templates carry into the editable create request. Edits preserve other configuration and use `If-Match` (412 when
2700
+ another revision came first). Definition management does not require a model-provider key. The existing detailed
2701
+ editor remains available at `#/agents/{id}/edit`, including making an older revision current.
2499
2702
  - **Runs**: every run, newest first, filtered by agent and by state, archived runs behind **Archived**; the address
2500
2703
  keeps the filters. A run's page follows `GET /v2/runs/{id}/timeline` with a long poll, sends messages (an answer while
2501
2704
  it waits on `ask_person`), stops or cancels the run, shows its files and a workflow's graph, and has **Archive** or
@@ -2505,6 +2708,11 @@ server's own origin, under a CSP that allows that origin only, but for the provi
2505
2708
  its credential's state, **Refresh**, **Change** (a credential left empty keeps the saved one) and **Delete**. An
2506
2709
  agent's Tools step lists each saved server's tools; a box ticked grants `mcp:<server>/<tool>`.
2507
2710
 
2711
+ A run that reports learning also has a **Learning result** panel: the outcome, the grader's reasons for keeping or
2712
+ rejecting each proposed item, validation problems, seed and merge revisions, and reported grading usage. Its changed
2713
+ files remain available beside the result. The agent's Learning tab refreshes after returning to the console and
2714
+ while visible, without replacing an open edit or review.
2715
+
2508
2716
  Its files (`index.html`, and Vite's hashed files under `/assets/`) are public and hold no data: everything it shows
2509
2717
  comes through `/v2`. With accounts on (the default) the console asks for the owner's password
2510
2718
  ([your password](#your-password)) and the browser holds the owner's session cookie; a `?token=` link sets no cookie: the
@@ -2565,6 +2773,20 @@ cookie to every server on the same host name, whatever its port, so another app
2565
2773
 
2566
2774
  ## Importing your sessions
2567
2775
 
2776
+ For completed history on another machine, use **Connect agent → Another machine** with **History only** scope.
2777
+ The matching source connector previews the selected project and runtime, then uploads only with the source
2778
+ operator's approval and a destination owner grant that permits history. It starts no execution worker or paid task.
2779
+ See [the remote history guide](../../docs/native-agents.md#import-selected-history). Imports remain history, not live
2780
+ connections or automatic learning.
2781
+
2782
+ The separate local-store CLI importer below requires an approved maintenance window. Verify the source machine,
2783
+ this server's actual data directory, store configuration, seal key and supervisor without exposing credentials.
2784
+ Preview the scope with a dry run and inspect active work before stopping the existing server and runners through
2785
+ their supervisor. Import into the same store, then restart and verify that service, including after an import failure.
2786
+ Never bypass the store lock. This local-store operation has no server endpoint that reads sessions from the browser's
2787
+ machine; importing into a different local store does not populate a remote console. Build, edit, run, query and
2788
+ connection handoffs use the shared coding-agent selector and target this server's matching skill, MCP endpoint and API.
2789
+
2568
2790
  `agentrun-serve import --data DIR` reads the Claude Code, Codex and pi sessions in your own home (`~/.claude/projects`,
2569
2791
  `~/.codex/sessions`, `~/.pi/agent/sessions`) into the data directory, once. Each project folder becomes an agent, with its
2570
2792
  CLAUDE.md or AGENTS.md and its skill folders, and each session becomes a run you can read but not continue. Nothing leaves
@@ -2651,6 +2873,17 @@ definition that sets it keeps it on its revision, `false` included, and an edit
2651
2873
  that never sets it stores nothing, so its revision id is the one it had before the switch. The server's `--learning off`
2652
2874
  turns learning off for every run it starts, whatever the agent says.
2653
2875
 
2876
+ The console uses this existing loop: run, reflect, validate and grade the proposal, retain accepted knowledge, then
2877
+ seed later runs from that knowledge. It reads `GET /v2/agents/{id}/learning` for the agent's retained knowledge and
2878
+ history, and `GET /v2/runs/{id}/learning` and its `/diff` for an individual result. Observation requires no model key;
2879
+ producing new learning requires an agentic run through this server with learning enabled and a configured model.
2880
+
2881
+ Importing Claude Code, Codex or pi session history does not replay learning or connect a live learning stream. A
2882
+ run made directly in an external harness needs that harness to persist compatible learning results through a host
2883
+ integration before the console can display them. Learning Dojo shows this server's actual reflection results, not inferred
2884
+ training scores from imported conversations. Before/after cost and duration are observations, not an accuracy
2885
+ evaluation.
2886
+
2654
2887
  An agent that learns has a learning folder, `learning/` in its folder on the disk (`DATA/disk/agents/<key>/learning/`), in Claude Code's
2655
2888
  auto-memory format:
2656
2889
 
@@ -2945,7 +3178,7 @@ with the token, an archived agent's too:
2945
3178
  `learned_not_active`. Its files are checked again as a restore checks them, and its workflow as the learning checker
2946
3179
  checks a run's draft against the agent's tools and gate (400 with `problems`), then as any workflow revision's save
2947
3180
  (422, or 409 `agent_not_runnable`). The new agent's `tools` are the ones its call nodes call, and it keeps the source
2948
- agent's policy as it is now (its `tool_settings`, `approvals`, `max_cost_usd` and `cap_mode`), never more. Its id is the
3181
+ agent's policy as it is now (its `tool_settings`, `approvals` and `max_cost_usd`), never more. Its id is the
2949
3182
  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
2950
3183
  answers 201 with the agent; the learned workflow stays in the folder, unchanged. It takes the owner's password session
2951
3184
  alone, as an approval does.
@@ -2988,28 +3221,17 @@ definition's `max_cost_usd` above 0 sets that default, and 0 clears it (no defau
2988
3221
  leaves the field out keeps the agent's default, as it keeps its harness and place: leaving a field out never removes a
2989
3222
  spend limit. A workflow definition keeps one the same way. The cap is checked in the run's own process
2990
3223
  before each model request, the agent's and a compaction's alike, on every harness: what the run has spent so far, plus
2991
- what each request still in flight is held at, plus what this request is expected to cost must stay within it, or the
2992
- request is not sent and the run pauses ([below](#a-run-paused-at-its-cap)). A request costs its input, plus the output it
2993
- 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
2994
- `cap_mode`: the run's own (`POST /agents/{id}/runs` with `cap_mode`), else its agent's (a definition's `cap_mode`, kept by
2995
- an edit that leaves it out), else `expected`; only a run with a cap takes one (`422 not_allowed` otherwise).
2996
-
2997
- - `expected`: priced from the previous request of its conversation, as that request's usage reported it. The input it
2998
- read from the cache or wrote to it (`cache_read_input_tokens` and `cache_creation_input_tokens` on Anthropic's API,
2999
- `input_tokens_details.cached_tokens` on the Responses API) at the cache-read price, if that request ended less than 4
3000
- minutes before (Anthropic keeps a cache 5); the rest (its input after the cache, plus what the conversation grew by
3001
- since, one token per byte) at the higher of the input and cache-write prices. With no previous request in hand, or one
3002
- older than 4 minutes, all of the input at that price. On claude-agent, codex and opencode the previous request is the
3003
- session's last on the same model in the run's current process, so a run's first request after a restart is priced
3004
- with nothing cached; on pi it is the conversation's last answer. Output never passes the cap (below); a request that
3005
- misses the cache can, by at most its bound: its input at full price less its input expected. The run's
3006
- `cost.overshoot_bound_usd` serves the bound of the requests in flight. A request's real cost is always booked, never
3007
- 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
3008
- most $Y).`, and its next request is refused, so it pauses at its cap as usual. A request whose cost never comes in (cut,
3009
- stopped, lost) counts at what it was held at, its expected cost, in this process and after a restart alike.
3010
- - `strict`: every input token at the higher of the input and cache-write prices (the provider may bill any of the input as
3011
- a cache write), the worst case: no request passes the cap, and a run whose requests read the cache pauses well before
3012
- it has spent its cap.
3224
+ what each request still in flight is held at, plus the most this request can cost must stay within it, or the
3225
+ request is not sent and the run pauses ([below](#a-run-paused-at-its-cap)). The cap is a hard stop for everything but
3226
+ 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
3227
+ once ([monid](#monid)). A request costs its input, plus the output it
3228
+ is sent with at the output price, plus any fee its tokens do not show (below). Its input is priced at its worst case:
3229
+ every input token at the higher of the input and cache-write prices, since the provider may bill any of it as a cache
3230
+ write and a cache can miss at any request. So no request passes the cap, a cache miss included: a request costs at most
3231
+ what it was held at. A request whose cost never comes in (cut, stopped, lost) counts at that hold, in this process and
3232
+ after a restart alike. A run whose requests read the cache spends less than its holds, so it pauses before it has
3233
+ spent its whole cap; output is clamped to what is left after the input (below), so a run is parked only when what is
3234
+ left cannot pay its next request's whole input and a least answer.
3013
3235
 
3014
3236
  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
3015
3237
  in flight are held at) is under three times the run's typical request, the next request of the run's own model carries
@@ -3057,30 +3279,43 @@ base64's bytes, plus what the provider adds server-side (a tool-use prompt), fro
3057
3279
  claude-agent, codex and opencode uses; there the proxy measures each request's body. On codex and opencode (the
3058
3280
  Responses API) the text the model reads as it is (a message, a call's arguments, a tool's output, a reasoning summary)
3059
3281
  counts at its own bytes, not the JSON escapes around it (`\"`, `\n`), which no token is billed for; tool definitions and
3060
- encrypted reasoning keep every byte. On a route straight to OpenAI (`https://api.openai.com`, codex and opencode), each
3061
- answer request is also counted by OpenAI's own token count (`POST /v1/responses/input_tokens`, with only the credential
3062
- and account headers, and never through a gateway or any other base), and its bound is that count when it is below the
3063
- byte bound. On a route straight to Anthropic
3282
+ encrypted reasoning keep every byte. For a model whose tokenizer is o200k_base (gpt-4o and later, the o-series, on
3283
+ codex and opencode, and on pi and claude-agent through serve's translation), each request is also counted on the host
3284
+ with that vocabulary, plus a stated margin (10% of the count, 16 tokens an item, 256 a request), on every route and with
3285
+ nothing asked of the provider, and its bound is that count when it is below the byte bound. On a route straight to Anthropic
3064
3286
  (`https://api.anthropic.com`, on pi and claude-agent), each answer request is also counted by Anthropic's own free
3065
3287
  token count (`POST /v1/messages/count_tokens`, with only the credential and version headers, and never through a
3066
3288
  gateway or any other base), and its bound is that count plus the tool-use prompt when that is below its bytes. A count
3067
- that fails or takes over 3 seconds leaves the byte bound; the request is never held up or refused for it.
3289
+ that fails or takes over 3 seconds leaves the byte bound; the request is never held up or refused for it. On any route
3290
+ with no count (a Claude model through a gateway), a Messages request on pi or claude-agent that carries the session's
3291
+ last answered request unchanged, apart from the messages it adds, is bounded by what the provider billed that request's
3292
+ whole input at (its answer's input, cache read and cache write tokens) plus the bytes of the messages it adds, each
3293
+ image among them at what it is billed as, when that is below its byte bound: the earlier request's system prompt, tools
3294
+ and messages bill alike in the later one, and what it adds is bounded as the byte bound bounds any body. A request that
3295
+ differs in anything else, or adds a document, keeps its other bounds.
3068
3296
 
3069
3297
  **The smallest cap that works.** The byte bound reads text as about two to three times the tokens it is billed as, and a
3070
- 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
3071
- 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,
3072
- cache write $3.75, cache read $0.30 a million) through the dispatch's own system prompt and tools, five requests (four
3073
- screenshots, then the answer), spending about $0.04 in all:
3074
-
3075
- | Cap mode | Route | First request needs | Five-step run needs | Each further step |
3076
- | --- | --- | --- | --- | --- |
3077
- | `strict` | Through a gateway (OpenRouter): the byte bound | $0.06 | $0.12 | about $0.013 |
3078
- | `strict` | Straight to Anthropic: Anthropic's count | $0.03 | $0.09 | about $0.012 |
3079
- | `expected` (the default) | Either | as `strict` | $0.06 | about $0.007 |
3080
-
3081
- 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
3298
+ 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
3299
+ 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
3300
+ ($3 / $15, cache write $3.75, cache read $0.30 a million) through the dispatch's own system prompt and tools (read,
3301
+ write, edit, the desktop's and `codemode`, with the desktop skill named in the system prompt), five requests (four
3302
+ screenshots, then the answer), spending about $0.04 in all. Through a gateway the first request's byte bound is 9,772
3303
+ 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
3304
+ needs $0.082;
3305
+ straight to Anthropic the count is one recorded from a real desktop run on Sonnet (3,146 tokens at first), so it needs
3306
+ $0.030 and $0.083:
3307
+
3308
+ | Route | First request needs | Five-step run needs | Each further step |
3309
+ | --- | --- | --- | --- |
3310
+ | Through a gateway (OpenRouter): the byte bound, then the last bill | $0.06 | $0.09 | about $0.012 |
3311
+ | Straight to Anthropic: Anthropic's count | $0.03 | $0.09 | about $0.012 |
3312
+
3313
+ A claude-agent run's first request is of the same size (the pinned
3082
3314
  CLI's measured 6,926 bytes with five tools: $0.04 for its first request through a gateway). A cap below these pauses at
3083
- 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.)
3315
+ 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
3316
+ five-step figure does not get every step: straight to Anthropic it parks before its last step, its words naming that
3317
+ figure; through a gateway ($0.08) the wrap-up refuses its last screenshot, the answer's request carries the refusal in
3318
+ place of a screenshot and fits, and it answers.
3084
3319
  `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
3085
3320
  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
3086
3321
  survives a restart, plus each response since, and with them each charge a paid tool booked (a monid endpoint's call, which is itself
@@ -3180,6 +3415,22 @@ refused was never sent: the run's usage counts no request for it, and a run whos
3180
3415
  request sent". A reply the limit cut short says so on the run's timeline: "The reply stopped at 1,500 tokens: all that
3181
3416
  the $0.15 left of the run's $0.50 cap could buy."
3182
3417
 
3418
+ ### A limit on free requests
3419
+
3420
+ 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
3421
+ (an OpenRouter `:free` model and the like, as `harnesses[].free_models` lists them; an OpenRouter router is none, since
3422
+ it bills the model it picks), with no fee beside the request. Its provider's shared daily quota is what a looping run
3423
+ burns. So a run has a limit on those requests: 60, or `AGENTRUN_FREE_MODEL_REQUESTS` (a whole number above 0; anything
3424
+ else refuses the server's start and the runner's). ChatGPT-plan requests don't count. Capabilities'
3425
+ `limits.free_model_requests` says it, and the console says "free model: up to 60 requests" beside the cap of an agent
3426
+ on a free model. A run may make that many; the next is not sent, and the run ends `failed` as one its
3427
+ cap ends, its error `spend_cap_reached`: "Not sent: this run reached its 60-request limit for free models." (the number
3428
+ is the limit). No raise lifts it, and it holds capped or not, on every harness: pi, claude-agent, codex, opencode and a
3429
+ workflow's agent nodes. Every such request of the run counts, its own model's, its subagents', its side calls' (a
3430
+ 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
3431
+ workflow's decision never count, and are never refused by it. The count is read from the run's booking records at each
3432
+ request, so a restart or a claim moved to another runner keeps it.
3433
+
3183
3434
  ### A run paused at its cap
3184
3435
 
3185
3436
  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
@@ -3244,12 +3495,12 @@ A workflow run is capped by the same checks, on the run's one ledger (the kernel
3244
3495
 
3245
3496
  | Step | Held at | Where |
3246
3497
  |---|---|---|
3247
- | A model node's request | its expected cost, as an agentic run's request | the run's ledger |
3498
+ | A model node's request | its worst case, as an agentic run's request | the run's ledger |
3248
3499
  | A call node's `llm` call | the same | the same, as a side request |
3249
3500
  | A call node's paid tool call (Parallel's search or extract) | its fee | the run's ledger, as an agentic run's |
3250
3501
  | A decision on Parallel | its list price for one request, $0.001 | before the driver admits it (`decision-cap.ts`) |
3251
3502
  | 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 |
3252
- | 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 |
3503
+ | 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 |
3253
3504
 
3254
3505
  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
3255
3506
  the cap has no room for is not sent and waits where it stands: the run is `input_required`, state `waiting`, with