@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.36
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.
- package/CHANGELOG.md +128 -0
- package/README.md +260 -168
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +13 -41
- package/dist/cap.js +24 -73
- package/dist/cli.js +4 -22
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +11 -2
- package/dist/computer-view.js +2 -1
- package/dist/computers.d.ts +48 -7
- package/dist/computers.js +100 -23
- package/dist/console/assets/index-BI4Byidu.js +550 -0
- package/dist/console/assets/index-C19gUF2n.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.js +4 -0
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +2 -0
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.js +1 -1
- package/dist/host-tools.d.ts +8 -9
- package/dist/host-tools.js +7 -7
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +7 -1
- package/dist/learn/check.js +123 -5
- package/dist/learn/commit.d.ts +40 -6
- package/dist/learn/commit.js +164 -20
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +33 -0
- package/dist/learn/grade.d.ts +18 -1
- package/dist/learn/grade.js +86 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +5 -2
- package/dist/learn/reflect.js +43 -29
- package/dist/learn/skills.d.ts +4 -0
- package/dist/learn/skills.js +7 -0
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +19 -9
- package/dist/learned-workflow.js +62 -34
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-routes.d.ts +8 -3
- package/dist/learning-routes.js +9 -6
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +6 -2
- package/dist/learning.d.ts +13 -6
- package/dist/learning.js +4 -2
- package/dist/mcp-probe.d.ts +8 -1
- package/dist/mcp-probe.js +62 -20
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.js +8 -3
- package/dist/model.d.ts +5 -5
- package/dist/model.js +6 -6
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +204 -47
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +97 -0
- package/dist/place-offers.js +206 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +22 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +1 -8
- package/dist/print.js +1 -14
- package/dist/propose.d.ts +1 -0
- package/dist/propose.js +25 -10
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-db.js +3 -3
- package/dist/run-launch.d.ts +14 -1
- package/dist/run-launch.js +7 -2
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +5 -2
- package/dist/run-view.js +4 -3
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +16 -1
- package/dist/runner/adapter-loop.js +131 -30
- package/dist/runner/adapter-run-spec.d.ts +25 -4
- package/dist/runner/adapter-run-spec.js +103 -24
- package/dist/runner/adapters/pi.d.ts +11 -3
- package/dist/runner/adapters/pi.js +35 -12
- package/dist/runner/beside.js +6 -2
- package/dist/runner/cli-run-spec.d.ts +7 -0
- package/dist/runner/cli-run-spec.js +92 -38
- package/dist/runner/commands.d.ts +5 -1
- package/dist/runner/commands.js +3 -3
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +8 -5
- package/dist/runner/github-app.js +2 -2
- package/dist/runner/harness-loops.js +1 -1
- package/dist/runner/journal-kinds.d.ts +15 -5
- package/dist/runner/journal-kinds.js +6 -1
- package/dist/runner/learning-end.d.ts +15 -0
- package/dist/runner/learning-end.js +26 -5
- package/dist/runner/learning-factory.js +6 -2
- package/dist/runner/learning-loop.d.ts +73 -1
- package/dist/runner/learning-loop.js +203 -18
- package/dist/runner/learning-seed.d.ts +2 -0
- package/dist/runner/learning-seed.js +1 -1
- package/dist/runner/loop-contract.d.ts +8 -0
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +20 -0
- package/dist/runner/main.js +12 -2
- package/dist/runner/mcp-claim.d.ts +4 -0
- package/dist/runner/mcp-claim.js +29 -1
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +0 -7
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +1 -0
- package/dist/runner/metrics.d.ts +4 -0
- package/dist/runner/metrics.js +9 -0
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +59 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +1 -0
- package/dist/runner/reflect-hook.js +3 -3
- package/dist/runner/runner.js +47 -12
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +4 -1
- package/dist/runner/store-secrets.js +17 -1
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +188 -0
- package/dist/runner/workflow-host.d.ts +18 -2
- package/dist/runner/workflow-host.js +23 -3
- package/dist/runner/workflow-loop.d.ts +5 -2
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +26 -14
- package/dist/runner/workflow-spec.js +97 -30
- package/dist/runs-over-store.d.ts +11 -6
- package/dist/runs-over-store.js +111 -24
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/server.d.ts +32 -49
- package/dist/server.js +249 -199
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/deadline.js +9 -5
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +11 -8
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +18 -2
- package/dist/store/sqlite/run-patch.js +31 -2
- package/dist/store/sqlite/store.js +65 -11
- package/dist/store/store.d.ts +62 -12
- package/dist/store/store.js +22 -1
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +1 -3
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/journal.js +45 -12
- package/dist/store-reads/learning.d.ts +15 -1
- package/dist/store-reads/learning.js +68 -10
- package/dist/store-reads/runs.d.ts +6 -4
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-view.js +45 -19
- package/dist/template-eval.js +2 -1
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +3 -1
- package/dist/timeline/timeline.js +19 -4
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +8 -0
- package/dist/tool-budget.js +7 -1
- package/dist/tool-gate.d.ts +7 -1
- package/dist/tool-gate.js +7 -2
- package/dist/tool-plane.d.ts +33 -19
- package/dist/tool-plane.js +64 -27
- package/dist/tools.d.ts +18 -34
- package/dist/tools.js +104 -70
- package/dist/trigger-signatures.d.ts +1 -0
- package/dist/trigger-signatures.js +3 -1
- package/dist/triggers.d.ts +3 -3
- package/dist/triggers.js +2 -2
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +30 -3
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -2
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +112 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +88 -0
- package/dist/workflow/node.js +99 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +9 -0
- package/dist/workflow/pi-versions.js +8 -0
- package/dist/workflow/readers.d.ts +36 -0
- package/dist/workflow/readers.js +145 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +76 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +411 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow/wal.d.ts +11 -0
- package/dist/workflow/wal.js +106 -0
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/computer-deps.d.ts +16 -8
- package/dist/workspace/computer-deps.js +18 -7
- package/dist/workspace/computer-for-claim.d.ts +42 -6
- package/dist/workspace/computer-for-claim.js +209 -9
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +7 -0
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.js +1 -0
- package/dist/workspace/resolve-computer.d.ts +42 -11
- package/dist/workspace/resolve-computer.js +65 -13
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +4 -4
- package/dist/workspace/run-tools.js +8 -6
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +10 -15
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/templates/code-review/rules/REVIEW.md +0 -41
package/README.md
CHANGED
|
@@ -32,10 +32,8 @@ Boxes: docker (on by default; set AGENTRUN_BOXES to change).
|
|
|
32
32
|
Set your password: http://127.0.0.1:7340/setup (the first visit sets it)
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
when it ends (`The Docker box image is ready.`, or why it failed). `npx @parcha/agentrun` prints the `Boxes:` line and
|
|
38
|
-
these two on stderr, after its own line on stdout. On a machine where Docker is not running, the `Boxes:` line says so instead (`Boxes: none, so new agents run on the
|
|
35
|
+
A Docker box's image is built on its first run, which shows that on its timeline. `npx @parcha/agentrun` prints the
|
|
36
|
+
`Boxes:` line on stderr, after its own line on stdout. On a machine where Docker is not running, the `Boxes:` line says so instead (`Boxes: none, so new agents run on the
|
|
39
37
|
runner. Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart
|
|
40
38
|
AgentRun.`); see [Boxes](#boxes).
|
|
41
39
|
|
|
@@ -93,11 +91,9 @@ node packages/serve/dist/cli.js
|
|
|
93
91
|
Its log says `event=boxes available=docker`, and its banner's last line `Boxes: docker (on by default; set
|
|
94
92
|
AGENTRUN_BOXES to change). docker boxes reach only pypi.org, files.pythonhosted.org, registry.npmjs.org, registry.yarnpkg.com,
|
|
95
93
|
github.com, and codeload.github.com.` (on Linux; elsewhere it says why the box has no
|
|
96
|
-
network: [Sandbox](#sandbox)). The first
|
|
97
|
-
about 300 MB, a minute or two, the build alone on the network)
|
|
98
|
-
|
|
99
|
-
`state=ready` with how long it took; a later start finds it built. A run that needs its box sooner waits for it, with a
|
|
100
|
-
row on its timeline saying so. In a second shell, export the two `AGENTRUN_` lines it printed (a later start prints
|
|
94
|
+
network: [Sandbox](#sandbox)). The first sandbox run builds [the box's image](#the-boxs-image) (python 3.12, git, curl, node, npm and rg,
|
|
95
|
+
about 300 MB, a minute or two, the build alone on the network), with a row on its timeline saying so; a later run finds
|
|
96
|
+
it built. In a second shell, export the two `AGENTRUN_` lines it printed (a later start prints
|
|
101
97
|
where the key is: `export AGENTRUN_API_KEY=$(cat ~/.local/share/agentrun/agents/.token)`). Then make a sandbox agent,
|
|
102
98
|
run it, watch it, and read the file it wrote:
|
|
103
99
|
|
|
@@ -142,9 +138,7 @@ at=2026-10-25T21:04:09.010Z event=auth_failed route=/v2/runs reason=wrong_token
|
|
|
142
138
|
A request's path has no query. `auth_failed` names the route and why (`no_credential`, `wrong_token`,
|
|
143
139
|
`wrong_link_token`, `wrong_password`, `sign_in_table_full`), never the token given nor any part of it. `AGENTRUN_LOG=quiet` leaves out the request lines; the
|
|
144
140
|
run and `auth_failed` lines stay. A run whose process failed at its start says why in its `error.message`, in words.
|
|
145
|
-
One line at start, `event=boxes`, says which boxes this server has ([Boxes](#boxes))
|
|
146
|
-
`event=box_image` says whether its image is `ready`, `preparing` (being built or pulled) or `unavailable` and why, again
|
|
147
|
-
when that ends; quiet keeps them too.
|
|
141
|
+
One line at start, `event=boxes`, says which boxes this server has ([Boxes](#boxes)); quiet keeps it too.
|
|
148
142
|
`event=harness_offers why=start ms=<n>` says how long the server took to check what each harness offers (each CLI's
|
|
149
143
|
package and pins; [harnesses](#harnesses)), the bulk of its start; quiet keeps it too. It is made at the start only: a
|
|
150
144
|
PUT of `/settings/tools` and a save or delete of a tool key change no harness's offer, so they remake capabilities at
|
|
@@ -180,12 +174,13 @@ docker compose logs agentrun | grep Open
|
|
|
180
174
|
The `.env` beside `compose.yaml` keeps the socket's group (`DOCKER_GID`) for every later `docker compose` command, in any
|
|
181
175
|
shell: compose reads it each time, and `compose.yaml` needs it to be read at all.
|
|
182
176
|
|
|
183
|
-
This `compose.yaml`
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
This `compose.yaml` passes `AGENTRUN_SEAL_KEY` from the `.env` to the server and refuses to start without it, so the key that
|
|
178
|
+
seals every saved key, MCP credential and sign-in is kept outside the container and the data volume. Keep that `.env`
|
|
179
|
+
line. A store whose secrets were sealed with another key refuses to start, and the server never makes a new key over
|
|
180
|
+
sealed secrets, so a lost key is not replaced: recreating the container with the same key opens the store as before.
|
|
186
181
|
|
|
187
182
|
From a checkout, the same command in its root, with `--build` to build the image from it.
|
|
188
|
-
`packages/serve/docker/Dockerfile` builds that image: the server and the open packages it runs, on Node 22 and Debian 13
|
|
183
|
+
`packages/serve/docker/Dockerfile` builds that image: the server and the open packages it runs, on Node 24.22.3 and Debian 13
|
|
189
184
|
(trixie), with git 2.47 for an agent's learning folder and the Docker client. Everything it keeps is under `/data`: the agent store,
|
|
190
185
|
the runs and the token.
|
|
191
186
|
|
|
@@ -289,15 +284,16 @@ when it does and 1 when it does not, and 2 when no name is given. Name a runner
|
|
|
289
284
|
|
|
290
285
|
## Sandbox
|
|
291
286
|
|
|
292
|
-
A sandbox agent's `bash` runs in a box, a machine apart from this server
|
|
293
|
-
which binds the run's `work/` and nothing else
|
|
294
|
-
|
|
295
|
-
|
|
287
|
+
A sandbox agent's `bash` runs in a box, a machine apart from this server. Docker is the default box and the only one offered
|
|
288
|
+
with no setup: a Docker container made for each run, which binds the run's `work/` and nothing else. A Daytona or Modal box
|
|
289
|
+
runs on a computer from that provider, offered once `AGENTRUN_BOXES` lists it and the keys its computer provider needs are
|
|
290
|
+
set (the environment, or Settings → Computers). No box holds a key. A Docker box on Linux reaches the package registries
|
|
291
|
+
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
|
|
292
|
+
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
|
|
296
293
|
holds directory handles (Docker on Linux), else in the box. The agent's loop, its log, its model calls and every key stay
|
|
297
294
|
on the server. An agent says so in its [place](#place); the server says which [boxes](#boxes) it has; [a run in a Docker
|
|
298
|
-
box](#a-run-in-a-docker-box) is what the container gets
|
|
299
|
-
|
|
300
|
-
[the box's image](#the-boxs-image) is what it starts from. [Sandbox in 60 seconds](#sandbox-in-60-seconds) is all of it
|
|
295
|
+
box](#a-run-in-a-docker-box) is what the container gets; [the box's image](#the-boxs-image) is what it starts from.
|
|
296
|
+
[Sandbox in 60 seconds](#sandbox-in-60-seconds) is all of it
|
|
301
297
|
end to end. The [published image](#in-the-published-image) hosts Docker boxes through the host's Docker socket.
|
|
302
298
|
|
|
303
299
|
### Place
|
|
@@ -313,8 +309,7 @@ remove, or the place it most likely meant, to copy (`"place": {"mode": "sandbox"
|
|
|
313
309
|
place keeps it, `runner` included. An edit that names no place keeps the agent's.
|
|
314
310
|
|
|
315
311
|
The box is a new agent's default machine. A new agentic agent whose definition names no place is saved in the Docker box
|
|
316
|
-
(`{"mode": "sandbox", "box": "docker"}`) wherever this server has docker
|
|
317
|
-
run then waits for the image, with one timeline row). The place is written on the agent's first revision, so its answers
|
|
312
|
+
(`{"mode": "sandbox", "box": "docker"}`) wherever this server has docker. The place is written on the agent's first revision, so its answers
|
|
318
313
|
show it. If that definition names no `tools` either, it gets `["bash", "bash_background", "bash_output", "bash_input",
|
|
319
314
|
"bash_signal", "bash_list"]`, so the agent has a shell and can run a command in the background
|
|
320
315
|
([background processes](#background-processes)). A definition that
|
|
@@ -344,8 +339,8 @@ or none (`422` on a sandbox, with the runner place as its `fix`). In `capabiliti
|
|
|
344
339
|
with a `reason` (`no box is set up on this server: …`, each box's own reason) when no box this server has can run it and
|
|
345
340
|
the server is in Mode 1.
|
|
346
341
|
|
|
347
|
-
`GET /v2/capabilities` lists `places`: the modes, the default, a new agent's place, and each box with `available`, its `state` (`ready
|
|
348
|
-
`
|
|
342
|
+
`GET /v2/capabilities` lists `places`: the modes, the default, a new agent's place, and each box with `available`, its `state` (`ready` or
|
|
343
|
+
`unavailable`) and, when it is unavailable, the `reason`.
|
|
349
344
|
A definition naming a box this server does not have saves with a warning on `definition.place`, and a run of it is
|
|
350
345
|
`409 agent_not_runnable` with `details.box`. `GET /v2/openapi.json` marks `definition.place`, the run's `place` and
|
|
351
346
|
`capabilities.places` `x-agentrun-serve: "place/1"`, `default_reason` `"place/3"`, and `default_place` `"place/4"`
|
|
@@ -409,7 +404,7 @@ go through `work/` by path.
|
|
|
409
404
|
connect, over a minute old); a live run's, of any server of this user's, stays.
|
|
410
405
|
- On a Mac, where Docker runs in a VM, a socket bound in from the Mac does not connect, so the proxy runs inside the
|
|
411
406
|
VM instead: one container per server, `agentrun-egress-<12 hex of the data root>`, labelled `agentrun.egress`. It
|
|
412
|
-
is `node:22-
|
|
407
|
+
is `node:22.23.5-trixie-slim` pinned by digest, with the kernel's two proxy files and a short entry bound read-only from
|
|
413
408
|
`<data>/egress/`, the list as its one variable, a read-only root, no capability, the server's uid:gid, 256 MiB and
|
|
414
409
|
256 processes. It listens on a Unix socket in a tmpfs volume of the same name, owned by the server's uid, and the
|
|
415
410
|
box mounts that volume read-only at `/run/agentrun/egress/`. The box keeps `--network none`, its `socat` and its
|
|
@@ -547,111 +542,21 @@ where `bash`'s setting came from:
|
|
|
547
542
|
then `KILL` after 3 s, and marks each with `ended` beside its log, which stays in the run's files; the server's log says
|
|
548
543
|
`background_ended` with how many. A follow-up's box starts with none running, and its ids go on from the last.
|
|
549
544
|
|
|
550
|
-
### A run in a Daytona box
|
|
551
|
-
|
|
552
|
-
With `AGENTRUN_BOXES=daytona` and `DAYTONA_API_KEY`, a run whose place is `{"mode": "sandbox", "box": "daytona"}` gets one
|
|
553
|
-
Daytona sandbox, made on its first `read`, `write`, `edit` or `bash` call, with the same tools, path rules, environment,
|
|
554
|
-
`bash` and labels as a Docker box. What differs (its `read`, `write` and `edit` run in the sandbox, as its `bash` does,
|
|
555
|
-
since nothing binds `work/` there):
|
|
556
|
-
|
|
557
|
-
- The key is this server's alone. The server makes, copies to and from, and destroys the sandbox itself. The run's
|
|
558
|
-
process holds no key: it reaches its sandbox only through the server's box relay, on loopback, which takes a call for
|
|
559
|
-
a run only with that run's own door token (`DIR/disk/agents/<agent>/runs/<id>/door-token`, handed to that run's process alone) and adds
|
|
560
|
-
the key to the calls a run's tools make of their own sandbox (a read of it, and its toolbox's programs and files). It
|
|
561
|
-
refuses every other call (a create, a listing, a stop, a delete, another run's sandbox or token, any other host), and
|
|
562
|
-
it never follows a redirect, nor does the server's own Daytona client: a redirect would carry the key.
|
|
563
|
-
- It reaches the hosts `AGENTRUN_BOX_ALLOW` names, and no other: Daytona's domain list (`domainAllowList`), which
|
|
564
|
-
Daytona's egress proxy enforces. Unset or empty, the list is the package registries and GitHub: `pypi.org`,
|
|
565
|
-
`files.pythonhosted.org`, `registry.npmjs.org`, `registry.yarnpkg.com`, `github.com` and `codeload.github.com`. A
|
|
566
|
-
comma list of hosts (a `*.` wildcard allowed, at most 100) replaces it, so to add one, copy this list and extend it.
|
|
567
|
-
`AGENTRUN_BOX_ALLOW=none` blocks its network (`networkBlockAll`), as before the list. `*`, an IP address, a CIDR, a
|
|
568
|
-
port or a URL refuses the start. Capabilities show the hosts in `places.allow`, and the box's `network` (`allowlist` or
|
|
569
|
-
`none`) in its `places.boxes` entry. Daytona's proxy re-signs each TLS connection with Daytona's own CA, which the
|
|
570
|
-
sandbox's environment names to pip, npm, git and curl (`REQUESTS_CA_BUNDLE`, `NODE_EXTRA_CA_CERTS`, `GIT_SSL_CAINFO`,
|
|
571
|
-
`CURL_CA_BUNDLE`, `SSL_CERT_FILE`).
|
|
572
|
-
- A sandbox whose own read does not carry the list it was asked for is deleted. Daytona takes a domain list on its tier 3
|
|
573
|
-
and 4 only: where it keeps none, or refuses it, the server makes the run's box again with its network blocked, never
|
|
574
|
-
open, and makes every later Daytona box that way until it starts again. The log says so once, with Daytona's own
|
|
575
|
-
words (`event=box_network box=daytona network=none refused=<code> message="…"`), and capabilities show the box's
|
|
576
|
-
`network` as `none` with its `network_reason`. A box the server finds is kept when it has no network, or the list the
|
|
577
|
-
setting names now (the same hosts, in any order, as Daytona reads them back); any other (a wider or narrower list, a
|
|
578
|
-
list when the setting is `none`) is destroyed and made again, so a changed list holds for a run's box after a restart.
|
|
579
|
-
- A sandbox Daytona does not report blocked, when blocked was asked, is deleted, and the tool call fails saying so. An
|
|
580
|
-
organization on Daytona's tier 1 or 2 keeps its own network policy, which a sandbox cannot override, so a run there
|
|
581
|
-
gets no Daytona box unless that policy blocks it.
|
|
582
|
-
- A sandbox cannot bind `work/`. The server copies `work/` into it at `/workspace` when it makes it, and
|
|
583
|
-
copies what changed back at each turn's end (a read of the run's files waits for that copy) and once more before the
|
|
584
|
-
run's end is recorded. Daytona's answer is never trusted: the copy back writes regular files and directories only,
|
|
585
|
-
never a link and nothing outside `work/`, and a file this server changed since the last copy stays as this server
|
|
586
|
-
has it. A file the box removed is removed here too. What the server files in `work/` during the run (monid's long
|
|
587
|
-
answers) is copied into the sandbox as well. The copy's mark is `box-sync.json` beside the run, which the server alone
|
|
588
|
-
writes; the run's process notes each file it copied in, in `box-mirrored.jsonl` beside it, and a copy back counts
|
|
589
|
-
those as held by both sides, so an edit the box makes to one comes back.
|
|
590
|
-
- The sandbox is destroyed after the last copy back, and only once that copy is whole: when the run ends, and when it
|
|
591
|
-
is archived (a copy that fails at an archive keeps the sandbox for the run's end). A copy that fails at the run's end
|
|
592
|
-
is tried again, and the end waits for it. One that stops for good (an archive the server cannot read, or a limit a copy
|
|
593
|
-
that brought nothing reached) keeps the sandbox, says so in the log (`event=box_kept` with its id), and lets the run
|
|
594
|
-
end with what did come back. A start pulls a run it finds waiting for the person, and copies back, then destroys, the
|
|
595
|
-
sandbox of every run that has ended or is archived. One whose copy fails is kept for the next start.
|
|
596
|
-
- A kept sandbox has Daytona's auto-delete turned off (a sandbox is made with auto-delete at 0, which deletes it as it
|
|
597
|
-
stops) and is set to stop after 15 minutes without activity, so once stopped it costs its disk alone (3 GiB on
|
|
598
|
-
Daytona's default snapshot, at Daytona's storage price) and no compute; its files stay. The next start wakes it, copies
|
|
599
|
-
back again, and destroys it once that copy is whole; else its 24-hour lifetime ends it. To remove one sooner, delete
|
|
600
|
-
the sandbox in Daytona's dashboard or API: it carries the labels `agentrun.box=run` and `agentrun.run=<run id>`.
|
|
601
|
-
- A run's sandbox that Daytona stopped, paused (a sandbox class that pauses when idle, while the run waits for its
|
|
602
|
-
person) or archived (a stopped one it moved away) is started again, an archived one restored, when the server next
|
|
603
|
-
needs it: for the run's next tool call, a copy back, or the start's sweep. One still stopping, pausing or archiving
|
|
604
|
-
is waited for (a minute at most) first. It is never replaced by a new one, so
|
|
605
|
-
what only it holds stays.
|
|
606
|
-
- The sandbox is Daytona's default snapshot, made as its user, with `sudo -n` making `/workspace`.
|
|
607
|
-
|
|
608
|
-
### A run in a Modal sandbox
|
|
609
|
-
|
|
610
|
-
With `modal` listed in `AGENTRUN_BOXES`, its token set and its SDK installed, a run whose place is
|
|
611
|
-
`{"mode": "sandbox", "box": "modal"}` gets one Modal sandbox, made on its first `read`, `write`, `edit` or `bash` call. It
|
|
612
|
-
is Modal's default sandbox runtime (gVisor), not a virtual machine: the server does not ask Modal for its VM runtime. It works like a
|
|
613
|
-
[Daytona box](#a-run-in-a-daytona-box): the same tools, path rules, environment and labels, and its `read`, `write` and
|
|
614
|
-
`edit` run in the sandbox too. What differs:
|
|
615
|
-
|
|
616
|
-
- The token and the SDK's client are this server's alone. The server makes the sandbox, copies `work/` into it at
|
|
617
|
-
`/workspace`, copies what changed back at each turn's end and once more before the run's end is recorded,
|
|
618
|
-
and ends it after that last copy, at the run's end, a cancel included, and at an archive. The copy rules (no link,
|
|
619
|
-
nothing outside `work/`, a file this server changed stays as it has it) are Daytona's.
|
|
620
|
-
- The run's process holds no token. Its calls to its sandbox go through the server's box relay, on loopback, with that
|
|
621
|
-
run's own door token. The relay makes only the calls a run's tools make of their own sandbox, with the server's
|
|
622
|
-
client: finding it, reading its state and tags, and starting a program in it with that program's input, output and
|
|
623
|
-
exit. It refuses everything else: a create, a listing, an end, a tag change, or another run's sandbox or program.
|
|
624
|
-
- It has no network, whatever `AGENTRUN_BOX_ALLOW` names. The provider takes a domain list when a sandbox is made, but
|
|
625
|
-
its SDK cannot read a sandbox's list back, so this server cannot check that a box holds the list it asked for (as it
|
|
626
|
-
does for Daytona). Each box is made with its network blocked, never with the provider's open default. Capabilities
|
|
627
|
-
show the box's `network` as `none`, with `network_reason`, unless the setting is `none`.
|
|
628
|
-
- A sandbox that is gone (it ended, or its lifetime ran out) is made again on the run's next tool call and seeded
|
|
629
|
-
with the run's `work/`. The call that met the gone box fails, saying so.
|
|
630
|
-
- A Modal sandbox is the size Modal makes it, which the provider bills for while the box lives: `AGENTRUN_BOX_CPUS`,
|
|
631
|
-
`AGENTRUN_BOX_MEMORY` and `AGENTRUN_BOX_PIDS` size Docker computers only. Its lifetime is 24 hours, as every box's is.
|
|
632
|
-
- A start copies back, then ends, the sandbox of every run that has ended or is archived.
|
|
633
|
-
|
|
634
545
|
### The box's image
|
|
635
546
|
|
|
636
|
-
A Docker box starts from
|
|
637
|
-
its digest) with git, curl, node and npm
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
(`
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
reaches
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
A box reaches its package registries (on Linux), so `pip install` and `npm install` work in it, but not `apt-get`: the
|
|
651
|
-
box runs as this server's user, with no root. For other tools, name another image
|
|
652
|
-
in `AGENTRUN_DOCKER_IMAGE`: the server then pulls it when Docker has none (at most 10 minutes) and builds nothing.
|
|
653
|
-
This image, its build and the wait for it are the Docker box's alone: a Daytona box is made by the server from
|
|
654
|
-
Daytona's own image, and a Daytona run never waits on this one.
|
|
547
|
+
A Docker box's computer starts from the computer package's own image by default: python 3.12 (`python:3.12-slim`,
|
|
548
|
+
pinned by its digest) with git, curl, node and npm, rg and `socat` (the relay to the computer's egress proxy), about
|
|
549
|
+
360 MB. Its recipe is `DOCKER_RECIPE` in `packages/computer/src/docker/image.ts`. The Docker provider builds it on the
|
|
550
|
+
first run that needs it, tags it with the recipe's hash (`agentrun-computer:<12 hex>`) and labels it with the whole hash
|
|
551
|
+
(`agentrun.computer.recipe`), and builds again only when the recipe changes; the run waiting on the build shows it on its
|
|
552
|
+
timeline. Nothing is built or pulled at the server's start. Images of older recipes stay until you remove them:
|
|
553
|
+
`docker image ls --filter label=agentrun.computer.recipe` lists them. An `agentrun-box:*` image an earlier server built
|
|
554
|
+
is used by nothing: `docker image rm` it.
|
|
555
|
+
|
|
556
|
+
A box reaches its package registries, so `pip install` and `npm install` work in it, but not `apt-get`: the box runs as
|
|
557
|
+
this server's user, with no root. For other tools, name another image in `AGENTRUN_DOCKER_IMAGE`: the provider then pulls
|
|
558
|
+
it on the first run that needs it, and builds nothing. This image is the Docker box's alone: a box on another provider
|
|
559
|
+
starts from that provider's own.
|
|
655
560
|
|
|
656
561
|
```sh
|
|
657
562
|
AGENTRUN_DOCKER_IMAGE=python:3.12-bookworm AGENTRUN_BOXES=docker node packages/serve/dist/cli.js
|
|
@@ -763,17 +668,104 @@ computer is made with the GPUs asked.
|
|
|
763
668
|
- **Modal** declares its GPUs, but a Modal GPU sandbox runs on gVisor, and the Archil mount the run's folder needs is not
|
|
764
669
|
proven there. So this server refuses a Modal sandbox with a `gpu` for now. A Modal GPU is also preemptible.
|
|
765
670
|
|
|
671
|
+
**An agent's own computer.** `computer: {"kind": "desktop", "provider": "orgo", "persistent": true}` gives the agent
|
|
672
|
+
one computer that it keeps between runs, instead of a fresh one for each run:
|
|
673
|
+
|
|
674
|
+
- Its first run makes it. Each run's end detaches it rather than deleting it (an Orgo Linux desktop is suspended, with
|
|
675
|
+
its memory and disk). The agent's next run attaches it again, with what was on it.
|
|
676
|
+
- The run's timeline says which happened. If the computer was deleted outside this server, the next run makes a new
|
|
677
|
+
one and says so.
|
|
678
|
+
- One run at a time. A run that finds the computer held by another run that is still going is refused at its start,
|
|
679
|
+
naming that run.
|
|
680
|
+
- Only where the provider keeps one for the kind and image (`GET /v2/computers`: the provider's `persistent`); anything
|
|
681
|
+
else is 422. A computer that mounts the run's folder can't be kept, so a persistent computer never mounts it.
|
|
682
|
+
- `GET /v2/agents/{agent_id}` shows it as `own_computer`: its provider, id and name, and whether a run holds it, it is
|
|
683
|
+
detached, or it is being deleted.
|
|
684
|
+
- Archiving the agent, turning `persistent` off, or moving the setting to another provider or image deletes it.
|
|
685
|
+
- The computer is owned by this server's id (kept in its store) and the agent's id, so two servers on one vendor
|
|
686
|
+
account never take each other's. The janitor deletes an agent's computer only once its agent no longer wants it.
|
|
687
|
+
|
|
766
688
|
**Where the run's folder lives.** A server keeps its runs' folders in one of two modes:
|
|
767
689
|
|
|
768
690
|
- **Mode 1** (the default): on this server's own disk. Only a provider that binds a folder of this machine can hold
|
|
769
691
|
it, so a sandbox runs on Docker only; a Daytona, Modal or E2B sandbox is refused ("Mode 1 runs a sandbox only on
|
|
770
692
|
Docker").
|
|
771
|
-
- **Mode 2**: on
|
|
772
|
-
(and an exec image pinned by digest, if you want one other than serve's default)
|
|
773
|
-
`
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
mount credential minted for that run alone; Docker's sandbox is refused, since
|
|
693
|
+
- **Mode 2**: on Archil disks. `PUT /v2/workspace/archil` turns it on with the account key, `ARCHIL_API_KEY`, its
|
|
694
|
+
region and that region's S3 URL (and an exec image pinned by digest, if you want one other than serve's default);
|
|
695
|
+
`DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by digest (git 2.47),
|
|
696
|
+
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
|
|
697
|
+
git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Daytona, Modal or E2B sandbox mounts
|
|
698
|
+
the run's folder from its disk with a mount credential minted for that run alone; Docker's sandbox is refused, since
|
|
699
|
+
it cannot mount the disk.
|
|
700
|
+
|
|
701
|
+
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
|
|
702
|
+
`AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
|
|
703
|
+
`AGENTRUN_ARCHIL_S3_URL` together, and `AGENTRUN_ARCHIL_IMAGE` for a pinned exec image, with the account key in
|
|
704
|
+
`ARCHIL_API_KEY`. Each agent's disk is then made on its first run, as with saved settings:
|
|
705
|
+
|
|
706
|
+
```sh
|
|
707
|
+
AGENTRUN_ARCHIL_REGION=aws-us-east-1 AGENTRUN_ARCHIL_S3_URL=https://s3.example.com \
|
|
708
|
+
ARCHIL_API_KEY=... node packages/serve/dist/cli.js
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
Each value is checked as the PUT checks it. One of the region and S3 URL without the other, or a value the PUT would refuse,
|
|
712
|
+
stops the start, in words naming each variable. Set, they win over saved settings, as `ARCHIL_API_KEY` wins over a
|
|
713
|
+
saved key, and nothing is written to the store: `GET /v2/workspace/archil` says `source: "env"` (saved ones say
|
|
714
|
+
`"console"`), and `PUT` and `DELETE` are `409 key_set_by_server`, since they are changed where the server is started.
|
|
715
|
+
Unset, the saved settings, if any, hold again. A runner started on its own (`agentrun-serve runner`) reads them from its
|
|
716
|
+
own environment, as it reads `ARCHIL_API_KEY`, so give it the same values.
|
|
717
|
+
|
|
718
|
+
**Archil disks: one per agent.** In Mode 2 every agent has its own disk. It is made on the agent's first run that uses
|
|
719
|
+
it, never when the agent is made, in the account key's region, named `agentrun-<server id>-i-<agent id>` (an id with
|
|
720
|
+
characters Archil doesn't take, or past 46 of them, is `h-` with its first 21 safe characters and 24 hex digits of its
|
|
721
|
+
SHA-256, so no agent's disk name is another's); making it is
|
|
722
|
+
idempotent by that name, and `GET /v2/agents/{agent_id}/archil` says which disk it is. A run's mount credential is minted
|
|
723
|
+
on its run's disk, so Archil refuses that token on every other disk: a run of one agent can't mount another agent's
|
|
724
|
+
files. This is the default, and it is enough for one owner: this server has no roles, and everything on it is its
|
|
725
|
+
owner's.
|
|
726
|
+
|
|
727
|
+
- **Isolating tenants.** A run's start may name another disk: `"archil_disk": {"disk_id": "dsk-…"}` on
|
|
728
|
+
`POST /v2/agents/{agent_id}/runs` or `POST /v2/runs` (an agent given inline). The run then keeps its folder there, and
|
|
729
|
+
its token is minted there, so a system that runs one agent for many customers (one expert, say) names a disk per
|
|
730
|
+
customer. That disk is the caller's: agentrun never makes, renames or removes it. It takes the id Archil returned when
|
|
731
|
+
the disk was made (`dsk-…`; Archil's API addresses disks by id, not owner/name), never a key or a region. The server
|
|
732
|
+
reads the disk at Archil before the run is made: a disk in another region than the account key's, or none of that id,
|
|
733
|
+
is a 422 naming the region, and no run is made; the claim reads it again, for a disk removed in between. The run's
|
|
734
|
+
launch keeps the disk it used, and whether it was the launch's or the agent's, so every claim, revoke and reclaim of
|
|
735
|
+
that run acts on that one disk, after a restart too. Any disk in the key's region may be named, by design: this
|
|
736
|
+
server has one owner, and a backend that launches runs for its customers is a trusted caller. Isolation comes from a
|
|
737
|
+
disk per boundary.
|
|
738
|
+
- **The plan's disk limit.** Archil's free plan allows 5 disks per region. When Archil refuses to make an agent's disk
|
|
739
|
+
for its plan's limit, the run fails in words ("your Archil plan allows 5 disks; upgrade or delete an agent"); no run
|
|
740
|
+
falls back to a shared disk.
|
|
741
|
+
- **Removing an agent's disk.** This server archives agents and never deletes one, and an archive keeps everything,
|
|
742
|
+
its disk included. `DELETE /v2/agents/{agent_id}/archil` deletes the agent's own disk at Archil (its runs' folders,
|
|
743
|
+
its home and its learning with it) and frees a disk of the plan, once no live run of any agent is on it (a run of
|
|
744
|
+
another agent may name it in `archil_disk`). The agent must be archived, unless its source manages it: an inline
|
|
745
|
+
run's agent is never archived here, and its caller decides when it is done. The disk is marked as being removed
|
|
746
|
+
before the live runs are counted: from then a new run of the agent on it is `409 agent_not_runnable`, and a run
|
|
747
|
+
launched just before is refused at its claim, so no run starts on a disk being deleted. A refusal leaves the disk the
|
|
748
|
+
agent's. It never touches a disk a run's launch named.
|
|
749
|
+
- **Before you upgrade.** In Archil mode, an agent's files from before this release stay on the old server disk at
|
|
750
|
+
Archil; the agent starts on a new disk of its own. `diskId` is no longer a setting: there is no server-wide disk, and
|
|
751
|
+
no agent falls back to one.
|
|
752
|
+
- **Later, narrower tokens.** Archil's tokens reach a whole disk; nothing narrower exists today. If Archil ships
|
|
753
|
+
path-scoped tokens, a run's token narrows from its disk to its own folder with no other change.
|
|
754
|
+
|
|
755
|
+
**A Daytona computer's snapshot.** The mount runs as root through the image's root helper and its pinned archil client,
|
|
756
|
+
so a Daytona computer that mounts the run's folder must start from a snapshot of the computer package's
|
|
757
|
+
`box/Dockerfile`; Daytona's default snapshot, whose user is not root, is refused before anything mounts. Build one in
|
|
758
|
+
the organization of `DAYTONA_API_KEY` with Daytona's Python SDK (`pip install daytona`), which prints its name, a hash
|
|
759
|
+
of the recipe:
|
|
760
|
+
|
|
761
|
+
```sh
|
|
762
|
+
DAYTONA_API_KEY=... python3 packages/computer/box/build-daytona.py # prints snapshot=agentrun-archil-<12 hex>
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
and name it in the server's environment, `AGENTRUN_DAYTONA_SNAPSHOT=agentrun-archil-<12 hex>` (the id or name of any
|
|
766
|
+
Daytona snapshot), as `AGENTRUN_DOCKER_IMAGE` names Docker's image. Every Daytona computer is then made from it. Unset,
|
|
767
|
+
it is Daytona's default snapshot, as before. A changed recipe is a new name, so build again after an upgrade that
|
|
768
|
+
changes `box/`. The [Daytona box](#a-run-in-a-daytona-box) never reads it.
|
|
777
769
|
|
|
778
770
|
A desktop, a phone and a browser run in either mode. The run's folder is at `/workspace` in every computer that mounts
|
|
779
771
|
it: a sandbox always, and a desktop whose provider mounts the mode's folder (Docker's in Mode 1, E2B's in Mode 2). A
|
|
@@ -814,7 +806,7 @@ only those hosts (the default list, a sandbox's package registries, is no browsi
|
|
|
814
806
|
|
|
815
807
|
**Docker.** A Docker computer runs where this server's Docker answers. With `AGENTRUN_BOXES` not set at all (a plain
|
|
816
808
|
`npx @parcha/agentrun`), the server probes `docker` at its start (within 5 s) and offers it when Docker answers
|
|
817
|
-
(`ready
|
|
809
|
+
(`ready`); `AGENTRUN_BOXES`,
|
|
818
810
|
when set, lists what it probes, and `AGENTRUN_BOXES=none` probes nothing. One log line says what it found:
|
|
819
811
|
|
|
820
812
|
event=boxes available=<ids or none> unavailable=<ids> <id>="<why>" ...
|
|
@@ -933,6 +925,7 @@ agent_not_runnable`, with `details.unbound` and `details.missing`).
|
|
|
933
925
|
| `monid.run` | Run one monid endpoint, paid per call from the monid wallet: `{provider, endpoint, input}` in, the run's `output`, `price` and `cost` out | `MONID_API_KEY` | no, no |
|
|
934
926
|
| `pdf_pages` | A workflow call only: `{path, maxPages?, dpi?}` in, `{name, pageCount, dpi, pages: [{page, image}], text}` out. Draws a document's first pages (3 by default, at 110 dpi) as PNGs under the run's `work/pages/<stem>/<dpi>/` (`<stem>`: the document's path below its directory made one name, with a short hash, so two documents of one file name never share pages), the dpi lowered so a page's long side is at most 1568 px, with its text (`pdftotext`, cut at 20,000 characters). A PNG or JPEG passes through as one page, scaled down to 1568 px. `path` is under `--documents` or the run's `work/`, never outside | `pdftoppm`, `pdftotext` | no, yes |
|
|
935
927
|
| `llm` | A workflow call only: `{prompt, system?, maxTokens?, tier?}` in, `{text, model, usage, cost_usd}` out. One completion on the run's model of the tier (`default`; a tier the state fills in, such as `"{requestedTier}"`, may be any of the three, and a tier with no model fails the call), no tools and no loop; `cost_usd` is null when the model has no price, never 0 | a model | no, yes |
|
|
928
|
+
| `subagent` | pi only: `{prompt, tools?, model?, max_tool_calls?, effort?}` in, the child's last text out, bounded like a host tool's result. Runs a fresh conversation whose whole task is `prompt`, with `tools` a subset of the agent's own (by catalog or session name, MCP tools and `bash` included; absent, none), on the agent's own model or the tier `model` names (`fast` or `strong`: the definition's `model_tiers`, else `AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`, else the agent's own model) ([subagents](#subagents)) | a pi run | no, no |
|
|
936
929
|
|
|
937
930
|
`bash` and the background tools run only in a box: a runner agent, and a workflow, get no shell on this machine (see [Safety](#safety)). In a
|
|
938
931
|
sandbox place `read`, `write` and `edit` run in the box too.
|
|
@@ -975,6 +968,54 @@ to read it, which a run's confinement refuses, Codex keeps only the ends of a re
|
|
|
975
968
|
would cut one past 2,000 lines or 51,200 bytes and save the rest to a file the session has no tool to read. A
|
|
976
969
|
`web_search` answer past 100,000 characters leaves out its least relevant results, `omitted` counting them.
|
|
977
970
|
|
|
971
|
+
### Subagents
|
|
972
|
+
|
|
973
|
+
`subagent` is one primitive: a prompt, a fresh context and a subset of the agent's own tools, on the agent's own model
|
|
974
|
+
unless the call names a tier. A child keeps the run's gate, so the agent's permissions and bash policy (`read-only`)
|
|
975
|
+
hold its tool calls too, and every request it makes books on the run's one cap. It goes one level deep (a child is never
|
|
976
|
+
given `subagent` or `ask_person`), and at most 4 children of a run work at once; more wait. The run's timeline nests each
|
|
977
|
+
child under its call, and the run's cost counts every child's requests. How to split work and merge answers is the
|
|
978
|
+
agent's own instructions, never the engine's.
|
|
979
|
+
|
|
980
|
+
A call may set its child's `max_tool_calls` and `effort`. `max_tool_calls` narrows the agent's own budget (its definition's
|
|
981
|
+
`max_tool_calls`, which holds each conversation) for that child and never widens it; with no budget of the agent's, the
|
|
982
|
+
call's holds. `effort` (`low`, `medium` or `high`) is the child's thinking level; absent, the child thinks as the agent
|
|
983
|
+
does. So one template can run wide reviewers at `medium` with 30 calls and deep ones at `high` with 90.
|
|
984
|
+
|
|
985
|
+
A child is a conversation in the run's own journal, owned by its call, so it lives and ends with the run:
|
|
986
|
+
|
|
987
|
+
- **A restart or a moved claim** resumes it. The next claim finds the same child, which answers its call once. A request
|
|
988
|
+
it had finished is never sent again, and one the stop cut is sent again. A child on a tier whose model changed in the
|
|
989
|
+
meantime (the server's `AGENT_MODEL_STRONG`, say) resumes on the tier's model now.
|
|
990
|
+
- **A cancel** stops every child with the run: their requests are aborted, and nothing more is asked.
|
|
991
|
+
- **The cap.** When the run's cap refuses a child's request, the child stops and its call fails in the cap's words
|
|
992
|
+
(`subagent: it stopped before it answered: ... spend_cap_reached`). The run's next request is refused the same way, so
|
|
993
|
+
the run parks at its cap (`input_required`, a `budget` pending) and sends nothing more. A raise resumes the run, not
|
|
994
|
+
the child: the agent reads the failed call on its next turn and may call `subagent` again, which starts a fresh child.
|
|
995
|
+
On a capped run, a call on a tier whose model has no known price is refused before any child starts.
|
|
996
|
+
|
|
997
|
+
#### Patterns
|
|
998
|
+
|
|
999
|
+
**Sample K, merge, verify.** One pass misses what a second finds, and states things neither would confirm. A template's
|
|
1000
|
+
skill can ask for K passes and check their union, with no engine support beyond the tool:
|
|
1001
|
+
|
|
1002
|
+
1. In one turn, make K `subagent` calls with the same prompt and tools (K of 3 or 4 run at once; more wait their turn).
|
|
1003
|
+
Each starts from a fresh context, so the answers vary the way independent samples do.
|
|
1004
|
+
2. Merge the K answers: dedupe the items that say the same thing about the same place, and keep how many children found
|
|
1005
|
+
each.
|
|
1006
|
+
3. Before acting on a kept item, re-check it with the parent's own tools: open the file, page or record it cites and
|
|
1007
|
+
confirm it says what the item claims. Drop what does not hold. Agreement between children orders the checks; it is
|
|
1008
|
+
never the check.
|
|
1009
|
+
|
|
1010
|
+
It fits any agent whose answer is a list:
|
|
1011
|
+
|
|
1012
|
+
- Research: children answer with `web_search` and `web_fetch`; the parent re-fetches each cited source before it writes.
|
|
1013
|
+
- QA: children run one test plan with `browser`; the parent reproduces each finding before it files it.
|
|
1014
|
+
- Extraction: children pull a document's fields with `read`; the parent reads the page again for any value they differ on.
|
|
1015
|
+
- Code review: children read a diff with read-only `bash`; the parent re-reads each finding's lines before it posts.
|
|
1016
|
+
|
|
1017
|
+
Each child books on the run's cap, so size the cap for K passes, not one.
|
|
1018
|
+
|
|
978
1019
|
### Search and fetch
|
|
979
1020
|
|
|
980
1021
|
`web_search` and `web_fetch` work on every harness with only a model key. Each resolves, for a run, in one order: (1) the
|
|
@@ -1191,6 +1232,19 @@ and the ask expires, the agent told the cap's words. When the
|
|
|
1191
1232
|
browser comes back, what was held up front goes, and the time the person had stays held, at the provider's price, until
|
|
1192
1233
|
the session's next charge books it: take-overs given back with no browser call between them still meet the cap.
|
|
1193
1234
|
|
|
1235
|
+
**The run waits for you, its browser kept.** When the agent asks the person a question (`ask_person`) with its browser open,
|
|
1236
|
+
the run waits for the answer with that browser kept open for them: its page, the live view and Take over stay there. The
|
|
1237
|
+
browser's own idle release (a few minutes with no browser call) doesn't apply while it waits. It is kept for the person's
|
|
1238
|
+
window, `AGENTRUN_BROWSER_PERSON_WAIT_MIN` (whole minutes, 1 to 360; 15 by default), the same setting that bounds a
|
|
1239
|
+
take-over with no input and an agent's hand-over ask (above, 15 minutes each by default), so the three never drift apart.
|
|
1240
|
+
The window's session time is held under the run's cap first, at the provider's price, like a take-over's: while the run
|
|
1241
|
+
waits, its cost grows by the browser's session time only, never by model time, and with no room under the cap the run
|
|
1242
|
+
parks at once. An answer inside the window goes back to the agent on the same page. At the window's end the run parks and
|
|
1243
|
+
the browser is released ("The browser was released after 15 min waiting for you" on the timeline, and the Screen tab says
|
|
1244
|
+
so, with when, until a browser opens again), so its billing stops there. An answer after that goes on with a new
|
|
1245
|
+
browser, opened at the agent's next browser call. A browser its provider ends before the answer says so too ("The browser
|
|
1246
|
+
session ended while the run waited for you"). A provider's own session timeout still applies: keep the window under it.
|
|
1247
|
+
|
|
1194
1248
|
**The agent asks.** The agent may ask the owner to do something in its browser (`browser_request_handoff`: an instruction
|
|
1195
1249
|
and how it will know it is done, such as signing in). Its person's time is held the same way first; with no room no ask is
|
|
1196
1250
|
made, and the tool's result says why. The run then reads `input_required`/`waiting` with
|
|
@@ -1436,6 +1490,35 @@ names a tool whose title, description, schemas or annotations differ. `DELETE ..
|
|
|
1436
1490
|
credential. Capabilities' `features.mcp_client` says `transports: ["streamable-http"]`, the `auth` types and `at_rest:
|
|
1437
1491
|
"sealed"`.
|
|
1438
1492
|
|
|
1493
|
+
### A credential handed with each run
|
|
1494
|
+
|
|
1495
|
+
Some servers take a credential made for one run (a token scoped to that run's job and its person) that no saved
|
|
1496
|
+
server could hold. Save such a server with `auth: {type: "per_run", headers?}`: it keeps no credential, and `headers`,
|
|
1497
|
+
when sent, are used only to list its tools now. Then hand each run its own as `mcp_auth` on the run's start
|
|
1498
|
+
(`POST /v2/runs`, `POST /v2/agents/{agent_id}/runs`), one entry for each per_run server it calls:
|
|
1499
|
+
|
|
1500
|
+
```sh
|
|
1501
|
+
curl -X PUT "$BASE/v2/settings/mcp-servers/gateway" -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \
|
|
1502
|
+
-d '{"url": "https://gateway.example.com/mcp", "auth": {"type": "per_run", "headers": {"authorization": "Bearer <a token to list with>"}}}'
|
|
1503
|
+
curl -X POST "$BASE/v2/agents/$AGENT/runs" -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \
|
|
1504
|
+
-d '{"input": {"content": "..."}, "mcp_auth": {"gateway": {"headers": {"authorization": "Bearer <this run'"'"'s token>"}}}}'
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
A per_run save keeps no secret, so the API token may make it, as it may preview a server with a credential: the
|
|
1508
|
+
credentials such a server receives are the ones each run's own caller hands it. The run's calls of that server carry
|
|
1509
|
+
those headers, and only to the origin the server had when the run was started. The
|
|
1510
|
+
credential is sealed into the run's launch record under `AGENTRUN_SEAL_KEY` (bound to the run's id), read at each claim, so
|
|
1511
|
+
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
|
|
1512
|
+
saved body, its timeline, its view, a log line or an `Idempotency-Key`'s fingerprint (a retry with a new credential
|
|
1513
|
+
answers the first request's run), and its values are cut from whatever the run shows. `POST /v2/runs/{run_id}/messages`
|
|
1514
|
+
takes `mcp_auth` too: it replaces the run's credentials in the message's own write, so the turn the message starts (a
|
|
1515
|
+
steer into a working run from its next model request, or a follow-up that opens an ended run again) calls with them. A
|
|
1516
|
+
name that is not a saved per_run server is `422` at `mcp_auth.<server>`, and no run starts. A run handed no credential
|
|
1517
|
+
for a per_run server it calls has those calls answered, unsent, that it was handed none. `POST .../{name}/refresh` lists
|
|
1518
|
+
a per_run server's tools with no credential: save it again with `headers` for a server that lists only to a caller it
|
|
1519
|
+
knows. The tools are those it listed at its save, so a server whose tool list varies by caller shows each run the saved
|
|
1520
|
+
list.
|
|
1521
|
+
|
|
1439
1522
|
### Signing in with OAuth
|
|
1440
1523
|
|
|
1441
1524
|
A server whose preview answers `details.auth: "oauth"` is signed in to by this server, which keeps the tokens: the
|
|
@@ -1721,8 +1804,8 @@ then the body, cut at 16 KiB, inside `<trigger-payload source="webhook" scheme="
|
|
|
1721
1804
|
whatever the sender wrote is data, not an instruction. The tag names the signature scheme, the event as that scheme
|
|
1722
1805
|
reads it (`event="..."`), the JSON body's top-level `action` (`action="..."`) and an unsigned delivery id
|
|
1723
1806
|
(`delivery="..."`, GitHub's `X-GitHub-Delivery`) and, for a GitHub delivery, its pull request or issue's `number="..."`
|
|
1724
|
-
(`pull_request.number`, else `issue.number`) and a pull request's `head_sha="..."` (40 hex; a
|
|
1725
|
-
no `head_sha` at all), read from the signed body so the payload's cut never loses them, each when there is one, so an
|
|
1807
|
+
(`pull_request.number`, else `issue.number`) and a pull request's `head_sha="..."` and `base_sha="..."` (40 hex each; a
|
|
1808
|
+
comment event has neither, so no `head_sha` or `base_sha` at all), read from the signed body so the payload's cut never loses them, each when there is one, so an
|
|
1726
1809
|
agent's instructions can read what it was given; a sender's words there are cut to 200 characters, their quotes and brackets escaped, and a closing tag in
|
|
1727
1810
|
the body, in any case, is defused.
|
|
1728
1811
|
|
|
@@ -1886,6 +1969,22 @@ expires, so a long run's calls never carry an expired token. When that mint fail
|
|
|
1886
1969
|
it expires; then the run's calls of that server are answered, unsent, that its GitHub App token expired and a new one
|
|
1887
1970
|
could not be made, with GitHub's reason, and the next launch (a resume) mints a fresh one.
|
|
1888
1971
|
|
|
1972
|
+
An agent whose definition says `checkout: pull_request` starts each run a GitHub event about a pull request started in a
|
|
1973
|
+
checkout of it, made by the server at each claim before the first turn ([runner/pr-checkout.ts](src/runner/pr-checkout.ts)).
|
|
1974
|
+
It reads the repository, number, head and base from the server's own payload tag, only on a run a github trigger started
|
|
1975
|
+
(its launch's input origin) and never from anyone's words, and runs one
|
|
1976
|
+
command on the run's folder (a process here in Mode 1, Archil's exec in Mode 2): `git init repo`, a fetch of the head and
|
|
1977
|
+
the base 50 commits deep, deepened until their merge base is in (about 3,200 commits at most), then a detached checkout
|
|
1978
|
+
of the head, with refs `pr/head`, `pr/base` and `pr/merge-base`. The fetch takes an installation token minted for that
|
|
1979
|
+
one repository with `permissions: {contents: "read"}` alone, handed to the command on its stdin and turned there into an
|
|
1980
|
+
`Authorization` header in git's environment, scoped to GitHub's site; it is never in argv, `.git/config`, the remote's
|
|
1981
|
+
URL (`https://github.com/<owner>/<repo>.git`), the run's folder, the agent's environment or a log line, and it is revoked
|
|
1982
|
+
once the fetch is done. Git there reads no system or global config and fetches no tags or submodules. With no App, or one
|
|
1983
|
+
not installed on the repository, the fetch is anonymous, which a public repository answers. The run's system prompt
|
|
1984
|
+
carries one line: the checkout's facts, or why there is none (no pull request named, a fetch that failed, with git's
|
|
1985
|
+
last words), so its instructions can read the change through the GitHub MCP instead. The checkout is removed when the
|
|
1986
|
+
claim ends, and the next claim of the run makes it again.
|
|
1987
|
+
|
|
1889
1988
|
## Templates
|
|
1890
1989
|
|
|
1891
1990
|
A template package makes a working agent in one call: its definition, its skills and rules, and its triggers, from a
|
|
@@ -1918,7 +2017,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
1918
2017
|
| `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
|
|
1919
2018
|
| `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. |
|
|
1920
2019
|
| `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. |
|
|
1921
|
-
| `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)), `max_tool_calls` (agentic only, on pi): the tool calls each conversation of a run may make ([tool-call budget](#tool-call-budget)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. 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)). |
|
|
2020
|
+
| `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)), `max_tool_calls` (agentic only, on pi): the tool calls each conversation of a run may make ([tool-call budget](#tool-call-budget)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
|
|
1922
2021
|
| `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. |
|
|
1923
2022
|
| `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
|
|
1924
2023
|
| `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
|
|
@@ -1934,7 +2033,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
1934
2033
|
| `GET /runs/{id}/files`, `GET /runs/{id}/files/{path}` | The files under the run's `work/`, raw. |
|
|
1935
2034
|
| `POST /files`, `PUT /files/{id}`, `GET /files`, `GET` and `DELETE /files/{id}` | [Uploads](#uploads): a file sent in one call (`POST /v2/files?path=...`, its bytes the body), or reserved and then sent (`PUT /v2/files/{id}`); the server's uploads listed, read and deleted. |
|
|
1936
2035
|
| `GET /agents/{id}/home/files`, and `GET`, `PUT`, `DELETE` on a file's path below it | The files in the agent's home, listed, read, written and deleted ([agent home](#agent-home)). This server's own routes (`x-agentrun-serve: "home/1"`). |
|
|
1937
|
-
| `GET /stats` | This server's own route, outside the contract (`x-agentrun-serve: "stats/1"`): the agents, the runs (`total`, `active`, `needs_input`, `failed`, `needs_review`, `status_unknown`), each agent's run count, the cost and what is archived, read from the agent store's aggregates alone, no run's files opened. Archived agents and runs are left out of every number but `archived`. A completed or cancelled run counts only in `runs.total`, but for an escalated one (completed, waiting for a person's review), which `needs_review` (`stats/3`) counts; `failed` never does. Each running run is in exactly one of `active` (queued or working) and `needs_input` (`input_required`), both from the runs this server holds, and `status_unknown`: a running run it does not hold, or holds as ended before its end is written. `cost.usd` sums the runs that ended with a cost and is null when none did, never $0, with `basis` `estimate`, or null beside a null `usd`; `unknown_runs` counts the rest. `analytics` (`stats/2`) sums the runs' metrics over the runs not archived that `from` and `to` (RFC 3339 date-times to the millisecond, an impossible one or a finer fraction refused; runs started in [`from`, `to`)) and `agent` pick, each optional, 400 when malformed: `filter` echoes them; `totals` (runs, completed, an escalated run included, `needs_review` (`stats/3`), failed, never an escalated run, `runs_with_metrics`, tokens and each token kind, requests, unmetered, `cost_usd` and `unknown_cost_runs`), `time` (`wall_ms` over the ended runs, `active_ms` where metrics have it), `by_harness_effort`, `by_day` (UTC), `by_source` (`live` or the import source) and the top 20 `tools`. A run with no metrics counts in `runs` and in no token sum. `learning` (`learning/1`) counts the runs that tried to learn over the same filters, from the
|
|
2036
|
+
| `GET /stats` | This server's own route, outside the contract (`x-agentrun-serve: "stats/1"`): the agents, the runs (`total`, `active`, `needs_input`, `failed`, `needs_review`, `status_unknown`), each agent's run count, the cost and what is archived, read from the agent store's aggregates alone, no run's files opened. Archived agents and runs are left out of every number but `archived`. A completed or cancelled run counts only in `runs.total`, but for an escalated one (completed, waiting for a person's review), which `needs_review` (`stats/3`) counts; `failed` never does. Each running run is in exactly one of `active` (queued or working) and `needs_input` (`input_required`), both from the runs this server holds, and `status_unknown`: a running run it does not hold, or holds as ended before its end is written. `cost.usd` sums the runs that ended with a cost and is null when none did, never $0, with `basis` `estimate`, or null beside a null `usd`; `unknown_runs` counts the rest. `analytics` (`stats/2`) sums the runs' metrics over the runs not archived that `from` and `to` (RFC 3339 date-times to the millisecond, an impossible one or a finer fraction refused; runs started in [`from`, `to`)) and `agent` pick, each optional, 400 when malformed: `filter` echoes them; `totals` (runs, completed, an escalated run included, `needs_review` (`stats/3`), failed, never an escalated run, `runs_with_metrics`, tokens and each token kind, requests, unmetered, `cost_usd` and `unknown_cost_runs`), `time` (`wall_ms` over the ended runs, `active_ms` where metrics have it), `by_harness_effort`, `by_day` (UTC), `by_source` (`live` or the import source) and the top 20 `tools`. A run with no metrics counts in `runs` and in no token sum. `learning` (`learning/1`) counts the runs that tried to learn over the same filters, from the store ([Learning](#learning)). The query bounds `analytics` and `learning` alone. |
|
|
1938
2037
|
| `GET /runs/{id}/graph` | A workflow run drawn, live: its workflow, the DSL's `workflowGraph`, each node's state (a map's items with their labels and the branch each route took for them, a route's branch), every decision with its receipt (answers, evidence, the state the judge saw, image links), every call with its input and output, and the totals (cost, null when any part is unknown). While the run goes it reads the run process's `live.json`, rewritten every 300 ms, never the run's store, which the process holds; once it ended, its store is read lock-free, so a poll never waits on it and never answers `home_busy`. An agentic run has none (`404`). |
|
|
1939
2038
|
| `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`. |
|
|
1940
2039
|
| `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`. |
|
|
@@ -1963,6 +2062,7 @@ serves these routes alone:
|
|
|
1963
2062
|
- a run's launch (`POST /agents/{id}/runs`, `POST /runs`), read (`GET /runs/{id}`), lists (`GET /agents/{id}/runs`,
|
|
1964
2063
|
`GET /runs`), timeline, messages, stop, cancel, kill (`501` here, as above) and cap raise (`PATCH /runs/{id}`);
|
|
1965
2064
|
- its files (`GET /runs/{id}/files`, `GET /runs/{id}/files/{path}`) and [uploads](#uploads) (`/files`);
|
|
2065
|
+
- an agent's Archil disk (`GET` and `DELETE /agents/{id}/archil`);
|
|
1966
2066
|
- `GET /capabilities`, `GET /health` and `GET /usage`.
|
|
1967
2067
|
|
|
1968
2068
|
Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
|
|
@@ -2132,9 +2232,9 @@ alone: a model of any other provider runs as it does without it. `codex` and `op
|
|
|
2132
2232
|
to serve's gateway (`AGENT_MODEL_BASE_URL`), else OpenAI with `OPENAI_API_KEY`. A harness with none of its own settings, where
|
|
2133
2233
|
`OPENROUTER_API_KEY` is set, runs through OpenRouter (`https://openrouter.ai/api`, the key as a bearer token):
|
|
2134
2234
|
claude-agent on its Messages endpoint, with Anthropic's own id on the wire (OpenRouter takes it: its Claude Code guide
|
|
2135
|
-
says its "Anthropic Skin … handles model mapping") and the run priced by OpenRouter's catalog entry; codex and opencode on its Responses API, with the model's whole id (`openai/gpt-6-sol`). On that key alone the defaults are
|
|
2136
|
-
`openrouter/openai/gpt-6-sol` for pi (pi-ai's OpenRouter provider, on the bearer route), `anthropic/claude-sonnet-5.5` for
|
|
2137
|
-
claude-agent and `openai/gpt-6-sol` for codex and opencode; a direct provider's key gives the default for its harnesses where it is
|
|
2235
|
+
says its "Anthropic Skin … handles model mapping") and the run priced by OpenRouter's catalog entry; codex and opencode on its Responses API, with the model's whole id (`openai/gpt-6.1-sol`). On that key alone the defaults are
|
|
2236
|
+
`openrouter/openai/gpt-6.1-sol` for pi (pi-ai's OpenRouter provider, on the bearer route), `anthropic/claude-sonnet-5.5` for
|
|
2237
|
+
claude-agent and `openai/gpt-6.1-sol` for codex and opencode; a direct provider's key gives the default for its harnesses where it is
|
|
2138
2238
|
set. A model named `openrouter/<vendor>/<model>` (pi's name for it) goes through OpenRouter on every harness. An endpoint
|
|
2139
2239
|
the host names never gets OpenRouter's key: `ANTHROPIC_BASE_URL` without `ANTHROPIC_API_KEY` is refused. A model with more
|
|
2140
2240
|
than one segment after its provider (`anthropic/anthropic/claude-sonnet-5.5`) is refused, naming the form to use. A provider
|
|
@@ -2359,7 +2459,7 @@ left out: 2 sessions still being written: they come in next time
|
|
|
2359
2459
|
A stopped run can be continued: a follow-up starts a fresh turn on the whole history, and the turn the stop cut is
|
|
2360
2460
|
not replayed. A cancelled run cannot: a message to it is `409 not_continuable`, and its `next_action` is to start a
|
|
2361
2461
|
new run of the agent.
|
|
2362
|
-
- A workflow revision runs on the workflow loop, which drives the
|
|
2462
|
+
- A workflow revision runs on the workflow loop, which drives the server's durable workflow task (src/workflow/task.ts) on the run's journal
|
|
2363
2463
|
(keyed by the run's id): its model nodes (`agent`, `decide`, `extract`, `report`) on the run's model, with the file
|
|
2364
2464
|
tools each node names, and its typed questions on Jev or Parallel ([decision workflows](#decision-workflows)). A
|
|
2365
2465
|
workflow that needs code or a tool call this host does not run is not saved here (`422`). The run is `queued`
|
|
@@ -2525,7 +2625,7 @@ path that is not a `.md` file at the top, a bad name, front matter out of shape
|
|
|
2525
2625
|
naming a note that is not active, more than 8 notes superseded, more than 8 new notes or a note over 4068 bytes (4096,
|
|
2526
2626
|
less the 28 the server's own `origin` and `status` lines may take once it merges the note), an
|
|
2527
2627
|
index past 200 lines, hidden characters, and text shaped like a secret or holding one of the server's own secrets (the
|
|
2528
|
-
launcher's, the keys and tokens in its environment, its API
|
|
2628
|
+
launcher's, the keys and tokens in its environment, its API token, each webhook trigger's signing secret as it
|
|
2529
2629
|
is now), in a note or its name. A cap leaves out the items past it, in the order the answer gave them, and the run's
|
|
2530
2630
|
learning names what was left out. The whole answer is refused when it holds a secret or a hidden character (no item of
|
|
2531
2631
|
it is trusted), when it writes a path outside the folder or deletes a file, when a text is not UTF-8, when the index
|
|
@@ -2572,7 +2672,7 @@ characters and no time) says how it went: `seeded`, then
|
|
|
2572
2672
|
`reflecting` during the turn and until what it answered is checked, `proposed` while it is graded, and `merged`, or
|
|
2573
2673
|
`dropped` with a reason from a closed list (`seed_failed`, `no_budget`, `unknown_cost`, `cancelled`, `crashed`,
|
|
2574
2674
|
`reflect_timeout`, `reflect_failed`, `empty`, `unparsed`, `propose_failed`, `checker`, `grader`, `grade_failed`; a run
|
|
2575
|
-
record
|
|
2675
|
+
record with any other reason is not counted). It is `null` for a
|
|
2576
2676
|
run that does not learn (its agent's `learning` is not true, the server's switch was off when it started, or it is a
|
|
2577
2677
|
workflow's or an imported run). Its `detail` says the same in a person's words, never the machine's: "Started from 2
|
|
2578
2678
|
notes.", "Looking back on this run…", "Checking 1 new note…", "Learned: Check units (replaces 1 older note)", "Learned:
|
|
@@ -2596,17 +2696,9 @@ notes its merge added, once `merged`; and `pending`, `[{file, name}]`, the notes
|
|
|
2596
2696
|
`merged`, never among `learned`. A name and a file are cut of the server's secrets as they are now, a file holding one
|
|
2597
2697
|
`[redacted]`. Whether a run applied a note is not measured: `given` and `read` say what it had and what it opened. Each
|
|
2598
2698
|
note on the agent's learning view and notes page counts its runs of each, `runs: {given, read}`, over the runs the server
|
|
2599
|
-
knows
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
state, reason, at, cost, tokens, seed_notes, given, read, answered_at, job_cost_usd, look_back_usd}` (`cost` and
|
|
2603
|
-
`tokens` the grade's, null when unknown, 0 when nothing was graded; `seed_notes` how many notes the run started from;
|
|
2604
|
-
`given` and `read` the files of the notes it was given and read, each absent when there are none; once it looked back,
|
|
2605
|
-
`answered_at` and `job_cost_usd`, when its job's answer was final and what it had cost then; `look_back_usd` what
|
|
2606
|
-
looking back cost, 0 when it did not), after its `serve.json` holds it; a server that went between the two writes it at
|
|
2607
|
-
its next start. A run's notes are the one part that moves after its end (a follow-up reads another note): a line
|
|
2608
|
-
`{run, agent, notes: true, given, read}` then says them anew, the latest one winning, and counts neither the run nor its
|
|
2609
|
-
costs again. `GET /stats` counts the runs that tried to learn under `learning`, over its `from`, `to` and
|
|
2699
|
+
knows, read from the store.
|
|
2700
|
+
|
|
2701
|
+
`GET /stats` counts the runs that tried to learn under `learning`, over its `from`, `to` and
|
|
2610
2702
|
`agent`, from the store (each run's kept learning and its learning run's journal; `in_progress` while a proposal waits
|
|
2611
2703
|
for its grade), never opening a run's files; the `learning` meter on `GET /usage` reads each run's grade from the same.
|
|
2612
2704
|
|
|
@@ -2640,13 +2732,12 @@ with the token, an archived agent's too:
|
|
|
2640
2732
|
- `GET /agents/{agent_id}/learning`: `main`'s head, `MEMORY.md` as `index`, the first 50 notes (active first, then
|
|
2641
2733
|
newest first) and the first 20 changes on `main` (newest first, each `by: {run}` from its `Run-Id` trailer or
|
|
2642
2734
|
`{user: true}`, with its commit, time, reason and files), and how the agent's runs that tried to learn fared
|
|
2643
|
-
(`merged`, `dropped` by reason, `in_progress`), counted as `GET /stats` counts them: from the
|
|
2644
|
-
runs the server holds, never a run's files; and `impact` (`learning/2`), what learning changed: the agent's completed
|
|
2735
|
+
(`merged`, `dropped` by reason, `in_progress`), counted as `GET /stats` counts them: from the store, never a run's files; and `impact` (`learning/2`), what learning changed: the agent's completed
|
|
2645
2736
|
runs that started from at least one active note against those that started before its first note (the earlier of its
|
|
2646
2737
|
first merge and the start of its first run that started from a note, so a person's first note counts), each side's
|
|
2647
2738
|
`runs`; `median_duration_s`, the time to the answer (the run's start to its job's end, before it looks back);
|
|
2648
2739
|
`median_cost_usd`, the job's own cost without its look-back, over the `cost_runs` whose cost is known; and
|
|
2649
|
-
`median_learning_usd`, what learning itself cost a run (its look-back and its grade). From the same rows
|
|
2740
|
+
`median_learning_usd`, what learning itself cost a run (its look-back and its grade). From the same rows;
|
|
2650
2741
|
null unless both sides count 2 runs. An agent with no folder answers `main: null`, empty pages and `impact: null`.
|
|
2651
2742
|
`GET .../learning/notes?cursor=&limit=&status=` and `GET .../learning/log?cursor=&limit=` page on, up to 200 at a
|
|
2652
2743
|
time; a cursor reads the same commit its first page did.
|
|
@@ -2713,7 +2804,7 @@ Who can approve: the owner, signed in with their password. No token approves, th
|
|
|
2713
2804
|
|
|
2714
2805
|
`POST .../learning/files/{file}/approve` (and `.../restore`, which puts a retired item back into every run) takes the console's password session, sent from this server's own origin with
|
|
2715
2806
|
a JSON body as every page write is. Any token is 403: the server's own (what scripts and the MCP endpoint's tools
|
|
2716
|
-
carry)
|
|
2807
|
+
carry) and a token sent beside the session. So is every request on a server with accounts off
|
|
2717
2808
|
(`AGENTRUN_ACCOUNTS=0`), whose page cookie any token holder can mint. With no credential it is 401, as every route.
|
|
2718
2809
|
`capabilities.learning.approve` is true only for the owner's session; every other caller reads `approve: false` with
|
|
2719
2810
|
`approve_needs: "password"`. A note that is not pending is 400; a stale ETag is 412, none 428. The approval is one host
|
|
@@ -2901,7 +2992,8 @@ no cap fixes, its error), as a person who has never seen a model request reads t
|
|
|
2901
2992
|
least $0.03, and this run's cap is $0.01. Raise the cap to at least $0.03 to continue.", and once a run has spent:
|
|
2902
2993
|
"Not sent: this run has spent $0.45 of its $0.50 cap, and the next step needs at least $0.03. Raise the cap to at least
|
|
2903
2994
|
$0.48 to continue." What was spent, and what steps still running hold (named when it is a cent or more), read to the
|
|
2904
|
-
nearest cent ($0.0237416 reads $0.02);
|
|
2995
|
+
nearest cent ($0.0237416 reads $0.02); a spend above $0 that rounds to $0 reads "less than a cent" ("this run has spent
|
|
2996
|
+
less than a cent of its $0.105 cap"), never "$0"; the exact amounts are `pending.spent_usd`. The cap to raise to is what was
|
|
2905
2997
|
spent, what steps still running hold, and the next step's least, rounded up to the cent so that it is enough. The words
|
|
2906
2998
|
name no model. The refusal's timeline row is an `error` row with
|
|
2907
2999
|
`paused: true`: the request was not sent and the run waits on a raise, so it reads as a pause, never as a failure. The error's code is `spend_cap_reached (out of budget): ` before those words: pi-ai's
|
|
@@ -3035,13 +3127,13 @@ carries no cost at all, as from a provider that does not price the model. The te
|
|
|
3035
3127
|
|
|
3036
3128
|
- An import (`agentrun-serve import`, and setup's import) cuts secrets out of everything it writes: the values of the
|
|
3037
3129
|
environment's key-shaped variables and the keys saved on this server, the secrets this server made and keeps (its API
|
|
3038
|
-
token, its
|
|
3130
|
+
token, its sign-in secret, and its webhook's signing secret when the seal key opens it; when it does
|
|
3039
3131
|
not, the CLI's import says so once, on stderr, and goes on), and the keys [secretlint](https://github.com/secretlint/secretlint)'s
|
|
3040
3132
|
recommended rules find in what it reads (Anthropic, OpenAI, GitHub, Slack and Stripe keys, AWS secret keys beside their
|
|
3041
3133
|
name, private keys, database URLs with a password, and more). Each becomes `[redacted]`, and the import says how many
|
|
3042
3134
|
distinct values it removed. Known key formats are removed. Other secrets in your session history, like passwords in
|
|
3043
|
-
config files, are imported as they are. So
|
|
3044
|
-
another service)
|
|
3135
|
+
config files, are imported as they are. So is a key-shaped value this server did not make (a `whsec_` secret from
|
|
3136
|
+
another service).
|
|
3045
3137
|
- The decision keys (`TYPESAFE_API_KEY`, `PARALLEL_API_KEY`, `OPENROUTER_API_KEY` as Jev's or OpenRouter's) are never in
|
|
3046
3138
|
a run's environment or files: a run's process gets on a pipe of their own only those it needs, for its decision
|
|
3047
3139
|
providers ([decision workflows](#decision-workflows)) and its web tools: Jev's (by its route) for a node that names Jev
|
|
@@ -3151,7 +3243,7 @@ carries no cost at all, as from a provider that does not price the model. The te
|
|
|
3151
3243
|
## Test
|
|
3152
3244
|
|
|
3153
3245
|
```sh
|
|
3154
|
-
npm run build
|
|
3246
|
+
npm run build
|
|
3155
3247
|
npm test -w @parcha/agentrun-serve
|
|
3156
3248
|
```
|
|
3157
3249
|
|