@parcha/agentrun-serve 0.1.0-beta.52 → 0.1.0-beta.54

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 (287) hide show
  1. package/CHANGELOG.md +149 -1
  2. package/README.md +295 -37
  3. package/dist/agent-delete.d.ts +5 -6
  4. package/dist/agent-delete.js +30 -67
  5. package/dist/agent-package.d.ts +71 -0
  6. package/dist/agent-package.js +345 -0
  7. package/dist/agent-rows.d.ts +1 -1
  8. package/dist/agents-store.d.ts +26 -20
  9. package/dist/agents-store.js +42 -34
  10. package/dist/api-only.d.ts +25 -6
  11. package/dist/api-only.js +34 -13
  12. package/dist/claude-login.d.ts +1 -0
  13. package/dist/claude-login.js +1 -1
  14. package/dist/cli-learning/cli.d.ts +3 -0
  15. package/dist/cli-learning/cli.js +17 -3
  16. package/dist/cli-learning/connections.js +3 -2
  17. package/dist/cli-learning/schema.js +2 -1
  18. package/dist/cli.js +76 -8
  19. package/dist/composio-preset.d.ts +3 -1
  20. package/dist/composio-preset.js +5 -3
  21. package/dist/composio-triggers.d.ts +4 -0
  22. package/dist/composio-triggers.js +4 -1
  23. package/dist/computer-needs.d.ts +32 -0
  24. package/dist/computer-needs.js +80 -0
  25. package/dist/computer-setting.d.ts +5 -2
  26. package/dist/computer-setting.js +8 -1
  27. package/dist/computers.d.ts +0 -2
  28. package/dist/computers.js +1 -1
  29. package/dist/console/assets/index-B_85An2t.js +745 -0
  30. package/dist/console/assets/index-n1YsbnYh.css +1 -0
  31. package/dist/console/index.html +2 -2
  32. package/dist/console-links.d.ts +1 -0
  33. package/dist/console-links.js +2 -0
  34. package/dist/env-switch.d.ts +14 -0
  35. package/dist/env-switch.js +23 -0
  36. package/dist/errors.d.ts +5 -0
  37. package/dist/errors.js +10 -0
  38. package/dist/eval-previous.js +4 -3
  39. package/dist/fal-price.js +10 -13
  40. package/dist/github-connection.d.ts +50 -1
  41. package/dist/github-connection.js +96 -3
  42. package/dist/github-faux.d.ts +11 -2
  43. package/dist/github-faux.js +138 -7
  44. package/dist/github-pull-request.d.ts +37 -0
  45. package/dist/github-pull-request.js +110 -0
  46. package/dist/handed-secret.d.ts +4 -0
  47. package/dist/handed-secret.js +10 -0
  48. package/dist/harness-archive.d.ts +15 -5
  49. package/dist/harness-archive.js +71 -34
  50. package/dist/harness-check.d.ts +2 -1
  51. package/dist/harness-check.js +36 -95
  52. package/dist/harness-egress.d.ts +23 -0
  53. package/dist/harness-egress.js +69 -0
  54. package/dist/harness-recipe-entry.d.ts +71 -0
  55. package/dist/harness-recipe-entry.js +184 -0
  56. package/dist/harness-recipe.d.ts +73 -6
  57. package/dist/harness-recipe.js +185 -31
  58. package/dist/harness-sign-in.d.ts +29 -0
  59. package/dist/harness-sign-in.js +122 -0
  60. package/dist/harness-table.d.ts +21 -0
  61. package/dist/harness-table.js +58 -3
  62. package/dist/harness-zip.d.ts +6 -0
  63. package/dist/harness-zip.js +203 -0
  64. package/dist/ids.d.ts +11 -0
  65. package/dist/ids.js +36 -0
  66. package/dist/learn/commit.d.ts +14 -1
  67. package/dist/learn/commit.js +156 -1
  68. package/dist/learn/compile.js +22 -8
  69. package/dist/learn/folder.d.ts +5 -0
  70. package/dist/learn/folder.js +10 -1
  71. package/dist/learn/learning.sh +15 -3
  72. package/dist/learn/promote.d.ts +2 -2
  73. package/dist/learn/secrets.js +30 -7
  74. package/dist/learning-routes.d.ts +23 -11
  75. package/dist/learning-routes.js +110 -20
  76. package/dist/learning.d.ts +9 -6
  77. package/dist/learning.js +9 -4
  78. package/dist/live-reach.d.ts +34 -7
  79. package/dist/live-reach.js +76 -11
  80. package/dist/mcp-gateway.js +15 -2
  81. package/dist/mcp-probe.d.ts +3 -0
  82. package/dist/mcp-probe.js +8 -3
  83. package/dist/mcp-resources.d.ts +44 -0
  84. package/dist/mcp-resources.js +100 -0
  85. package/dist/mcp-servers-store.d.ts +16 -12
  86. package/dist/model.d.ts +4 -4
  87. package/dist/model.js +6 -6
  88. package/dist/native/cli.js +9 -2
  89. package/dist/native/connection.d.ts +2 -2
  90. package/dist/native/connection.js +5 -2
  91. package/dist/native/discovery.d.ts +2 -0
  92. package/dist/native/discovery.js +10 -6
  93. package/dist/native/remote-worker-bridge.js +36 -4
  94. package/dist/native/remote.d.ts +18 -1
  95. package/dist/native/remote.js +126 -37
  96. package/dist/native/schema.d.ts +6 -0
  97. package/dist/native/schema.js +31 -6
  98. package/dist/native/source-account.d.ts +13 -0
  99. package/dist/native/source-account.js +114 -0
  100. package/dist/native/source-capture-hooks.d.ts +5 -0
  101. package/dist/native/source-capture-hooks.js +102 -0
  102. package/dist/native/source-mcp-selection.d.ts +13 -0
  103. package/dist/native/source-mcp-selection.js +72 -0
  104. package/dist/native/source-runtime-tools.d.ts +19 -0
  105. package/dist/native/source-runtime-tools.js +103 -0
  106. package/dist/native/source-snapshot-types.d.ts +138 -0
  107. package/dist/native/source-snapshot-types.js +12 -0
  108. package/dist/native/source-snapshot.d.ts +8 -0
  109. package/dist/native/source-snapshot.js +1201 -0
  110. package/dist/observation/learning.js +3 -2
  111. package/dist/openapi.js +275 -40
  112. package/dist/print.js +1 -1
  113. package/dist/purged-workflow.d.ts +12 -0
  114. package/dist/purged-workflow.js +43 -0
  115. package/dist/run-keys.d.ts +46 -0
  116. package/dist/run-keys.js +109 -0
  117. package/dist/run-launch.d.ts +16 -1
  118. package/dist/run-launch.js +30 -1
  119. package/dist/run-learning-served.d.ts +2 -2
  120. package/dist/run-model-key.d.ts +2 -2
  121. package/dist/run-model-key.js +5 -5
  122. package/dist/run-secrets.d.ts +2 -0
  123. package/dist/run-secrets.js +7 -4
  124. package/dist/run-view.d.ts +17 -0
  125. package/dist/run-view.js +25 -1
  126. package/dist/runner/adapter-loop.d.ts +11 -3
  127. package/dist/runner/adapter-loop.js +138 -22
  128. package/dist/runner/adapter-run-spec.js +26 -13
  129. package/dist/runner/audit.d.ts +2 -0
  130. package/dist/runner/audit.js +9 -1
  131. package/dist/runner/beside.js +2 -1
  132. package/dist/runner/claim-secrets.d.ts +29 -3
  133. package/dist/runner/claim-secrets.js +38 -4
  134. package/dist/runner/cli-run-spec.js +24 -13
  135. package/dist/runner/harness-loops.d.ts +6 -0
  136. package/dist/runner/harness-loops.js +11 -1
  137. package/dist/runner/held.d.ts +4 -0
  138. package/dist/runner/journal-kinds.d.ts +2 -0
  139. package/dist/runner/learned-first.d.ts +2 -0
  140. package/dist/runner/learned-first.js +1 -1
  141. package/dist/runner/learning-end.d.ts +7 -2
  142. package/dist/runner/learning-end.js +22 -10
  143. package/dist/runner/learning-seed.d.ts +9 -3
  144. package/dist/runner/learning-seed.js +2 -2
  145. package/dist/runner/main.d.ts +1 -0
  146. package/dist/runner/main.js +20 -13
  147. package/dist/runner/mcp-claim.js +6 -1
  148. package/dist/runner/mcp-run.d.ts +10 -7
  149. package/dist/runner/mcp-run.js +3 -5
  150. package/dist/runner/metrics.d.ts +4 -2
  151. package/dist/runner/metrics.js +15 -3
  152. package/dist/runner/monid-run.js +9 -11
  153. package/dist/runner/pr-checkout.d.ts +21 -4
  154. package/dist/runner/pr-checkout.js +103 -4
  155. package/dist/runner/project-checkpoint.d.ts +35 -0
  156. package/dist/runner/project-checkpoint.js +116 -0
  157. package/dist/runner/project-drain.d.ts +8 -0
  158. package/dist/runner/project-drain.js +25 -0
  159. package/dist/runner/project-host.d.ts +10 -0
  160. package/dist/runner/project-host.js +52 -0
  161. package/dist/runner/promotion.d.ts +14 -6
  162. package/dist/runner/promotion.js +98 -41
  163. package/dist/runner/redact.d.ts +13 -0
  164. package/dist/runner/redact.js +67 -1
  165. package/dist/runner/run-channel.d.ts +9 -0
  166. package/dist/runner/run-channel.js +15 -2
  167. package/dist/runner/run-child-host.d.ts +8 -4
  168. package/dist/runner/run-child-host.js +178 -45
  169. package/dist/runner/run-errors.js +2 -2
  170. package/dist/runner/runner-check.d.ts +3 -0
  171. package/dist/runner/runner-check.js +28 -2
  172. package/dist/runner/runner.js +26 -9
  173. package/dist/runner/store-secrets.js +7 -3
  174. package/dist/runner/workflow-first.d.ts +4 -0
  175. package/dist/runner/workflow-first.js +13 -0
  176. package/dist/runner/workflow-loop.d.ts +2 -1
  177. package/dist/runner/workflow-loop.js +2 -1
  178. package/dist/runner/workflow-spec.js +1 -1
  179. package/dist/runs-over-store.d.ts +34 -6
  180. package/dist/runs-over-store.js +133 -25
  181. package/dist/sdk/runs.d.ts +11 -1
  182. package/dist/sdk/runs.js +117 -26
  183. package/dist/sdk/schema.js +12 -2
  184. package/dist/sdk/workflows.d.ts +1 -1
  185. package/dist/server.d.ts +79 -32
  186. package/dist/server.js +673 -113
  187. package/dist/skills/agentrun-serve/SKILL.md +2 -1
  188. package/dist/source-sync/adoption.d.ts +15 -0
  189. package/dist/source-sync/adoption.js +36 -0
  190. package/dist/source-sync/auxiliary.d.ts +23 -0
  191. package/dist/source-sync/auxiliary.js +64 -0
  192. package/dist/source-sync/capture-git.d.ts +5 -0
  193. package/dist/source-sync/capture-git.js +272 -0
  194. package/dist/source-sync/capture-project.d.ts +53 -0
  195. package/dist/source-sync/capture-project.js +206 -0
  196. package/dist/source-sync/capture-refusal.d.ts +7 -0
  197. package/dist/source-sync/capture-refusal.js +16 -0
  198. package/dist/source-sync/capture.d.ts +11 -0
  199. package/dist/source-sync/capture.js +22 -0
  200. package/dist/source-sync/checkpoint-gate.d.ts +21 -0
  201. package/dist/source-sync/checkpoint-gate.js +52 -0
  202. package/dist/source-sync/checkpoints.d.ts +66 -0
  203. package/dist/source-sync/checkpoints.js +168 -0
  204. package/dist/source-sync/claim.d.ts +11 -0
  205. package/dist/source-sync/claim.js +48 -0
  206. package/dist/source-sync/destination.d.ts +47 -0
  207. package/dist/source-sync/destination.js +239 -0
  208. package/dist/source-sync/io.d.ts +15 -0
  209. package/dist/source-sync/io.js +52 -0
  210. package/dist/source-sync/local.d.ts +43 -0
  211. package/dist/source-sync/local.js +229 -0
  212. package/dist/source-sync/prepare.d.ts +59 -0
  213. package/dist/source-sync/prepare.js +93 -0
  214. package/dist/source-sync/projects.d.ts +61 -0
  215. package/dist/source-sync/projects.js +130 -0
  216. package/dist/source-sync/registry.d.ts +95 -0
  217. package/dist/source-sync/registry.js +226 -0
  218. package/dist/source-sync/service.d.ts +33 -0
  219. package/dist/source-sync/service.js +118 -0
  220. package/dist/source-sync/skill-edits.d.ts +12 -0
  221. package/dist/source-sync/skill-edits.js +122 -0
  222. package/dist/source-sync/snapshots.d.ts +48 -0
  223. package/dist/source-sync/snapshots.js +448 -0
  224. package/dist/source-sync/types.d.ts +9 -0
  225. package/dist/source-sync/types.js +14 -0
  226. package/dist/source-sync/workspace.d.ts +66 -0
  227. package/dist/source-sync/workspace.js +273 -0
  228. package/dist/store/agent-body.d.ts +6 -2
  229. package/dist/store/agent-body.js +18 -7
  230. package/dist/store/index.d.ts +2 -2
  231. package/dist/store/index.js +1 -1
  232. package/dist/store/schema.d.ts +2 -1
  233. package/dist/store/schema.js +2 -1
  234. package/dist/store/seal.d.ts +5 -1
  235. package/dist/store/seal.js +12 -3
  236. package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
  237. package/dist/store/sqlite/project-checkpoints.js +70 -0
  238. package/dist/store/sqlite/run-launch.d.ts +4 -12
  239. package/dist/store/sqlite/run-launch.js +5 -19
  240. package/dist/store/sqlite/store.js +224 -170
  241. package/dist/store/store.d.ts +116 -39
  242. package/dist/store/store.js +14 -1
  243. package/dist/store-reads/learning.d.ts +2 -2
  244. package/dist/store-view.d.ts +3 -1
  245. package/dist/store-view.js +17 -5
  246. package/dist/suggestions.d.ts +282 -0
  247. package/dist/suggestions.js +919 -0
  248. package/dist/telemetry.d.ts +8 -1
  249. package/dist/telemetry.js +12 -4
  250. package/dist/template-import.d.ts +27 -2
  251. package/dist/template-import.js +148 -13
  252. package/dist/templates.d.ts +103 -77
  253. package/dist/templates.js +71 -17
  254. package/dist/timeline/index.d.ts +1 -1
  255. package/dist/timeline/index.js +1 -1
  256. package/dist/timeline/timeline.d.ts +5 -0
  257. package/dist/timeline/timeline.js +8 -0
  258. package/dist/tool-plane.d.ts +12 -12
  259. package/dist/tools.d.ts +8 -8
  260. package/dist/trigger-launch-hook.d.ts +49 -0
  261. package/dist/trigger-launch-hook.js +91 -0
  262. package/dist/trigger-targets.d.ts +14 -1
  263. package/dist/trigger-targets.js +20 -0
  264. package/dist/triggers.d.ts +54 -5
  265. package/dist/triggers.js +143 -8
  266. package/dist/uploads-archil.js +1 -1
  267. package/dist/uploads.js +1 -1
  268. package/dist/validate.d.ts +1 -1
  269. package/dist/validate.js +3 -4
  270. package/dist/workspace/computer-for-claim.d.ts +2 -0
  271. package/dist/workspace/computer-for-claim.js +43 -0
  272. package/dist/workspace/paths.d.ts +6 -0
  273. package/dist/workspace/paths.js +6 -0
  274. package/dist/workspace/resolve-computer.d.ts +1 -0
  275. package/dist/workspace/run-tools.d.ts +2 -0
  276. package/dist/workspace/run-tools.js +8 -0
  277. package/dist/workspace/synced-folder.d.ts +1 -1
  278. package/dist/workspace/synced-folder.js +11 -14
  279. package/launcher/agentrun-serve +1 -1
  280. package/package.json +10 -10
  281. package/skills/agentrun-serve/SKILL.md +2 -1
  282. package/templates/README.md +8 -4
  283. package/templates/agent-scout/agent.md +46 -0
  284. package/templates/agent-scout/skills/scout/SKILL.md +88 -0
  285. package/templates/agent-scout/skills/scout/suggestions.schema.json +112 -0
  286. package/dist/console/assets/index-B-D0EM3j.js +0 -733
  287. package/dist/console/assets/index-DlQepP2J.css +0 -1
package/README.md CHANGED
@@ -14,6 +14,11 @@ sign-in and configuration. Turn **Self-improving** On separately to give later r
14
14
  corrections. Eligible server-run and SDK agents can also compile checked workflows; CLI capture has no workflow
15
15
  bridge. Imported history stays historical and does not automatically train the agent.
16
16
 
17
+ New source connections also keep their setup in sync by default. A supported complete setup can **Move to AgentRun**
18
+ from the same agent page, retaining its identity and history. Destination accounts and unsupported tools/settings
19
+ appear as prerequisites. See [source sync and Move](../../docs/source-sync.md) for scope, project continuity,
20
+ conflicts and current compatibility; `--no-sync` opts out when connecting.
21
+
17
22
  For a source on a different laptop, VM or container, choose **Connection setup → Another machine** and use the
18
23
  matching [Python source connector](../../connector/README.md). Remote execution currently needs the server and
19
24
  connector from the same reviewed development checkout; the published observation-only CLI does not include it.
@@ -206,9 +211,10 @@ names no run, and a store with no such run says nothing; quiet keeps it too.
206
211
 
207
212
  ## Anonymous usage counts
208
213
 
209
- The server sends three anonymous events: `server_started`, a daily `heartbeat` and `first_run_completed`. Each holds
210
- a random id kept in the data directory (`.telemetry.json`), the version, the platform and how many runs ended as a
211
- range; never a prompt, a file, a key or a name.
214
+ The server sends six anonymous events: `server_started`, a daily `heartbeat`, `first_run_completed`, and, for
215
+ suggested agents, `suggestions_scanned`, `suggestion_discarded` and `suggested_agent_created`. Each holds a random id
216
+ kept in the data directory (`.telemetry.json`), the version, the platform and how many runs ended as a range; never a
217
+ prompt, a file, a key, a name or a repository.
212
218
  `AGENTRUN_TELEMETRY=0` or `DO_NOT_TRACK=1` turns it off, as do `CI`, a test runner (`node --test`) and `--faux`; `AGENTRUN_TELEMETRY=debug` prints each
213
219
  event on stderr and sends none. The start that first could send prints one notice and sends nothing at that start.
214
220
  [docs/telemetry.md](../../docs/telemetry.md) lists every field.
@@ -272,7 +278,7 @@ which also says dial for E2B, Daytona or Modal made with `connect: "dial"`) work
272
278
  server's public address, `AGENTRUN_PUBLIC_URL` (the image gives both processes the same environment). The machine dials
273
279
  the server, and the server relays its socket to the runner that made it: the runner keeps its own attach hub on a
274
280
  private listener (loopback; across hosts, its `AGENTRUN_RUNNER_LIVE_HOST`, which the server's `AGENTRUN_RUNNER_HOSTS`
275
- must list), and the server reaches it only with a proof under the seal key for that machine's token, that runner and a
281
+ must list; runners that are replicas with no host name of their own give both an IPv4 block instead, below), and the server reaches it only with a proof under the seal key for that machine's token, that runner and a
276
282
  time within 10 seconds, taken once. A dial it cannot relay (its runner gone, not answering, or restarted since) is
277
283
  answered 503 in words that name the run, `a dial for run <run> (machine <machine>)`, and never the machine's token. The
278
284
  runner's create, waiting for that machine, ends at once in the same words and deletes it; the run makes a new machine at
@@ -723,6 +729,45 @@ AGENTRUN_DOCKER_IMAGE=python:3.12-bookworm AGENTRUN_BOXES=docker node packages/s
723
729
  `sh`, `sleep` and `setsid`, and `bash` for the `bash` tool when there is one (else `sh`). The image's own entrypoint
724
730
  never runs; the box's first process is a `sleep` of its lifetime.
725
731
 
732
+ **The media image.** For an agent that makes video, the computer package keeps a second recipe,
733
+ `packages/computer/media/Dockerfile`: the default image's base, by the same digest, and its programs, plus Node 24 from
734
+ its official tarball (each architecture's sha256 checked), Chromium (also on PATH as `chrome`), FFmpeg and FFprobe,
735
+ Noto (with CJK and colour emoji), Liberation and DejaVu fonts, and the [HyperFrames](https://github.com/heygen-com/hyperframes)
736
+ CLI at an exact version. On amd64 it also has the `chrome-headless-shell` build that CLI pins, by sha256, so a render
737
+ needs no download. The CLI's usage reports and update check are off unless a command turns them on. Nothing builds it for
738
+ you, and no agent setting picks it: build it, then name its tag in `AGENTRUN_DOCKER_IMAGE`. From the repository's root:
739
+
740
+ ```sh
741
+ tag=agentrun-media:$(sha256sum packages/computer/media/Dockerfile | cut -c1-12)
742
+ docker build -t "$tag" - < packages/computer/media/Dockerfile
743
+ AGENTRUN_DOCKER_IMAGE=$tag AGENTRUN_BOXES=docker node packages/serve/dist/cli.js
744
+ ```
745
+
746
+ The tag is the recipe's hash, so an edit to the recipe is a new tag, and a tag already on this machine is used as it is
747
+ (nothing is pulled). Its Debian packages come from snapshot.debian.org (over https) at one instant, and the CLI's npm
748
+ dependencies from the registry as it stood at that instant (by date, not by content), so two builds of one tag install
749
+ the same Debian packages. It is about 2.7 GB on disk. An agent that needs it says so with
750
+ [`computer.needs`](#computers), so a server on another image fails its runs in words instead of running them.
751
+
752
+ **The documents image.** For an agent that writes decks, documents and sheets, `packages/computer/documents` is the
753
+ default image plus the Python and Node libraries that write Office files (python-pptx, python-docx and openpyxl for
754
+ `python3`; pptxgenjs, docx and exceljs for `node`), pinned as its header says. The Node libraries are linked as
755
+ `/node_modules`, so a script in any folder requires or imports them. The libraries are the folder's
756
+ `documents.sh`, the one layer both builds run. Build it and name its tag in `AGENTRUN_DOCKER_IMAGE`:
757
+
758
+ ```sh
759
+ tag=agentrun-documents:$(cat packages/computer/documents/Dockerfile packages/computer/documents/documents.sh | sha256sum | cut -c1-12)
760
+ docker build -t "$tag" packages/computer/documents
761
+ AGENTRUN_DOCKER_IMAGE=$tag AGENTRUN_BOXES=docker node packages/serve/dist/cli.js
762
+ ```
763
+
764
+ On Daytona, `python3 packages/computer/box/build-daytona.py --documents` builds the box
765
+ image with the same layer on top as the snapshot `agentrun-documents-<hash>` (the box recipe's snapshot,
766
+ `agentrun-box-<hash>`, is unchanged); name it in `AGENTRUN_DAYTONA_SNAPSHOT`. An agent that needs them says so in
767
+ `computer.needs` (`["python-pptx", "pptxgenjs"]`), and a box without them ends its runs before any model request; on
768
+ Docker, the words name this image's build. Neither is published, and no agent setting picks one: a server's Docker image, or its
769
+ Daytona snapshot, is one for every agent.
770
+
726
771
  ### In the published image
727
772
 
728
773
  The published image, `ghcr.io/parcha-ai/agentrun-server`, runs Docker sandboxes on the Docker of the host it runs on,
@@ -779,8 +824,8 @@ Settings → Computers. The kind says what the agent is given, and the provider
779
824
  | Kind | What the agent gets | Providers |
780
825
  |---|---|---|
781
826
  | `none` | The run's folder alone: no computer, and no provider (`{"kind": "none"}`) | |
782
- | `sandbox` | A Linux shell, with files and processes | `docker`, `daytona`, `modal`, `e2b`, `boxd`, `smolcloud`, `cloudflare` (through a relay Worker you deploy) |
783
- | `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`, `boxd`, or [a paired computer](#a-persons-own-computer) by its id |
827
+ | `sandbox` | A Linux shell, with files and processes | `docker`, `daytona`, `modal`, `e2b`, `boxd`, `smolcloud`, `groundbox`, `cloudflare` (through a relay Worker you deploy) |
828
+ | `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`, `boxd`, `groundbox`, or [a paired computer](#a-persons-own-computer) by its id |
784
829
  | `phone` | A rented Android, through the same computer tools | `phone-harness` |
785
830
  | `browser` | A hosted browser (the browser tools) | `browserbase`, `kernel` |
786
831
 
@@ -816,7 +861,7 @@ the provider with them and starts nothing. A key set in the server's environment
816
861
  `DAYTONA_API_KEY` (with `DAYTONA_API_URL` and `DAYTONA_TARGET` optional), `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET`,
817
862
  `E2B_API_KEY`, `AGENT37_API_KEY` and `AGENT37_SSH_KEY`, `MORPH_API_KEY`, `ORGO_API_KEY`, `PHONE_HARNESS_API_KEY`,
818
863
  `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`, `KERNEL_API_KEY`, `BOXD_API_KEY` (with `BOXD_ORG` and
819
- `BOXD_REGION` optional), `SMOLCLOUD_API_KEY`, `CLOUDFLARE_RELAY_URL` and `CLOUDFLARE_RELAY_TOKEN` (the relay Worker's,
864
+ `BOXD_REGION` optional), `SMOLCLOUD_API_KEY`, `GROUNDBOX_API_KEY`, `CLOUDFLARE_RELAY_URL` and `CLOUDFLARE_RELAY_TOKEN` (the relay Worker's,
820
865
  `packages/computer/relays/cloudflare`), and `FLY_API_TOKEN` and `FLY_APP`; Docker takes none.
821
866
  The vendors bill their computers by time on their own pages: this server meters no
822
867
  computer time. The older [`place`](#place) is this setting's v2 view: `{"mode": "runner"}` is kind `none`, and
@@ -831,6 +876,31 @@ They apply to Docker computers only: a vendor's computer (Daytona, Modal, E2B, O
831
876
  size its provider makes it, and is never given them. A value the Docker provider refuses stops the server's start, in
832
877
  the provider's words.
833
878
 
879
+ **What a sandbox needs.** A sandbox may list the programs its agent's work needs on the box's PATH:
880
+ `"computer": {"kind": "sandbox", "provider": "docker", "needs": ["chrome", "ffmpeg", "ffprobe", "hyperframes"]}`, 1 to
881
+ 32 names (letters, digits, `.`, `_`, `+` and `-`; no path), each once. A name may also be a library the agent's code
882
+ loads: a Python package by the name pip installs it by (`python-pptx`), which the box's `python3` has installed, or a
883
+ Node package (`pptxgenjs`), which a script of the box's `node` requires (from `node_modules` of the folder the check
884
+ runs in or any folder above it, up to `/node_modules`). A scoped npm package (`@scope/name`) can't be named. It says what the box must have, never which
885
+ image it is: a Docker box's image is still `AGENTRUN_DOCKER_IMAGE`'s, and another provider's is its own. Each run's
886
+ claim asks the box it started, before the run's first model request: one `sh` with the names as its arguments, which
887
+ prints those that are neither a program `command -v` finds nor such a library, searching the folders the agent's shell searches (`/usr/local/sbin`,
888
+ `/usr/local/bin`, `/usr/sbin`, `/usr/bin`, `/sbin`, `/bin`), never a PATH the image sets. A box that lacks one, or that cannot be asked, is let go and the run ends
889
+ `failed` (`run_failed`), its words naming what is missing and how to give the box an image that has it:
890
+
891
+ ```text
892
+ This agent's sandbox on Docker lacks chrome, ffmpeg, ffprobe, and hyperframes, which the agent needs (computer.needs),
893
+ so nothing ran. Set AGENTRUN_DOCKER_IMAGE to an image that has them and restart the server. For video (chrome, ffmpeg,
894
+ ffprobe, hyperframes), build the media image: ...
895
+ ```
896
+
897
+ Nothing is installed and nothing falls back. A provider whose image is a setting of its own (Daytona's
898
+ `AGENTRUN_DAYTONA_SNAPSHOT`) is named in the fix instead. Only a sandbox takes `needs` (422 `not_allowed` on another
899
+ kind; a stored setting or a launch's computer that has them on another kind fails the run at claim in words, nothing
900
+ started); an agent without it is checked for nothing, and its revision is as before. A template states them as `needs`
901
+ beside `computer: [shell]` ([templates](templates/README.md)), and apply writes them onto the sandbox it picks, or
902
+ refuses where the shell here is no sandbox.
903
+
834
904
  **A lost sandbox.** A run's sandbox can be lost mid-run: its vendor deleted it (from its own console or API), or no
835
905
  longer has it. The tool call in flight when the loss is confirmed fails with code `gone`: `the computer <name> was lost
836
906
  while this call ran, and it was not run again: <the provider's words>. A new computer starts at the next call.` It is
@@ -1291,7 +1361,8 @@ Custody, as for a per_run MCP server's `mcp_auth`:
1291
1361
  keeps failing, the message waits untaken and is delivered again, never run on the key held before it or the
1292
1362
  server's. A stop or cancel sent after it still reaches the run. A message without one keeps the key the run holds.
1293
1363
 
1294
- **The revoke-at-turn-end contract.** The write that ends a run's turn erases its key, and the run reports the turn
1364
+ **The revoke-at-turn-end contract.** The write that ends a run's turn erases its key from the store (the runner's
1365
+ redactor keeps the value in memory to cut it), and the run reports the turn
1295
1366
  ended (`run.ended`, the run's `completed`, `failed` or `stopped` status) only after that write. Every model request
1296
1367
  tied to the turn finishes before then: the job, its subagents, its learned workflows' nodes, its end-of-run compile
1297
1368
  turn. So a caller may revoke the key as soon as it sees the turn end, and no request of that run will
@@ -1308,6 +1379,47 @@ Jev and the other decision providers run on their own keys (`TYPESAFE_API_KEY`,
1308
1379
  `OPENROUTER_API_KEY`), which are not model keys and which a run's key does not replace. On a run that brings its own
1309
1380
  key, no model key is on the env its decision nodes run under, so Jev's route on an openrouter.ai gateway's key is off.
1310
1381
 
1382
+ ### Per-run tool keys
1383
+
1384
+ A caller can hand a run its own tool keys with `keys` on `POST /v2/runs`, `POST /v2/agents/{agent_id}/runs` and
1385
+ `POST /v2/runs/{run_id}/messages`: `{"PARALLEL_API_KEY": "..."}`. The run's tools use each one in place of the server's
1386
+ key of that name. The names a run can carry are the tool keys: `PARALLEL_API_KEY` (`web_search`, `web_fetch`, Parallel
1387
+ decisions), `MONID_API_KEY`, `BROWSERBASE_API_KEY` with `BROWSERBASE_PROJECT_ID` or `KERNEL_API_KEY` (`browser`) and
1388
+ `TYPESAFE_API_KEY` (Jev). A model key goes in `model_key`, above.
1389
+
1390
+ ```sh
1391
+ curl -s http://127.0.0.1:7340/v2/agents/searcher/runs -H "Authorization: Bearer $AGENTRUN_TOKEN" \
1392
+ -H 'content-type: application/json' \
1393
+ -d "{\"input\": {\"content\": \"Find the release notes\"}, \"keys\": {\"PARALLEL_API_KEY\": \"$CUSTOMER_PARALLEL_KEY\"}}"
1394
+ ```
1395
+
1396
+ - A name that is not a tool key, or one no tool of the run's revision reads (its tools, its workflow's nodes and
1397
+ decision providers, and the keys its template declares), is 422 at `keys.<NAME>`, the value never echoed. So is a
1398
+ value that is not text of 8 or more characters with no space or control character (`invalid`): the runner could
1399
+ not cut a shorter one from what the run writes.
1400
+ - The keys are taken out of the body before anything reads it, as `model_key` is: never in the run's saved body, its
1401
+ timeline, its view, a log or an `Idempotency-Key`'s fingerprint. They are sealed with the run's launch, opened at
1402
+ each claim for its tools alone, and erased from the store by the write that ends its turn; the runner's redactor
1403
+ keeps each value in memory to cut it. Since no read after that could cut them, the runner cuts them from everything
1404
+ the run writes, as it writes it.
1405
+ - A message's `keys` replace the run's in the message's own write, read from the run's next claim on; a turn still
1406
+ going keeps the keys it opened. `keys: {}` leaves the run none. A message without them keeps the run's, which are
1407
+ none once its last turn ended.
1408
+
1409
+ **Tool keys each run brings: `AGENTRUN_RUN_KEYS=1`.** Off, a template's apply refuses a tool key the server does not
1410
+ hold (409, as before). With `1`, a template's apply makes its agent though a tool key it declares is not set here, with
1411
+ a warning, and each run of that agent must bring the key in `keys`: without it, the run is 409 `agent_not_runnable` at
1412
+ `keys.<NAME>` before anything is made, and so is a message that would start a turn. Keys the server holds are still
1413
+ used by runs that bring none. A trigger's firing brings no keys, so no trigger is made whose firings would start or
1414
+ message such runs without them: the apply skips the template's triggers with a warning at `triggers.<N>`
1415
+ (`not_set_up_here`, the apply still 201), unless the [launch hook](#launch-hook) is set, which hands each firing to
1416
+ your backend to start the run with its keys; `POST /v2/triggers`, or a `PATCH` that moves a trigger, is 409
1417
+ `agent_not_runnable` naming the keys for a trigger that would start runs of the agent with no hook, or message one of
1418
+ its runs, hook or not. `MONID_API_KEY` stays the server's even with
1419
+ the setting on: an agent's monid tools are checked with it when the agent is saved, before any run, so a template that
1420
+ grants them is still refused at its apply (409 at `secrets.MONID_API_KEY`) where the server has none. A run can still
1421
+ bring its own monid key to use in place of the server's.
1422
+
1311
1423
  ### Direct Particle-1
1312
1424
 
1313
1425
  Save a Particle key in **Settings → Model keys → Particle**, then select `particle/particle-1` with the **Pi** harness.
@@ -1978,8 +2090,8 @@ its charge unknown, as any cut call's) and given back when monid refused it unru
1978
2090
  which `maxCost` 0 lets through) is the call, settled at its charge. Under a cap, a read that ends with its charge unknown
1979
2091
  (no answer, or `FAILED` with no cost) stops the run at once, "monid may have charged for <name> and did not say how
1980
2092
  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
1981
- as charged, and the run stops at once, failed, in the words "monid charged $X, more than the $Y held; the run stopped".
1982
- 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
2093
+ as charged and logged ("monid charged $X, more than the $Y held"), and the run goes on while its charges fit its cap; one
2094
+ that takes them past it stops the run at once in the cap's words ([Spend cap](#spend-cap)). A mark a crash left unsettled leaves the run's cost unknown, as a
1983
2095
  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
1984
2096
  no cost (`FAILED`, `TIMED_OUT`, one stopped by the run or the wait, one whose sending failed) books an unknown charge,
1985
2097
  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
@@ -2086,7 +2198,17 @@ Streamable HTTP with the official MCP SDK client (`@modelcontextprotocol/client`
2086
2198
  `output_schema` and `annotations` (the server's own claims, not checked). It stores nothing. `auth` is `{type: "none"}`
2087
2199
  (or absent), `{type: "bearer", token}` (sent as `Authorization: Bearer <token>`) or `{type: "headers", headers: {Name:
2088
2200
  value}}` (up to 8). An `oauth` server is signed in to first ([below](#signing-in-with-oauth)), then previewed by name.
2089
- `url` is `https`, or `http` on loopback.
2201
+ `url` is `https`, or `http` on loopback when the server was started with `AGENTRUN_MCP_ALLOW_LOOPBACK=1`
2202
+ ([start-time switches](#start-time-switches)); without it a loopback URL is `422` on `url`, in words that name the switch.
2203
+
2204
+ A server advertising MCP resources also lists three AgentRun-generated read operations, including when it has no
2205
+ tools: `agentrun_list_resources` (`resource: "list"`), `agentrun_list_resource_templates` (`resource: "templates"`)
2206
+ and `agentrun_read_resource` (`resource: "read"`). The first two take `{}`; read takes `{uri}`. They are granted,
2207
+ pinned and gated like tools, using the same destination credential, but dispatch MCP resource methods. URIs are
2208
+ passed to that server rather than fetched directly. Resource lists include all pages within 500 entries, 1 MiB
2209
+ and one call deadline; exceeding a bound fails without a partial list. Text uses the ordinary answer filing and
2210
+ credential scrub. A binary resource containing a connection credential is withheld. These three names are reserved:
2211
+ an upstream ordinary tool with one of them makes preview or save fail. A name alone never grants resource authority.
2090
2212
 
2091
2213
  ### Composio
2092
2214
 
@@ -2129,8 +2251,9 @@ curl -X POST "$BASE/v2/agents/$AGENT/runs" -H "authorization: Bearer $TOKEN" -H
2129
2251
  `composio_user_id` is a Composio user id; `connected_account_id`, optional, is one of that user's connected accounts
2130
2252
  (`ca_...`), and without it Composio picks the user's account for the toolkit. Each request to the server carries that
2131
2253
  user and account, the Composio key staying the server's own. The binding is kept as a `per_run` server's headers are:
2132
- sealed into the run's launch, erased by the write that ends the run, never on the server's row, the run's view, its
2133
- timeline, its trace or a log line, and its values are cut from whatever the run shows. A message's binding replaces the
2254
+ sealed into the run's launch, erased from the store by the write that ends the run, never on the server's row, the
2255
+ run's view, its timeline, its trace or a log line, and its values are cut from whatever the run shows (the runner's
2256
+ redactor keeps them in memory to cut them). A message's binding replaces the
2134
2257
  run's for the turn it starts. A run that names no account has its calls of the server answered, unsent, that it was
2135
2258
  handed none, so a per-run server never calls as a default account. A malformed user or account is `422 input_invalid` at
2136
2259
  `mcp_auth.<server>.composio_user_id` or `.connected_account_id`, and so is a binding to the preset's default user
@@ -2138,8 +2261,8 @@ handed none, so a per-run server never calls as a default account. A malformed u
2138
2261
  other server, are `422` at `mcp_auth.<server>`, and no run starts. A per-run server makes no Composio trigger: a trigger
2139
2262
  runs as one account. A server saved for one user before this mode keeps calling as that user.
2140
2263
 
2141
- With `user_id: "per_run"`, whoever can start a run chooses its Composio user, so the host (Grep, say) owns which user
2142
- each run binds: it binds each run to its own person and never takes the ids from that person. Only `agentrun` is
2264
+ With `user_id: "per_run"`, whoever can start a run chooses its Composio user, so the host owns which user each run
2265
+ binds: it binds each run to its own person and never takes the ids from that person. Only `agentrun` is
2143
2266
  refused, so a host must not bind a per-run server to a `user_id` that a single-user server calls as.
2144
2267
 
2145
2268
  What can go wrong, told apart:
@@ -2202,9 +2325,10 @@ A per_run save keeps no secret, so the API token may make it, as it may preview
2202
2325
  credentials such a server receives are the ones each run's own caller hands it. The run's calls of that server carry
2203
2326
  those headers, and only to the origin the server had when the run was started. The
2204
2327
  credential is sealed into the run's launch record under `AGENTRUN_SEAL_KEY` (bound to the run's id), read at each claim, so
2205
- a resume, a restart or a lost lease uses it again, and erased by the write that ends the run. It is never in the run's
2206
- saved body, its timeline, its view, a log line or an `Idempotency-Key`'s fingerprint (a retry with a new credential
2207
- answers the first request's run), and its values are cut from whatever the run shows. `POST /v2/runs/{run_id}/messages`
2328
+ a resume, a restart or a lost lease uses it again, and erased from the store by the write that ends the run. It is never
2329
+ in the run's saved body, its timeline, its view, a log line or an `Idempotency-Key`'s fingerprint (a retry with a new
2330
+ credential answers the first request's run), and its values are cut from whatever the run shows (the runner's redactor
2331
+ keeps them in memory to cut them). `POST /v2/runs/{run_id}/messages`
2208
2332
  takes `mcp_auth` too: it replaces the run's credentials in the message's own write, so the turn the message starts (a
2209
2333
  steer into a working run from its next model request, or a follow-up that opens an ended run again) calls with them. A
2210
2334
  name that is not a saved per_run server is `422` at `mcp_auth.<server>`, and no run starts. A run handed no credential
@@ -2761,8 +2885,9 @@ has each instance on, and the subscription's place.
2761
2885
  ### GitHub triggers (Connect GitHub)
2762
2886
 
2763
2887
  A server has at most one GitHub App, made with GitHub's app-manifest flow, and every `github` trigger (and every
2764
- GitHub template) uses it. In the console, Connect GitHub calls `POST /v2/integrations/github/connect` (`{org?}`, to make
2765
- the App under an organization) and posts the form it answers to GitHub: `action`, GitHub's new-App page, and
2888
+ GitHub template) uses it. In the console, Connect GitHub calls `POST /v2/integrations/github/connect` (`{org?, contents?}`:
2889
+ `org` makes the App under an organization; `contents: "write"` asks for Contents write too, which suggested agents' pull
2890
+ requests need, below) and posts the form it answers to GitHub: `action`, GitHub's new-App page, and
2766
2891
  `manifest`, which names a name GitHub lets the person edit, the server's public URL, its hook `/v2/hooks/github`, its
2767
2892
  callback and setup URLs, the permissions (pull requests write; contents, metadata and issues read) and the events
2768
2893
  (`pull_request`, `issue_comment`, `release`). It needs the address GitHub can reach, `AGENTRUN_PUBLIC_URL` (`409 github_no_public_url`,
@@ -2905,16 +3030,83 @@ is outside this email's thread"). The pending approval carries the reason as `as
2905
3030
  says above the call's arguments ("Asks because ..."). With accounts off, where no one can
2906
3031
  approve, such a send is refused in those words.
2907
3032
 
3033
+ An agent whose definition says `checkout: repository` starts each run in a checkout of the repository the run names: its
3034
+ start's `repo`, else the first `https://github.com/<owner>/<repo>` in its first message (a github trigger's run, its
3035
+ payload's). The same command, token and rules as a pull request's checkout fetch the remote's `HEAD` (its default branch)
3036
+ one commit deep and check it out detached in `repo/` (ref `repo/head`), and list its files one a line in
3037
+ `repo/.git/agentrun-files`, so an agent with `read` and no shell can still find what to open. The run's system prompt
3038
+ names the repository, the branch, the commit and the list, or why there is no checkout.
3039
+
3040
+ ### Suggested agents
3041
+
3042
+ The console's Suggested agents page (`#/suggestions`) connects a GitHub repository, finds where its app needs an agent,
3043
+ and lets a person create or discard each suggestion. Every write to GitHub is the server's, made when a person presses
3044
+ Create; no run ever holds a token that can write.
3045
+
3046
+ 1. **Connect.** Connect GitHub as above. The page asks for `contents: "write"` unless the person unticks it; a scan needs
3047
+ only what every App holds (metadata and contents read). `GET /v2/integrations/github/repositories` lists what the
3048
+ App's installations cover (a metadata-read token per installation, revoked after; at most 500; an installation GitHub
3049
+ did not list is in `unread`).
3050
+ 2. **Scan.** `POST /v2/suggestions/scans` with `{repo}` (`owner/name` or its github.com URL) runs the bundled `agent-scout`
3051
+ template's agent, applied here the first time and reused: a read-only checkout of the default branch (`checkout:
3052
+ repository`), read-only bash where there is a shell, and an answer of at most five suggestions against its schema.
3053
+ Its first message lists the suggestions already decided on that repository, so none comes back. 202 with the run;
3054
+ 200 while one runs; what the apply or the start refuses is the answer (`409 agent_not_runnable` with no model key).
3055
+ A scan whose run stopped without ending (at its cost cap or asking for input, or paused) is listed as `waiting`: it is
3056
+ resumed or cancelled on its run's page, and a new scan starts a new run.
3057
+ 3. **List.** `GET /v2/suggestions` (`?repo=`, `?status=open|created|discarded|all`; open and created by default) answers
3058
+ GitHub's state, each repository's newest scan, and its suggestions. A scan that ended is read once: each suggestion is
3059
+ checked again field by field (paths inside the repository, a client path in its language's extension and outside
3060
+ `.github/`, `.git` and `.agentrun/agents/`, typed inputs and answer, answer labels that can't end a string or a
3061
+ comment), and one that fails is dropped and listed with why in `scan.dropped`. A suggestion's id comes from its
3062
+ repository and key, so a newer scan replaces the open ones of the scan before, and a decision outlives every rescan.
3063
+ Decisions are kept in the store's settings (`suggestions.item.<id>`, `suggestions.scan.<repo>`).
3064
+ 4. **Discard.** `POST /v2/suggestions/{id}/discard` hides it and keeps later scans from suggesting it again;
3065
+ `POST .../restore` brings it back (the page's Undo). A created one is `409 suggestion_decided`.
3066
+ 5. **Create.** `GET /v2/suggestions/{id}` shows the suggestion whole: the files a create adds, rendered now, whether its
3067
+ package checks, and whether the App can open its pull request now (read from GitHub: the installation that covers the
3068
+ repository and its permissions), with the App's permissions page and the installation's page when it can't.
3069
+ `POST /v2/suggestions/{id}/create` (`{name?}`) then:
3070
+ - claims the suggestion on its row in the store, which every server on that store shares: another create of it, a
3071
+ discard or a scan's answer meanwhile is `409 home_busy` or leaves the row alone, so one agent and one pull request
3072
+ are made. A claim older than 15 minutes (a server that stopped mid-create) is taken over. A scan is reserved the
3073
+ same way before its run starts;
3074
+ - refuses before anything is written: `409 github_not_connected`, `409 github_not_installed` (`details.install_url`),
3075
+ `409 github_permission_missing` when the installation lacks Contents or Pull requests write (`details.missing`,
3076
+ `permissions_url`, `installation_url`), or `409 github_file_exists` when the repository has a file it would add;
3077
+ - mints one installation token for that repository with `{contents: write, pull_requests: write, metadata: read}`,
3078
+ revoked at the end whatever happens;
3079
+ - commits, over the default branch's head on a new branch `agentrun/<key>` (GitHub's Git Data API, no clone), the
3080
+ agent's package (`.agentrun/agents/<key>/agent.md` and `output.schema.json`, rendered here from the checked fields)
3081
+ and a client at the suggestion's path (TypeScript or JavaScript over `fetch`, Python over `urllib` taking the input
3082
+ as one dict, or a Markdown page of the HTTP calls for any other language; no dependency). It only adds files;
3083
+ - keeps that package as the imported template `github:<owner>/<repo>/.agentrun/agents/<key>` at the pushed commit,
3084
+ then applies it here (an apply refused takes the package back, deletes the branch and makes nothing). The push is
3085
+ recorded on the suggestion first, so a create after a write that failed finds the agent made from that template at
3086
+ that commit and reuses it, never making a second one;
3087
+ - opens the pull request, naming the agent's id and the variables the client reads (`AGENTRUN_URL`,
3088
+ `AGENTRUN_API_KEY`, `AGENTRUN_AGENT_<KEY>`). A pull request GitHub refuses keeps the agent (`502 github_failed`,
3089
+ `details.agent_id`), and the next create opens the pull request alone. A created suggestion answers `200` as it is.
3090
+
3091
+ `--faux-github` (with `--faux`) serves the list, the checks and the create from its fake App: its installation holds
3092
+ contents write, its one repository answers the Git Data API and pull requests, `GET /_faux/state` on its API shows what a
3093
+ create wrote, and `POST /_faux/permissions` changes what the installation holds. Its repository is also a bare git
3094
+ repository beside the data, which a test's own runner checks out from. The CLI's runner is never pointed at it (a
3095
+ runner's GitHub API and site have one way in, a test runner's option), so a scan on a faux CLI server finds no repository
3096
+ to check out and is told so.
3097
+
2908
3098
  ## Templates
2909
3099
 
2910
3100
  A template package makes a working agent in one call: its definition, its skills and rules, and its triggers, from a
2911
- folder the server ships. `GET /v2/templates` lists them; `POST /v2/templates/{name}/apply` with `{parameters,
2912
- overrides?: {model}}` makes one, or nothing when a check fails (a trigger refused archives the agent it made). A
3101
+ folder the server ships. `GET /v2/templates` lists them; `GET /v2/templates/{name}` reads one whole (its instructions and
3102
+ every skill file, as an import shows them); `POST /v2/templates/{name}/apply` with `{parameters, overrides?: {model}}`
3103
+ makes one, or nothing when a check fails (a trigger refused archives the agent it made). A
2913
3104
  package's `version` is SemVer and never `definition.version`, the agent's revision number. A package's `composio` trigger names its
2914
3105
  need's toolkit as its `server` (`server: github` for a required `{source: composio, toolkit: github}` need), and apply makes it
2915
3106
  on the saved Composio server that need maps to, its `config` filled from the parameters it names
2916
3107
  (`repo: "${parameters.repo}"`); one this server can't set up yet (no public URL, say) is skipped with a
2917
- 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
3108
+ warning, as a github trigger is with GitHub not connected. The first package is `code-review`, a code review agent for one GitHub repository;
3109
+ `agent-scout` finds where a repository's app needs an agent ([Suggested agents](#suggested-agents)). The format and the
2918
3110
  rules of an apply are in [templates/README.md](https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/templates/README.md);
2919
3111
  `agentrun template validate DIR` checks a folder as the server does.
2920
3112
 
@@ -2967,6 +3159,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2967
3159
  | `POST /runs/{id}/pause`, `POST /runs/{id}/resume` | A workflow run: what is in flight finishes, and no node, model call or decision starts until it is resumed. Its status reads `paused`, and stays so across a server restart. An agentic run is `501`, an ended one `409`. |
2968
3160
  | `POST /workflows/validate` | `{workflow, tools?}`: every issue a save would refuse (`[{path, code, message}]`, the DSL's validation with code not run) and what this host lacks as `warnings`. Writes nothing. A refused save's `422` carries each issue as a field under `definition.workflow`, with its `code`. |
2969
3161
  | `GET /settings/tool-keys`, `PUT` and `DELETE /settings/tool-keys/{id}` | [Tool keys](#tool-keys), this server's own routes (`x-agentrun-serve: "toolkeys/1"`): each key's fields by name and where each is set, never a value; save one sealed, or forget it. |
3162
+ | `GET /settings/mcp-server-names` | The saved MCP servers' names alone (`mcpservernames/1`), sorted, with the token, also [API-only](#api-only): no URL, auth type, header or tool. |
2970
3163
  | `GET /settings/mcp-servers`, `POST /settings/mcp-servers/preview`, `GET`, `PUT` and `DELETE /settings/mcp-servers/{name}`, `POST .../{name}/refresh`, `POST .../{name}/oauth/start`, `GET /settings/mcp-servers/oauth/callback` and `GET .../oauth/client.json` | [MCP servers](#mcp-servers), this server's own routes (`x-agentrun-serve: "mcpservers/1"`): preview a remote MCP server's tools, save it with its credential sealed, read it back without the credential, refresh its tools, forget it, or [sign in to it with OAuth](#signing-in-with-oauth) (the callback and the client document take no token). |
2971
3164
  | `GET /settings/tools`, `PUT /settings/tools` | This server's own: the providers of `web_search`, `web_fetch` and `browser` ([search and fetch](#search-and-fetch)). |
2972
3165
  | `GET /runs/{id}/browser` | This server's own (`x-agentrun-serve: "liveview/1"`): the run's live browser view for the owner, `{state: "off", reason}`, `{state: "none"}` or `{state: "live", viewer}` ([the live view](#the-browsers-live-view)). |
@@ -3103,6 +3296,18 @@ serves these routes alone:
3103
3296
  - a run's hosted machine fetching this server's computerd build (`GET /computers/daemon`), with the token its create
3104
3297
  minted;
3105
3298
  - `GET /capabilities`, `GET /health`, `GET /usage` and `GET /capacity`;
3299
+ - the names of the MCP servers saved here (`GET /settings/mcp-server-names`, `{names}`), never a URL or a credential:
3300
+ a backend that builds runs from saved servers holds back a job whose server isn't saved, before its launch is refused;
3301
+ - a deploy, for a backend that deploys agents here: a template's apply (`POST /templates/{id}/apply`, a redeploy with
3302
+ its `agent_id`), the agent's read (`GET /agents/{id}`), its revisions (`GET /agents/{id}/revisions`), a rollback
3303
+ (`POST /agents/{id}/current`), and its archive and unarchive (`POST /agents/{id}/archive`, `/unarchive`). The archive
3304
+ is what its delete (`DELETE /agents/{id}`) needs first. A run here starts through the backend, on its keys and
3305
+ budget, never on this server's own model key. So with the [launch hook](#launch-hook) set, the apply makes the
3306
+ package's schedule and feed triggers, and each firing goes to the backend, which starts its run through the API; the
3307
+ unarchive turns them on again, as no trigger route is served to. Without the hook it makes neither (`not_set_up_here`: set
3308
+ the hook, or start those runs through the API). A webhook, GitHub, Composio or email trigger is never made here, hook
3309
+ or not, since this profile refuses the hook or setting each needs (`not_an_option`). Each skipped trigger is a warning
3310
+ under `warnings` (`triggers.<i>`), and the dry run (`dry_run: true`) plans it as `skip` in the same words;
3106
3311
  - a run's desktop or phone, for a backend that shows its user the live view and lets them take over: see below.
3107
3312
 
3108
3313
  Here a run's computer routes take the server's token. `POST /runs/{id}/computer/viewer` mints a 5-minute link on
@@ -3110,12 +3315,50 @@ Here a run's computer routes take the server's token. `POST /runs/{id}/computer/
3110
3315
 
3111
3316
  Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
3112
3317
  assets, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
3113
- `POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no
3114
- page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
3115
- `false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
3318
+ `POST /hooks/{id}`, the agents list, an agent made or edited through `/agents`, the templates list and every other
3319
+ template route, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no page to sign in
3320
+ to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or `false` serve the
3321
+ whole server, as before; any value other than these and `1` or `true` stops the start, in words.
3322
+
3323
+ So on an API-only server a run is launched inline (`POST /runs` with its definition), on an agent a template's apply
3324
+ made, or on an agent made before the profile was turned on.
3325
+
3326
+ ### Launch hook
3327
+
3328
+ For an install that hosts agents for other people, where the host decides who pays for each run and with which keys,
3329
+ set `AGENTRUN_LAUNCH_HOOK_URL` to the host's address and `AGENTRUN_LAUNCH_HOOK_SECRET` to a Standard Webhooks secret
3330
+ (`whsec_` and 32 random bytes in base64; it is one of the server's own secrets, never a run's). Each trigger firing that
3331
+ would start a run (a schedule, a feed, a webhook, Composio, GitHub or email trigger, or Run now) is then POSTed to the
3332
+ host, and this server starts no run for it:
3333
+
3334
+ ```json
3335
+ { "firing_id": "fir_...", "trigger_id": "trg_...", "agent_id": "digest", "revision_id": "rev_...",
3336
+ "input": { "content": "Summarize yesterday's issues.\n\n(Started by the schedule ...)" },
3337
+ "fired_at": "2026-06-01T00:10:00Z" }
3338
+ ```
3116
3339
 
3117
- Its routes for agents are refused too, so on an API-only server a run is launched inline (`POST /runs` with its
3118
- definition), or on an agent made before the profile was turned on.
3340
+ The POST carries `webhook-id` (the firing's id, the same if it is handed again), `webhook-timestamp` and
3341
+ `webhook-signature` as [webhooks](#webhooks) do: check them with any Standard Webhooks library before reading the
3342
+ body. The host starts the run with `POST /v2/agents/{agent_id}/runs`, giving the input, its own `model_key`, `keys` and
3343
+ `max_cost_usd`, and `"trigger_firing": { "trigger_id": ..., "firing_id": ... }` as it was sent, and answers 2xx within
3344
+ 10 s. It can start the run before it answers or after: a firing it answered 2xx with no run yet reads `sent` with
3345
+ `start_by`, 10 minutes after that answer, takes that one start until then, and is refused with 422 `not_due` after.
3346
+ The 10 minutes run from the answer, not from `fired_at`, so a firing that reaches the host late (a catch-up, one that
3347
+ waited on `max_active_runs`, one handed again after a restart) gets the same time; the server never hands a `sent`
3348
+ firing over again. That run is
3349
+ the firing's, as one this server started would be: it names the trigger and the firing, carries the trigger's title and
3350
+ input origin, is capped, and the firing reads `started` with it, so the trigger's overlap check and `max_active_runs`
3351
+ count it. The firing is the run's key, so a second start for the same firing answers the same run and the request
3352
+ takes no `Idempotency-Key` (422 with one); a firing that is not being handed over (skipped, or one of another agent's
3353
+ triggers) is refused with 422. Until its run starts, a `sent` firing is one the overlap check cannot see. Any other
3354
+ answer, a redirect included (it is not followed), no answer in 10 s, or no connection, and the firing reads `skipped`
3355
+ with why, unless the host started its run by then; a skip is no failure and never turns the trigger off, and the
3356
+ server does not try that firing again. A firing the server's stop cuts short stays due and is handed again at the next
3357
+ start, under the same `webhook-id`. A `message_run` target starts no run and is unchanged. The start prints the hook's
3358
+ origin, never its path or the secret. The hook is `https`: a firing's input can carry a person's data, and the
3359
+ signature proves who sent it, not that no one else read it, so plain `http` is taken only for 127.0.0.0/8, `::1` or
3360
+ `localhost`. One of the two set without the other, a URL that is not https (or http to this machine) or holds a user
3361
+ or password, or a secret that is not a `whsec_` one of 24 bytes or more stops the start, in words.
3119
3362
 
3120
3363
  ## Uploads
3121
3364
 
@@ -3492,10 +3735,20 @@ stays in every total.
3492
3735
  overwrites them. `VACUUM FULL` rewrites the table into a new file (under an exclusive lock), and the old file's
3493
3736
  blocks go back to the filesystem unwiped. Postgres's own WAL and its archived WAL keep the old values until they are
3494
3737
  recycled or expire, and backups keep them for their retention.
3495
- - Its agent's other runs and what the agent learned from it are kept. A promotion record keeps the run's id. The
3496
- agent's learning folder keeps what the run taught it: its merge's diff (`.agentrun/diffs/<run>.json`, with its
3497
- patches) and any feedback line it added to `corrections.md`, in the folder's history too. The run's purge removes
3498
- neither; the agent's purge (below) removes the whole folder.
3738
+ - Its agent's other runs and what the agent learned from it are kept. A promotion record keeps the run's id and the
3739
+ commits it names. A run's purge removes its diff file and its feedback line from the folder's current files, and the
3740
+ folder's history no longer serves its merge; the bytes stay in the folder's `.git` until a learning reset
3741
+ (`DELETE /v2/agents/{id}/learning`) or the agent's purge, which delete the folder whole. Each merge's feedback line goes in
3742
+ one commit by the host (none when nothing is left to remove), a line a person edited since stays, and another
3743
+ merge's diff that shows the line as context is written without it. The log and a workflow's revisions leave out its
3744
+ merges, known by the run the log names for each (its newest 200 changes). A purge takes each learned workflow whose
3745
+ `workflow.json` the run changed last (by the commits' run trailers over the whole history, past those 200) off main
3746
+ in one host commit, its whole folder: its file reads are `404`, no run lays it, and a read at an older commit
3747
+ (a champion by its digest, an SDK receipt's pinned commit, a later merge's diff, which shows its files as added)
3748
+ never serves its text. Each merge's scrub lands once, so a `DELETE` sent again
3749
+ after a stop takes no other run's same line, and a merge of the run made since is scrubbed by it. A second `DELETE`
3750
+ does this again. It covers the learning folder on this
3751
+ server; a Mode 2 agent's folder on an Archil disk keeps the run's text until a learning reset or the agent's purge.
3499
3752
  - It takes the owner's session (the password sign-in, or the console on a server bound to loopback) or the API token;
3500
3753
  any other console session is `403 forbidden`, no credential `401`. An [API-only](#api-only) server purges a run of
3501
3754
  an agent another system owns alone; a run of an agent made here is its profile's `404` there.
@@ -3926,8 +4179,10 @@ A start reserves a check only on a turn that can be its baseline: a JSON object
3926
4179
  schema (a prose task's input is resolved by the bridge), and a start whose task or instructions held a protected value
3927
4180
  reserves nothing. A reserved turn that still cannot be the baseline (cancelled or failed, incomplete, redacted or
3928
4181
  workflow-assisted evidence, no `workflow_check` report, or a shadow that `failed` or `skipped_write`) gives the
3929
- reservation back: the record stays `replaying` with no `runs`, counts it in `check.released`, and the next turn the
3930
- draft takes is checked. The fifth given-back turn stops the check with nothing checked (no recompile). A turn the
4182
+ reservation back: the record stays `replaying` with no `runs`, counts it in `check.released` (a cancel is never
4183
+ counted), and the next turn the draft takes is checked. A turn that lands starts the count again; five counted
4184
+ give-backs in a row hold the draft, never promoted and never stopped for good: the agent's next compile, after
4185
+ `compile_after` more runs, revises it, and the revision is checked afresh. A turn the
3931
4186
  backend never completes within an hour is decided as one failed input through the same check, so its hold asks the
3932
4187
  one recompile and a recompile's check that ends the same way stops. Connected checks' records say `via: "sdk"`;
3933
4188
  `check.fresh_reads` counts the shadow's `shadowReadFallback` reads.
@@ -4273,13 +4528,16 @@ spend limit. A workflow definition keeps one the same way. The cap is checked in
4273
4528
  before each model request, the agent's and a compaction's alike, on every harness: what the run has spent so far, plus
4274
4529
  what each request still in flight is held at, plus the most this request can cost must stay within it, or the
4275
4530
  request is not sent and the run pauses ([below](#a-run-paused-at-its-cap)). The cap is a hard stop for everything but
4276
- 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
4277
- once ([monid](#monid)). An MCP tool counts only at the price saved for it (its server's `prices`); one with none is
4531
+ two charges that can pass what they were held at: a monid call priced by usage, which can pass monid's estimate
4532
+ ([monid](#monid)), and a fal job, booked at the units its output states, which can pass those its input asked for. Either
4533
+ is booked as charged; when that takes the run past its cap, the run stops at once in the cap's words, nothing run after
4534
+ it, and below the cap the run goes on. An MCP tool counts only at the price saved for it (its server's `prices`); one with none is
4278
4535
  not metered and bills its own account outside the cap. fal is counted: a job sent to a fal server (one saved with the
4279
4536
  toolkit `fal`, or at `mcp.fal.ai`) through `run_model`, `submit_job` or `submit_jobs` is priced before it is sent, at
4280
4537
  fal's unit price for its endpoint (the server's own `get_pricing`, read with the run's credential and kept five
4281
4538
  minutes) times the units the job's input states: its images, their megapixels, its text's characters, the seconds it
4282
- names, or the length of the audio or video it is given, read from the file first. That price is held under the cap, a
4539
+ names, or, for dubbing, lip-sync, voice isolation and speech-to-text, which fal bills by the length of the media they
4540
+ are given, that length, read from the file first. That price is held under the cap, a
4283
4541
  job the cap can't take is refused before it is submitted, and the job is booked as the run's tool cost, charged by the
4284
4542
  server, with the price and the count it came from. It is an estimate at fal's list price, not fal's invoice: fal
4285
4543
  reports no cost for a job, and a minimum charge, a discount or a rate that depends on a setting `get_pricing` does not
@@ -50,7 +50,8 @@ export interface AgentDeleteHost {
50
50
  madeFrom(runId: string): Promise<string[]>;
51
51
  /** What agent `agentId`'s learning copied from run `runId`, gone: the grades it keeps of the run dropped, its promotion
52
52
  * records' disagreements naming the run blanked, their decisions, numbers and run ids kept (learn/promote.ts
53
- * forgetRunCopies). */
53
+ * forgetRunCopies), and the run's text off its learning folder's current files (learn/commit.ts forgetRunText).
54
+ * Idempotent: a purged run's DELETE runs it again. */
54
55
  forgetCopies(agentId: string, runId: string): Promise<void>;
55
56
  /** What run `runId`'s spend reads from its journal, read before its purge removes it (store-reads/cap.ts). */
56
57
  kept(runId: string): Promise<PurgeKept>;
@@ -72,12 +73,10 @@ export declare function deleteExternalAgent(host: AgentDeleteHost, agentId: stri
72
73
  export declare function purgeAgent(host: AgentDeleteHost, agentId: string): Promise<void>;
73
74
  /** The setting that marks agent `agentId`'s purge begun and not finished (purgeAgent). */
74
75
  export declare const purgingKey: (agentId: string) => string;
75
- /** A DELETE of a run, or of agent `agentId`, already purged: 204 with no purge, but what a purge that committed and then
76
- * threw left undone (its scrub's marker not written, sqlite/store.ts #purged): the scrub arranged again (store
77
- * purgeScrub), and the agent's purge mark dropped (purgeAgent removes it only after its store purge returns). */
78
- export declare function purgedAgain(host: AgentDeleteHost, agentId?: string): Promise<void>;
79
76
  /** Purges run `runId` with every run made from it, as the header says. 404 not_found when it is not there; 409
80
- * run_not_final, nothing purged, while it or a run made from it is live. A purged run is no work. */
77
+ * run_not_final, nothing purged, while it or a run made from it is live. A purged run's only work is forgetCopies again,
78
+ * which finds nothing left once a purge finished it; its store scrub was marked before the purge changed a row
79
+ * (sqlite/store.ts #purging). */
81
80
  export declare function purgeRun(host: AgentDeleteHost, runId: string): Promise<void>;
82
81
  /** One delete of an agent at a time: a second DELETE of the same agent waits for the first, then finds it gone (404) or
83
82
  * finishes what the first left. `queued`, a test's seam: told each time a work waits behind another of its agent's,