@parcha/agentrun-serve 0.1.0-beta.43 → 0.1.0-beta.45
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 +231 -0
- package/README.md +580 -320
- package/dist/acp-package.d.ts +28 -0
- package/dist/acp-package.js +23 -0
- package/dist/adapter-facts.d.ts +8 -1
- package/dist/adapter-facts.js +9 -1
- package/dist/adapters.d.ts +5 -0
- package/dist/adapters.js +36 -3
- package/dist/agent-delete.d.ts +50 -0
- package/dist/agent-delete.js +125 -0
- package/dist/agents-store.d.ts +9 -3
- package/dist/agents-store.js +22 -8
- package/dist/agents.d.ts +5 -1
- package/dist/agents.js +8 -4
- package/dist/api-only.d.ts +8 -3
- package/dist/api-only.js +10 -4
- package/dist/archil-routes.d.ts +5 -1
- package/dist/archil-routes.js +57 -2
- package/dist/browser-wait-ended.d.ts +2 -0
- package/dist/browser-wait-ended.js +2 -0
- package/dist/calendar/ics-faux.d.ts +3 -1
- package/dist/calendar/ics-faux.js +12 -2
- package/dist/calendar/tools.js +5 -2
- package/dist/chatgpt-plan.js +3 -1
- package/dist/claude-login.d.ts +135 -0
- package/dist/claude-login.js +244 -0
- package/dist/cli.js +92 -22
- package/dist/composio-preset.d.ts +4 -3
- package/dist/composio-preset.js +81 -11
- package/dist/composio-triggers.d.ts +34 -2
- package/dist/composio-triggers.js +261 -31
- package/dist/computer-attach.d.ts +40 -5
- package/dist/computer-attach.js +130 -15
- package/dist/computer-keys.d.ts +3 -0
- package/dist/computer-keys.js +7 -1
- package/dist/computer-live.js +3 -2
- package/dist/computer-lost.d.ts +11 -0
- package/dist/computer-lost.js +19 -0
- package/dist/computer-record.d.ts +10 -2
- package/dist/computer-record.js +50 -18
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +2 -2
- package/dist/computers.d.ts +21 -10
- package/dist/computers.js +39 -28
- package/dist/console/assets/index-3O2Yl6hZ.js +701 -0
- package/dist/console/assets/index-DaFsZuzQ.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.d.ts +1 -1
- package/dist/dial-relay.d.ts +29 -0
- package/dist/dial-relay.js +94 -0
- package/dist/email/tools.js +10 -5
- package/dist/env-proxy.d.ts +2 -0
- package/dist/env-proxy.js +35 -0
- package/dist/errors.d.ts +4 -1
- package/dist/errors.js +10 -4
- package/dist/faux-computers.d.ts +8 -2
- package/dist/faux-computers.js +83 -6
- package/dist/harness-archive.d.ts +67 -0
- package/dist/harness-archive.js +177 -0
- package/dist/harness-goose.d.ts +34 -0
- package/dist/harness-goose.js +87 -0
- package/dist/harness-install.d.ts +21 -0
- package/dist/harness-install.js +24 -11
- package/dist/harness-opencode/adapter.js +1 -1
- package/dist/harness-table.d.ts +59 -3
- package/dist/harness-table.js +119 -14
- package/dist/harness.d.ts +17 -1
- package/dist/harness.js +22 -11
- package/dist/host.d.ts +12 -10
- package/dist/host.js +19 -16
- package/dist/import-worker.d.ts +3 -0
- package/dist/import-worker.js +7 -5
- package/dist/import.d.ts +22 -1
- package/dist/import.js +141 -28
- package/dist/key-check.js +3 -0
- package/dist/learn/audit.d.ts +6 -6
- package/dist/learn/audit.js +3 -7
- package/dist/learn/check.d.ts +26 -89
- package/dist/learn/check.js +58 -336
- package/dist/learn/commit.d.ts +63 -90
- package/dist/learn/commit.js +124 -316
- package/dist/learn/compile.d.ts +53 -50
- package/dist/learn/compile.js +88 -103
- package/dist/learn/corrections.d.ts +13 -0
- package/dist/learn/corrections.js +23 -0
- package/dist/learn/delete.d.ts +17 -0
- package/dist/learn/delete.js +42 -0
- package/dist/learn/folder.d.ts +35 -47
- package/dist/learn/folder.js +118 -134
- package/dist/learn/index.d.ts +3 -5
- package/dist/learn/index.js +6 -9
- package/dist/learn/learning.sh +45 -15
- package/dist/learn/promote.d.ts +20 -2
- package/dist/learn/promote.js +17 -4
- package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +34 -38
- package/dist/learn/{skills.js → workflow-draft.js} +65 -59
- package/dist/learn/workflow-nodes.d.ts +22 -1
- package/dist/learn/workflow-nodes.js +29 -10
- package/dist/learned-workflow.js +2 -2
- package/dist/learning-cost.d.ts +127 -13
- package/dist/learning-cost.js +142 -10
- package/dist/learning-routes.d.ts +99 -170
- package/dist/learning-routes.js +199 -420
- package/dist/learning-run.d.ts +19 -40
- package/dist/learning-run.js +23 -93
- package/dist/learning-setting.d.ts +4 -4
- package/dist/learning-setting.js +6 -6
- package/dist/learning-words.d.ts +28 -74
- package/dist/learning-words.js +64 -162
- package/dist/learning.d.ts +62 -393
- package/dist/learning.js +101 -651
- package/dist/listen-first.d.ts +30 -0
- package/dist/listen-first.js +115 -0
- package/dist/live-reach.d.ts +25 -2
- package/dist/live-reach.js +46 -4
- package/dist/llms.txt +2 -1
- package/dist/local-models.d.ts +3 -11
- package/dist/local-models.js +5 -6
- package/dist/mcp-servers-store.d.ts +16 -16
- package/dist/model-form.js +6 -5
- package/dist/model.d.ts +12 -4
- package/dist/model.js +41 -16
- package/dist/native/binding.js +1 -1
- package/dist/native/connection.js +1 -1
- package/dist/native/discovery.js +1 -1
- package/dist/native/instructions.d.ts +3 -0
- package/dist/native/instructions.js +5 -3
- package/dist/native/remote-worker-bridge.js +9 -43
- package/dist/native/remote.d.ts +8 -15
- package/dist/native/remote.js +3 -3
- package/dist/native/schema.js +1 -1
- package/dist/native/types.d.ts +2 -2
- package/dist/openapi.js +375 -347
- package/dist/owner.d.ts +8 -0
- package/dist/owner.js +11 -0
- package/dist/paid-calls.d.ts +14 -0
- package/dist/paid-calls.js +31 -1
- package/dist/particle-provider.d.ts +11 -0
- package/dist/particle-provider.js +135 -0
- package/dist/place.d.ts +8 -3
- package/dist/place.js +13 -9
- package/dist/port-models.d.ts +12 -4
- package/dist/port-models.js +28 -11
- package/dist/print.d.ts +27 -0
- package/dist/print.js +21 -0
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +30 -2
- package/dist/reflect-range.js +2 -3
- package/dist/run-launch.d.ts +14 -28
- package/dist/run-launch.js +9 -12
- package/dist/run-learning-served.d.ts +16 -90
- package/dist/run-listing.d.ts +34 -0
- package/dist/run-listing.js +128 -0
- package/dist/run-model-key.d.ts +64 -0
- package/dist/run-model-key.js +147 -0
- package/dist/run-timeline-served.js +5 -3
- package/dist/run-trace.d.ts +97 -0
- package/dist/run-trace.js +253 -0
- package/dist/run-view.d.ts +15 -0
- package/dist/run-view.js +9 -0
- package/dist/runnable.js +2 -1
- package/dist/runner/adapter-loop.d.ts +14 -6
- package/dist/runner/adapter-loop.js +25 -14
- package/dist/runner/adapter-run-spec.d.ts +22 -7
- package/dist/runner/adapter-run-spec.js +130 -77
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +35 -4
- package/dist/runner/adapters/pi.d.ts +4 -12
- package/dist/runner/adapters/pi.js +2 -2
- package/dist/runner/audit.d.ts +5 -1
- package/dist/runner/audit.js +31 -12
- package/dist/runner/beside.d.ts +7 -2
- package/dist/runner/beside.js +41 -9
- package/dist/runner/claim-secrets.d.ts +66 -1
- package/dist/runner/claim-secrets.js +136 -3
- package/dist/runner/cli-run-spec.d.ts +2 -1
- package/dist/runner/cli-run-spec.js +82 -59
- package/dist/runner/commands.d.ts +3 -6
- package/dist/runner/conformance/harness.d.ts +6 -0
- package/dist/runner/conformance/harness.js +16 -5
- package/dist/runner/dispatch.d.ts +2 -2
- package/dist/runner/end-of-run.d.ts +6 -14
- package/dist/runner/end-of-run.js +8 -33
- package/dist/runner/feedback-round.d.ts +5 -4
- package/dist/runner/feedback-round.js +14 -10
- package/dist/runner/github-app.js +3 -1
- package/dist/runner/harness-loops.d.ts +0 -8
- package/dist/runner/harness-loops.js +30 -56
- package/dist/runner/held.d.ts +170 -0
- package/dist/runner/held.js +57 -0
- package/dist/runner/journal-kinds.d.ts +7 -3
- package/dist/runner/journal-kinds.js +2 -3
- package/dist/runner/learned-first.d.ts +40 -0
- package/dist/runner/learned-first.js +32 -0
- package/dist/runner/learning-end.d.ts +77 -66
- package/dist/runner/learning-end.js +250 -299
- package/dist/runner/learning-seed.d.ts +15 -33
- package/dist/runner/learning-seed.js +24 -45
- package/dist/runner/loop-contract.d.ts +8 -3
- package/dist/runner/loop-contract.js +4 -0
- package/dist/runner/loop.js +6 -2
- package/dist/runner/main.d.ts +18 -9
- package/dist/runner/main.js +82 -22
- package/dist/runner/mcp-run.d.ts +11 -0
- package/dist/runner/mcp-run.js +67 -0
- package/dist/runner/memory-claim.d.ts +14 -6
- package/dist/runner/memory-claim.js +18 -9
- package/dist/runner/model-route.d.ts +7 -4
- package/dist/runner/model-route.js +22 -10
- package/dist/runner/native-loop.d.ts +0 -7
- package/dist/runner/native-loop.js +9 -101
- package/dist/runner/promotion.d.ts +13 -6
- package/dist/runner/promotion.js +63 -17
- package/dist/runner/reflect-hook.d.ts +64 -91
- package/dist/runner/reflect-hook.js +112 -206
- package/dist/runner/run-channel.d.ts +43 -0
- package/dist/runner/run-channel.js +467 -0
- package/dist/runner/run-child-host.d.ts +169 -0
- package/dist/runner/run-child-host.js +1222 -0
- package/dist/runner/run-child.d.ts +1 -0
- package/dist/runner/run-child.js +254 -0
- package/dist/runner/run-errors.d.ts +2 -0
- package/dist/runner/run-errors.js +20 -0
- package/dist/runner/runner.js +58 -9
- package/dist/runner/sdk-ask.d.ts +78 -0
- package/dist/runner/sdk-ask.js +158 -0
- package/dist/runner/sdk-loop.d.ts +2 -4
- package/dist/runner/sdk-loop.js +29 -49
- package/dist/runner/store-secrets.d.ts +5 -3
- package/dist/runner/store-secrets.js +14 -6
- package/dist/runner/workflow-first.d.ts +5 -0
- package/dist/runner/workflow-first.js +4 -0
- package/dist/runner/workflow-spec.js +17 -4
- package/dist/runs-over-store.d.ts +21 -32
- package/dist/runs-over-store.js +44 -41
- package/dist/sdk/runs.d.ts +6 -11
- package/dist/sdk/runs.js +20 -41
- package/dist/sdk/schema.js +3 -4
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/seal-key.d.ts +5 -0
- package/dist/seal-key.js +7 -0
- package/dist/secrets.d.ts +3 -0
- package/dist/secrets.js +16 -3
- package/dist/server.d.ts +119 -83
- package/dist/server.js +1121 -419
- package/dist/sign-ins-store.d.ts +8 -0
- package/dist/sign-ins-store.js +36 -1
- package/dist/skills.js +1 -1
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +3 -0
- package/dist/store/postgres/migrations/0017_run_listing.sql +83 -0
- package/dist/store/postgres/migrations/0018_trigger_template.sql +6 -0
- package/dist/store/postgres/migrations/0019_runner_relays.sql +28 -0
- package/dist/store/schema.d.ts +53 -4
- package/dist/store/schema.js +137 -6
- package/dist/store/seal.d.ts +20 -2
- package/dist/store/seal.js +24 -8
- package/dist/store/sqlite/connection.d.ts +2 -0
- package/dist/store/sqlite/connection.js +3 -1
- package/dist/store/sqlite/run-launch.d.ts +4 -1
- package/dist/store/sqlite/run-launch.js +12 -0
- package/dist/store/sqlite/run-patch.d.ts +0 -17
- package/dist/store/sqlite/run-patch.js +4 -33
- package/dist/store/sqlite/store.d.ts +3 -2
- package/dist/store/sqlite/store.js +360 -75
- package/dist/store/sqlite/worker.js +25 -0
- package/dist/store/store.d.ts +231 -39
- package/dist/store/store.js +25 -3
- package/dist/store-reads/analytics.js +11 -1
- package/dist/store-reads/learning.d.ts +131 -194
- package/dist/store-reads/learning.js +292 -301
- package/dist/store-reads/loop.d.ts +0 -1
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-reads/stats.js +13 -3
- package/dist/store-view.d.ts +34 -2
- package/dist/store-view.js +108 -41
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.js +153 -0
- package/dist/template-eval.d.ts +3 -6
- package/dist/template-eval.js +22 -36
- package/dist/templates.d.ts +2 -1
- package/dist/templates.js +6 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -1
- package/dist/timeline/timeline.js +16 -0
- package/dist/tool-gate.d.ts +0 -7
- package/dist/tool-gate.js +1 -15
- package/dist/tool-keys-store.d.ts +1 -1
- package/dist/tool-keys.d.ts +6 -4
- package/dist/tool-keys.js +12 -6
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +13 -13
- package/dist/tools.js +29 -9
- package/dist/trigger-adapter.d.ts +3 -0
- package/dist/trigger-adapters.d.ts +4 -0
- package/dist/trigger-adapters.js +13 -0
- package/dist/trigger-composio.d.ts +58 -1
- package/dist/trigger-composio.js +160 -6
- package/dist/triggers.d.ts +64 -5
- package/dist/triggers.js +141 -17
- package/dist/validate.d.ts +11 -7
- package/dist/validate.js +9 -8
- package/dist/webhooks.d.ts +4 -1
- package/dist/webhooks.js +11 -4
- package/dist/workspace/agent-computer.d.ts +2 -0
- package/dist/workspace/agent-computer.js +2 -0
- package/dist/workspace/archil-claim.d.ts +7 -0
- package/dist/workspace/archil-claim.js +29 -0
- package/dist/workspace/archil.d.ts +9 -1
- package/dist/workspace/archil.js +165 -3
- package/dist/workspace/attach.d.ts +3 -1
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/attached-computers.d.ts +16 -5
- package/dist/workspace/attached-computers.js +25 -9
- package/dist/workspace/computer-deps.js +1 -1
- package/dist/workspace/computer-for-claim.d.ts +22 -8
- package/dist/workspace/computer-for-claim.js +339 -46
- package/dist/workspace/computer-hold.js +2 -1
- package/dist/workspace/computer-kept.d.ts +11 -1
- package/dist/workspace/computer-kept.js +24 -3
- package/dist/workspace/resolve-computer.d.ts +41 -21
- package/dist/workspace/resolve-computer.js +172 -64
- package/dist/workspace/revision-skills.d.ts +1 -2
- package/dist/workspace/revision-skills.js +3 -4
- package/dist/workspace/run-workspace.d.ts +1 -1
- package/dist/workspace/run-workspace.js +5 -0
- package/dist/workspace/synced-folder.d.ts +85 -0
- package/dist/workspace/synced-folder.js +230 -0
- package/dist/workspace/workspace.d.ts +4 -0
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -9
- package/templates/README.md +7 -7
- package/templates/inbound-lead/agent.md +3 -3
- package/templates/inbound-lead/evals/learned-correction/case.yaml +3 -3
- package/templates/inbound-lead/evals/learned-correction/fixtures/corrections.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-correction.md +22 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +1 -1
- package/templates/inbound-lead/evals/learned-correction/prompt.md +1 -1
- package/templates/inbound-lead/lead.schema.json +6 -5
- package/templates/inbound-lead/rules/RUBRIC.md +4 -4
- package/templates/inbound-lead/skills/lead/SKILL.md +4 -4
- package/templates/market-monitor/evals/learned-preference/case.yaml +4 -4
- package/templates/market-monitor/evals/learned-preference/fixtures/corrections.md +1 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +3 -3
- package/templates/market-monitor/evals/learned-preference/prompt.md +1 -1
- package/templates/release-notes/evals/learned-style/case.yaml +4 -4
- package/templates/release-notes/evals/learned-style/fixtures/corrections.md +1 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +2 -2
- package/templates/release-notes/evals/learned-style/prompt.md +1 -1
- package/dist/console/assets/index-BrcDSBD8.css +0 -1
- package/dist/console/assets/index-Bz6IWncl.js +0 -711
- package/dist/learn/grade.d.ts +0 -138
- package/dist/learn/grade.js +0 -682
- package/dist/learn/notes.d.ts +0 -81
- package/dist/learn/notes.js +0 -178
- package/dist/learn/reflect.d.ts +0 -77
- package/dist/learn/reflect.js +0 -228
- package/dist/learn/relevance.d.ts +0 -24
- package/dist/learn/relevance.js +0 -91
- package/dist/learn/seed-check.d.ts +0 -74
- package/dist/learn/seed-check.js +0 -103
- package/dist/learning-batch.d.ts +0 -291
- package/dist/learning-batch.js +0 -600
- package/dist/learning-evals.d.ts +0 -33
- package/dist/learning-evals.js +0 -98
- package/dist/native/context.d.ts +0 -6
- package/dist/native/context.js +0 -22
- package/dist/propose.d.ts +0 -52
- package/dist/propose.js +0 -224
- package/dist/runner/learning-ask.d.ts +0 -47
- package/dist/runner/learning-ask.js +0 -128
- package/dist/runner/learning-dispatch.d.ts +0 -45
- package/dist/runner/learning-dispatch.js +0 -99
- package/dist/runner/learning-factory.d.ts +0 -16
- package/dist/runner/learning-factory.js +0 -50
- package/dist/runner/learning-loop.d.ts +0 -273
- package/dist/runner/learning-loop.js +0 -521
- package/dist/usage.d.ts +0 -11
- package/dist/usage.js +0 -11
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +0 -1
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +0 -14
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +0 -21
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +0 -1
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +0 -8
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +0 -1
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +0 -13
package/README.md
CHANGED
|
@@ -10,7 +10,8 @@ runner starts beside the server. The capabilities document (`GET /v2/capabilitie
|
|
|
10
10
|
Already use Claude Code or Codex? Choose **Connect agent** in the console and select your coding agent from the
|
|
11
11
|
dropdown. Its skill asks whether to connect for future jobs, import past history, or both, then confirms the source
|
|
12
12
|
project and machine. No destination model key is needed for this connection: a live agent uses its existing native
|
|
13
|
-
sign-in and configuration. Turn **Self-improving** On separately to
|
|
13
|
+
sign-in and configuration. Turn **Self-improving** On separately to give later runs your corrections and the
|
|
14
|
+
workflows its runs compile;
|
|
14
15
|
imported history stays historical and does not automatically train the agent.
|
|
15
16
|
|
|
16
17
|
For a source on a different laptop, VM or container, choose **Connection setup → Another machine** and use the
|
|
@@ -37,6 +38,7 @@ Installed, `agentrun-serve` is a launcher that needs a POSIX `sh` with a builtin
|
|
|
37
38
|
It prints where it listens and, at the start that made it, the token:
|
|
38
39
|
|
|
39
40
|
```
|
|
41
|
+
Starting http://127.0.0.1:7340/ (warming: health says so and the API answers 503 until the server is ready)
|
|
40
42
|
agentrun-serve on http://127.0.0.1:7340/v2 (agent store in ~/.local/share/agentrun/agents)
|
|
41
43
|
AGENTRUN_BASE_URL=http://127.0.0.1:7340/v2
|
|
42
44
|
AGENTRUN_API_KEY=ar_local_...
|
|
@@ -45,6 +47,13 @@ Boxes: docker (on by default; set AGENTRUN_BOXES to change).
|
|
|
45
47
|
Set your password: http://127.0.0.1:7340/setup (the first visit sets it)
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
The `Starting` line comes as soon as the port is bound, before the server loads the rest of itself; the lines after it
|
|
51
|
+
come once it is ready, and `Open ` still means ready. In between, `GET /v2/health` answers `503` with `status: "warming"`,
|
|
52
|
+
the API answers `503 unavailable` (retryable, with a `Retry-After`), and a browser gets a page that reloads itself. On a
|
|
53
|
+
cold, slow disk, loading the server's modules holds the process for most of that time: a request sent then is answered
|
|
54
|
+
once they have loaded. A port already taken at the start is left to the start's own listen, which waits for a server it
|
|
55
|
+
replaces, as it always has, and prints no `Starting` line.
|
|
56
|
+
|
|
48
57
|
A Docker box's image is built on its first run, which shows that on its timeline. `npx @parcha/agentrun` prints the
|
|
49
58
|
`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
|
|
50
59
|
runner. Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart
|
|
@@ -80,7 +89,6 @@ An edit is a new revision: `PUT $AGENTRUN_BASE_URL/agents/calc/definition` with
|
|
|
80
89
|
| `--documents DIR` | `AGENTRUN_SERVE_DOCUMENTS` | A read-only directory of documents a workflow's `pdf_pages` calls read by file name, confined to it. |
|
|
81
90
|
| `--allow-code-nodes` | off (`AGENTRUN_SERVE_CODE_NODES=1` turns it on) | Run workflows' `code` nodes. They run in the run's process through the DSL's `new Function` transform, which is no sandbox, so only turn it on for workflows you wrote. Off, a workflow with a code node saves with a `not_set_up_here` warning and its runs are `409 agent_not_runnable` with `details.code: true`. A call `via: "shell"` or `"executor"` is refused either way. |
|
|
82
91
|
| `--learning on\|off` | on (`AGENTRUN_SERVE_LEARNING`) | Whether runs [learn](#learning). On, a run of an agent whose definition says `learning: true` starts from what that agent learned and adds to it; off, no run does, whatever its agent says. Any other value refuses the start. Capabilities report it as `features.learning`. |
|
|
83
|
-
| `--learning-budget BYTES` | `8000` (`AGENTRUN_SERVE_LEARNING_BUDGET`) | How much of what an agent learned its runs' instructions hold under `# Learned`, in UTF-8 bytes: every note whole while they fit, else the notes that bear most on the run whole while they fit, then one line each for more of them; the rest are left out, and the run's log names them ([learning](#learning)). `0` gives no notes. A value that is not a whole number of bytes refuses the start. |
|
|
84
92
|
| `--drain-timeout D` | `30s` (the image: `6s`) | How long the runner beside the server lets each busy run finish its turn when the server stops (`8s`, `500ms`, `1m`): a turn that ends within it keeps its outcome, and its model request is never sent again. A run still busy at the bound is stopped where it can resume, and the next claim carries on from its journal (that turn's model request sent again). The stop says how long it waits and for how many runs. A runner of its own (`agentrun-serve runner`) takes `--drain-timeout` too, default `AGENTRUN_DRAIN_TIMEOUT`, else `6s`. |
|
|
85
93
|
|
|
86
94
|
`AGENTRUN_TOKEN`, when set, is the token (32 characters or more), and the server prints `$AGENTRUN_TOKEN` in its
|
|
@@ -111,10 +119,10 @@ export AGENT_MODEL=openrouter/anthropic/claude-sonnet-5.5 OPENROUTER_API_KEY=...
|
|
|
111
119
|
node packages/serve/dist/cli.js
|
|
112
120
|
```
|
|
113
121
|
|
|
114
|
-
Its log says `event=boxes available=docker`, and its banner's last line `Boxes: docker (on by default; set
|
|
122
|
+
Its log says `event=boxes available=docker`, and its banner's last line reads `Boxes: docker (on by default; set
|
|
115
123
|
AGENTRUN_BOXES to change). docker boxes reach only pypi.org, files.pythonhosted.org, registry.npmjs.org, registry.yarnpkg.com,
|
|
116
|
-
github.com, and codeload.github.com.`
|
|
117
|
-
network
|
|
124
|
+
github.com, and codeload.github.com.` on Linux; elsewhere it says why the box has no
|
|
125
|
+
network ([Sandbox](#sandbox)). The first sandbox run builds [the box's image](#the-boxs-image) (python 3.12, git, curl, node, npm and rg,
|
|
118
126
|
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
|
|
119
127
|
it built. In a second shell, export the two `AGENTRUN_` lines it printed (a later start prints
|
|
120
128
|
where the key is: `export AGENTRUN_API_KEY=$(cat ~/.local/share/agentrun/agents/.token)`). Then make a sandbox agent,
|
|
@@ -167,6 +175,15 @@ package and pins; [harnesses](#harnesses)), the bulk of its start; quiet keeps i
|
|
|
167
175
|
PUT of `/settings/tools` and a save or delete of a tool key change no harness's offer, so they remake capabilities at
|
|
168
176
|
once without checking again (a key some harness reads would, with `why=key`).
|
|
169
177
|
|
|
178
|
+
## Anonymous usage counts
|
|
179
|
+
|
|
180
|
+
The server can send three anonymous events: `server_started`, a daily `heartbeat` and `first_run_completed`. Each holds
|
|
181
|
+
a random id kept in the data directory (`.telemetry.json`), the version, the platform and how many runs ended as a
|
|
182
|
+
range; never a prompt, a file, a key or a name. This release sends nothing: the receiver's key is not set.
|
|
183
|
+
`AGENTRUN_TELEMETRY=0` or `DO_NOT_TRACK=1` turns it off, as do `CI` and `--faux`; `AGENTRUN_TELEMETRY=debug` prints each
|
|
184
|
+
event on stderr and sends none. The start that first could send prints one notice and sends nothing at that start.
|
|
185
|
+
[docs/telemetry.md](../../docs/telemetry.md) lists every field.
|
|
186
|
+
|
|
170
187
|
## In a container
|
|
171
188
|
|
|
172
189
|
The image is public: `ghcr.io/parcha-ai/agentrun-server` (`:beta`, or an exact version such as `:v0.1.0-beta.27`).
|
|
@@ -214,8 +231,29 @@ From a checkout, the same command in its root, with `--build` to build the image
|
|
|
214
231
|
(trixie), with git 2.47 for an agent's learning folder and the Docker client. Everything it keeps is under `/data`: the agent store,
|
|
215
232
|
the runs and the token.
|
|
216
233
|
|
|
217
|
-
The
|
|
218
|
-
|
|
234
|
+
The image's default command, `server-and-runner --data /data --listen 0.0.0.0 --port 7340 --drain-timeout 6s`, starts
|
|
235
|
+
two processes in the container: the server with `--no-runner`, and one runner on the same `/data` once the server answers
|
|
236
|
+
`GET /v2/health`. Each has its own store connection, so a busy runner never holds up the API. If either exits, the other
|
|
237
|
+
stops and the container exits non-zero. Give the image other arguments and it runs that one command, as given:
|
|
238
|
+
`runner --data /data --name runner-1` is a runner, and server options alone (no `server-and-runner`) are a server with
|
|
239
|
+
its runner in its own process, which a [paired computer](#a-persons-own-computer) needs.
|
|
240
|
+
|
|
241
|
+
A computer provider whose machines dial the server (Fly Machines and Cloudflare; the computer package's `connectOf`,
|
|
242
|
+
which also says dial for E2B, Daytona or Modal made with `connect: "dial"`) works under a runner apart that knows the
|
|
243
|
+
server's public address, `AGENTRUN_PUBLIC_URL` (the image gives both processes the same environment). The machine dials
|
|
244
|
+
the server, and the server relays its socket to the runner that made it: the runner keeps its own attach hub on a
|
|
245
|
+
private listener (loopback; across hosts, its `AGENTRUN_RUNNER_LIVE_HOST`, which the server's `AGENTRUN_RUNNER_HOSTS`
|
|
246
|
+
must list), and the server reaches it only with a proof under the seal key for that machine's token, that runner and a
|
|
247
|
+
time within 10 seconds, taken once. A dial it cannot relay (its runner gone, not answering, or restarted since) is
|
|
248
|
+
answered 503 in words that name the run, `a dial for run <run> (machine <machine>)`, and never the machine's token. The
|
|
249
|
+
runner's create, waiting for that machine, ends at once in the same words and deletes it; the run makes a new machine at
|
|
250
|
+
its next claim. A runner apart with no public address refuses such a create, naming the fix above,
|
|
251
|
+
and the server says it sooner: in `GET /v2/computers`, each dial provider's row carries `runs_refused` with that fix,
|
|
252
|
+
and its Test connection in Settings → Computers fails in the same words. With a runner that relays, `runs_refused` is
|
|
253
|
+
null.
|
|
254
|
+
|
|
255
|
+
The token is in the log of the start that made it. A `docker stop` reaches both processes. The runner gives a busy run
|
|
256
|
+
6 s (`--drain-timeout 6s`) to finish its turn, so a busy `docker stop` ends in about 7.5 s, inside Docker's default 10 s
|
|
219
257
|
grace, and Compose's `stop_grace_period` is 15 s; a turn cut off resumes at the next start. Compose publishes the port
|
|
220
258
|
on this machine's loopback only (port 7340, or `AGENTRUN_PORT`; set `AGENTRUN_PUBLIC_URL` with it, so the printed link names that port), and
|
|
221
259
|
the volume `agentrun-data` keeps `/data` across `down` and `up`. In the container the server listens on `0.0.0.0`, so
|
|
@@ -253,8 +291,8 @@ has ended. A command not yet sent when the call is stopped is never sent.
|
|
|
253
291
|
|
|
254
292
|
## Upgrading from 0.1.0-beta.26
|
|
255
293
|
|
|
256
|
-
0.1.0-beta.27 keeps every agent in one store, `DIR/store.sqlite`, with its revisions (and this version each run
|
|
257
|
-
disk, above).
|
|
294
|
+
0.1.0-beta.27 keeps every agent in one store, `DIR/store.sqlite`, with its revisions (and this version also keeps each run
|
|
295
|
+
on the disk, above).
|
|
258
296
|
0.1.0-beta.26 and earlier kept one agent home per agent, `DIR/<agent>/agent.sqlite`, and this version does not read
|
|
259
297
|
those. So it refuses to start on a data directory that holds one, and names each home it found, instead of serving
|
|
260
298
|
it as if it had no agents.
|
|
@@ -301,7 +339,8 @@ A data directory serves one AgentRun Server at a time: a second server on the sa
|
|
|
301
339
|
`GET /v2/health`, with no credential like capabilities, answers `200 {status: "ok", checks: {store: "ok", disk: "ok"}}`
|
|
302
340
|
when the agent store opens for a read and the data directory's disk has at least 64 MiB free (`AGENTRUN_MIN_FREE_MB`),
|
|
303
341
|
and `503` with `status: "failing"` and which check failed (`store: "does_not_open"`, `disk: "below_floor"`, or
|
|
304
|
-
`disk: "cannot_check"` when the free space cannot be read) otherwise.
|
|
342
|
+
`disk: "cannot_check"` when the free space cannot be read) otherwise. While the server is still starting it answers `503`
|
|
343
|
+
with `status: "warming"` and `store: "opening"`.
|
|
305
344
|
It names no path, size or version. One route serves as both liveness and readiness: any answer says the server is up,
|
|
306
345
|
and a 200 says it can work, and the platforms here take one path.
|
|
307
346
|
|
|
@@ -340,26 +379,28 @@ while the agent's loop, its log and every key stay on the server, whatever its h
|
|
|
340
379
|
remove, or the place it most likely meant, to copy (`"place": {"mode": "sandbox", "box": "docker"}`). One that names a
|
|
341
380
|
place keeps it, `runner` included. An edit that names no place keeps the agent's.
|
|
342
381
|
|
|
343
|
-
The box is a new agent's default machine. A new agentic agent whose definition names no place
|
|
344
|
-
(`{"mode": "sandbox", "box": "docker"}`) wherever this server has docker
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
382
|
+
The box is a new agent's default machine for a shell. A new agentic agent whose definition names no place and no `tools`
|
|
383
|
+
is saved in the Docker box (`{"mode": "sandbox", "box": "docker"}`) wherever this server has docker, with `["bash",
|
|
384
|
+
"bash_background", "bash_output", "bash_input", "bash_signal", "bash_list"]`, so the agent has a shell and can run a
|
|
385
|
+
command in the background ([background processes](#background-processes)). The place is written on the agent's first
|
|
386
|
+
revision, so its answers show it. A definition that names its tools keeps exactly those, an empty list included, and
|
|
387
|
+
gets the box only when one of them runs only there (`bash` or a background tool). One whose tools need no shell (`[]`,
|
|
388
|
+
or `read`, `write`, `web_fetch` and the like) is saved with no place and runs on the runner, so its first run starts at
|
|
389
|
+
once instead of waiting on a container. Where docker is unavailable, a new agent is saved with no place. So is one whose
|
|
390
|
+
tools name one the box refuses (`browser`, runner-only for now). A workflow is never given a box.
|
|
391
|
+
|
|
392
|
+
`capabilities.places.default_place` is the place a new agent with a shell gets here, and where a revision that names no
|
|
393
|
+
place and has a shell tool runs. It is worked out again at each run, the same way as at create: an agentic revision with
|
|
394
|
+
no place and a shell tool runs in the Docker box wherever this server has docker now, and on the runner where it does
|
|
395
|
+
not. A workflow, a revision whose tools need no shell, and one whose tools name one the box refuses run on the runner. A save checks a revision with no place against where it would run, so `bash`
|
|
355
396
|
with no place saves where docker is there and is `422` where it is not. When that is the runner,
|
|
356
397
|
`default_reason` says why in docker's own words, such as `new agents run on the runner, because the docker box is
|
|
357
398
|
unavailable here: Docker isn't running on this machine (no docker command on PATH): install or start Docker, then
|
|
358
399
|
restart AgentRun`. The console's new-agent form says docker's reason too, under its place picker. The console's new-agent form starts on `default_place`, with bash ticked when that place is a sandbox.
|
|
359
400
|
What a person picks or unticks there is what is sent.
|
|
360
401
|
|
|
361
|
-
A run runs in its revision's place, else where `default_place` says at that run (a workflow,
|
|
362
|
-
name one the box refuses, on the runner). A run request names no place: `POST /agents/{id}/runs`
|
|
402
|
+
A run runs in its revision's place, else where `default_place` says at that run (a workflow, a revision whose tools need
|
|
403
|
+
no shell, and one whose tools name one the box refuses, on the runner). A run request names no place: `POST /agents/{id}/runs`
|
|
363
404
|
with `place` is `422 input_invalid`, as with any field the body does not keep. The run keeps the place it resolved to,
|
|
364
405
|
and `GET /v2/runs/{id}` shows it as `place`. A harness's own tools in the box, when they come, will be an option of
|
|
365
406
|
`sandbox` (such as `native_tools: true`), never a third mode.
|
|
@@ -382,14 +423,13 @@ A definition naming a box this server does not have saves with a warning on `def
|
|
|
382
423
|
|
|
383
424
|
With docker on (by default, when `AGENTRUN_BOXES` is not set; or listed in it) and a Docker daemon this server's user
|
|
384
425
|
may use, a run whose place is
|
|
385
|
-
`{"mode": "sandbox", "box": "docker"}` gets one container, made
|
|
386
|
-
|
|
426
|
+
`{"mode": "sandbox", "box": "docker"}` gets one container, made when a runner takes the run, before its first model
|
|
427
|
+
request, whatever tools it calls. Those four tools are pi's own, on every harness. `bash` runs in the container. `read`, `write` and `edit`
|
|
387
428
|
run on this server, on the `work/` the container binds, because a `docker exec` costs half a second or more per call:
|
|
388
429
|
they follow no link anywhere on the way (one pointing inside `work/` included), take only a regular file with one hard
|
|
389
430
|
link, and write through a temporary file renamed over the old one, keeping its mode (a new file is `0644`). A refusal
|
|
390
431
|
says so and names the box's path; `bash`, in the container, can still reach the file. Where this server reaches
|
|
391
|
-
directories by path (no `/proc/self/fd`, as on macOS), or a box binds nothing, all four run in the container
|
|
392
|
-
the first of them.
|
|
432
|
+
directories by path (no `/proc/self/fd`, as on macOS), or a box binds nothing, all four run in the container.
|
|
393
433
|
`web_fetch`, `web_search` and monid's endpoints stay on this server, and so do
|
|
394
434
|
the run's loop, its log, its model calls and every key. What the server itself files in `work/` (monid's long answers,
|
|
395
435
|
the browser's evidence) never goes through a link a box's command planted there: each directory is held open on the
|
|
@@ -707,6 +747,16 @@ They apply to Docker computers only: a vendor's computer (Daytona, Modal, E2B, O
|
|
|
707
747
|
size its provider makes it, and is never given them. A value the Docker provider refuses stops the server's start, in
|
|
708
748
|
the provider's words.
|
|
709
749
|
|
|
750
|
+
**A lost sandbox.** A run's sandbox can be lost mid-run: its vendor deleted it (from its own console or API), or no
|
|
751
|
+
longer has it. The tool call that finds it lost fails in the provider's words. The run's next tool call starts a new
|
|
752
|
+
sandbox under the same claim and runs there, also when the lost one was kept through a park. A start that fails is
|
|
753
|
+
tried again at the next tool call, under the same request, and does not count. In Mode 2 the new sandbox mounts the run's folder again with a new mount
|
|
754
|
+
credential, and the lost one's credential is removed. The run's folder is kept; what was on the lost sandbox outside it
|
|
755
|
+
(its processes, `/tmp`) is gone. The timeline says `Its computer was lost; started a new one (<name>).` A claim starts
|
|
756
|
+
at most 2 new sandboxes. The loss after that fails the run at once, whichever call finds it with error code `computer_unavailable`, in the provider's
|
|
757
|
+
words. A provider error that does not show the sandbox gone (a 5xx, a timeout, its read of the machine failing) starts
|
|
758
|
+
nothing. A desktop, a phone, a paired computer and an agent's own computer are never started again this way.
|
|
759
|
+
|
|
710
760
|
**A phone's apps.** A phone has its stock apps. To give every phone more, the operator names APK files on the machine
|
|
711
761
|
that drives the phones (the server's, or its runner's) in that machine's environment, each pinned by its sha256:
|
|
712
762
|
`PHONE_HARNESS_APKS=/srv/apks/wikipedia.apk@sha256:<64 hex digits>`, a comma list. Only the operator sets it: no agent
|
|
@@ -749,7 +799,9 @@ one computer that it keeps between runs, instead of a fresh one for each run:
|
|
|
749
799
|
account never take each other's. The janitor deletes an agent's computer only once its agent no longer wants it.
|
|
750
800
|
|
|
751
801
|
**A video of each run.** `computer: {"kind": "desktop", "provider": "e2b", "record": true}` records the computer's
|
|
752
|
-
screen during each of the agent's runs. Off by default; a desktop or a
|
|
802
|
+
screen during each of the agent's runs. Off by default; a desktop, a phone or a browser (a sandbox is 422). A browser's is
|
|
803
|
+
each session's page, one file per session (its computer), from the live view's own screencast of it, which the viewer
|
|
804
|
+
shares: frames come as the page changes.
|
|
753
805
|
|
|
754
806
|
- **It shows everything on the screen.** That includes what a person types while they have taken over the computer, and
|
|
755
807
|
any password, key or private page shown on it. Pixels can't be redacted. Turn it on only for an agent whose screen
|
|
@@ -805,7 +857,10 @@ passes the binding's conformance cases (below) needs no change here.
|
|
|
805
857
|
- **One process.** A computer's connection lands on one server process, and only a run in that process can use it:
|
|
806
858
|
run `agentrun-serve start` with its runner beside the server (the default). A runner started apart
|
|
807
859
|
(`agentrun-serve runner`, beside a server started with `--no-runner`) refuses a paired computer at the claim, saying
|
|
808
|
-
so.
|
|
860
|
+
so. Such a server says it sooner: its pairing code, the pair answer and each paired computer carry `runs_refused`,
|
|
861
|
+
which the console shows with the code and on the computer's row. The image's default command starts its runner apart; give the image the server's options alone
|
|
862
|
+
(`--data /data --listen 0.0.0.0 --port 7340 --drain-timeout 6s`) to keep the runner in the server's process. A
|
|
863
|
+
second server on one store is already refused by the store's owner lock, on SQLite and Postgres alike.
|
|
809
864
|
- **Conformance.** `node dist/attach-conformance-cli.js [--port 7392] [--listen 127.0.0.1]` runs the binding's cases
|
|
810
865
|
against whatever driver pairs with the code it prints: pair, a wrong or used code, ping, a quiet minute, a redial
|
|
811
866
|
after each close it must redial after (4408, 1000, 1001, 4409) and after a drop, a binary frame (1003), a frame over
|
|
@@ -974,9 +1029,9 @@ connection is tested, and no run's process gets them, in its environment or on i
|
|
|
974
1029
|
An agentic revision names its model as `provider/model-id` (`"model"` in its definition), or names none and runs on
|
|
975
1030
|
this host's default, `AGENT_MODEL`. With no `AGENT_MODEL`, a model provider's key, the server's own or saved as a
|
|
976
1031
|
[tool key](#tool-keys), gives the default, the first of: `anthropic/claude-sonnet-5-5` with `ANTHROPIC_API_KEY`,
|
|
977
|
-
`openai/gpt-6.1-sol` with `OPENAI_API_KEY`, `
|
|
978
|
-
|
|
979
|
-
|
|
1032
|
+
`openai/gpt-6.1-sol` with `OPENAI_API_KEY`, `particle/particle-1` with `PARTICLE_API_KEY`, then
|
|
1033
|
+
`openrouter/openai/gpt-6.1-sol` with `OPENROUTER_API_KEY`. Set `AGENT_MODEL` for another. Direct Particle runs on Pi;
|
|
1034
|
+
claude-agent takes the Anthropic one and codex the OpenAI one. A workflow revision names no model: each model node names a tier (`fast`, `default`
|
|
980
1035
|
or `strong`), and the host maps it, `fast` to `AGENT_MODEL_FAST` and `strong` to `AGENT_MODEL_STRONG`, each falling back
|
|
981
1036
|
to `AGENT_MODEL`. Capabilities show the mapping in `models` (`{source, route_prefix, fast, default, strong}`):
|
|
982
1037
|
`source` is `gateway`, `providers`, `chatgpt` or `faux` (the published document marks `gateway` and `providers` as
|
|
@@ -1043,13 +1098,139 @@ A run is refused before it starts, `409 agent_not_runnable`, saying which, for a
|
|
|
1043
1098
|
fixed yet, or a revision saved before these checks. A run needs only the tiers it uses: an agentic one its model or the default, a workflow the tiers its nodes name, so a
|
|
1044
1099
|
workflow of fast nodes runs with `AGENT_MODEL_FAST` and no `AGENT_MODEL`. A run thinks at its `effort` (`low`, `medium`,
|
|
1045
1100
|
`high`), else at its agentic revision's `thinking` (`low` to `max`), else at the host's `AGENT_THINKING` (one of those
|
|
1046
|
-
levels exactly), else at its harness's own default; it is never off
|
|
1101
|
+
levels exactly), else at its harness's own default; it is never off (pi never asks a model the catalog does not list,
|
|
1102
|
+
such as a local one, to stop reasoning: it thinks at its lowest level, its reasoning kept out of the answer), and a model node that names its own thinking level
|
|
1047
1103
|
keeps it. The level is fixed in the run's launch when it starts, and its metrics name the level its harness ran at: one
|
|
1048
1104
|
above the harness's highest runs at that highest (Codex and OpenCode stop at `xhigh`). An agentic run whose level is
|
|
1049
1105
|
`low`, `medium` or `high` also gets a short note on how to work, right after its instructions, on every harness
|
|
1050
1106
|
(`src/effort-guidance.ts`): `low` answers directly, `medium` plans briefly and checks once, `high` plans each part, fills
|
|
1051
1107
|
the gaps and reviews. A run with no level, or one above `high`, gets no note.
|
|
1052
1108
|
|
|
1109
|
+
### Per-run model keys (LiteLLM virtual keys)
|
|
1110
|
+
|
|
1111
|
+
A caller can hand each run its own model key, such as a [LiteLLM](https://docs.litellm.ai/docs/proxy/virtual_keys)
|
|
1112
|
+
virtual key minted for that run, with `model_key` on `POST /v2/runs`, `POST /v2/agents/{agent_id}/runs` and
|
|
1113
|
+
`POST /v2/runs/{run_id}/messages`. AgentRun uses that key for every model request tied to the run and never mints,
|
|
1114
|
+
lists or revokes it: the caller owns the key's life.
|
|
1115
|
+
|
|
1116
|
+
**Run without a server key: callers pass a per-run key.** There is no setting. Point `AGENT_MODEL_BASE_URL` at the
|
|
1117
|
+
gateway and give the server no model key of its own (no `AGENT_MODEL_API_KEY`, nothing saved in Settings → Model keys).
|
|
1118
|
+
The server and its runners start, and capabilities read ready, with no standing key. Then:
|
|
1119
|
+
|
|
1120
|
+
- A run with `model_key` spends on that key alone.
|
|
1121
|
+
- A run without one, whose model goes to the gateway, is 422 `model_key_required` at its start, before any model call.
|
|
1122
|
+
- A message that would start a new turn (the run's last turn ended) without `model_key` is also 422
|
|
1123
|
+
`model_key_required`, and nothing is written.
|
|
1124
|
+
|
|
1125
|
+
A server that does hold a key spends it on a run that brings none, as before, and never on a run that brings its own.
|
|
1126
|
+
|
|
1127
|
+
Where the key goes: to the gateway at `AGENT_MODEL_BASE_URL` only, which every pi and codex model and every workflow
|
|
1128
|
+
model node is sent to, and to Anthropic's Messages endpoint when `ANTHROPIC_BASE_URL` names the same origin (claude-agent
|
|
1129
|
+
on the gateway). A key sent with a run whose model goes elsewhere (no gateway, a native run, a model routed to a
|
|
1130
|
+
provider's own API) is 422 at `model_key`, never kept unused.
|
|
1131
|
+
|
|
1132
|
+
```sh
|
|
1133
|
+
# Mint a virtual key for this run (LiteLLM's proxy, with its master key; your backend does this, never the agent).
|
|
1134
|
+
KEY=$(curl -s https://litellm.example.com/key/generate \
|
|
1135
|
+
-H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json' \
|
|
1136
|
+
-d '{"duration": "1h", "max_budget": 2, "metadata": {"run": "ticket-4521"}}' | jq -r .key)
|
|
1137
|
+
|
|
1138
|
+
# Hand it to the run.
|
|
1139
|
+
curl -s http://127.0.0.1:7340/v2/agents/support/runs -H "Authorization: Bearer $AGENTRUN_TOKEN" \
|
|
1140
|
+
-H 'content-type: application/json' \
|
|
1141
|
+
-d "{\"input\": {\"content\": \"Triage ticket 4521\"}, \"model_key\": \"$KEY\"}"
|
|
1142
|
+
|
|
1143
|
+
# A follow-up turn gets a key of its own.
|
|
1144
|
+
curl -s http://127.0.0.1:7340/v2/runs/$RUN_ID/messages -H "Authorization: Bearer $AGENTRUN_TOKEN" \
|
|
1145
|
+
-H 'content-type: application/json' -d "{\"content\": \"And the refund?\", \"model_key\": \"$NEXT_KEY\"}"
|
|
1146
|
+
|
|
1147
|
+
# When the run's turn has ended (run.ended), revoke it.
|
|
1148
|
+
curl -s https://litellm.example.com/key/delete -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
|
|
1149
|
+
-H 'content-type: application/json' -d "{\"keys\": [\"$KEY\"]}"
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
Custody, as for a per_run MCP server's `mcp_auth`:
|
|
1153
|
+
|
|
1154
|
+
- The key is taken out of the body before anything reads it. It is never in the run's saved body, its timeline, its
|
|
1155
|
+
view, a log or an `Idempotency-Key`'s fingerprint. A retry with a new key answers the first request's run and keeps
|
|
1156
|
+
its first key.
|
|
1157
|
+
- It is sealed with the run under the server's seal key, bound to the gateway's origin then. A runner opens it at each
|
|
1158
|
+
claim, a reclaim after a runner's crash included. A gateway moved since never receives it.
|
|
1159
|
+
- Each model route reads it per request through the kernel model proxy. The harness, its tools and its sandbox never
|
|
1160
|
+
see it, and the run's redactor cuts it from anything the run writes.
|
|
1161
|
+
- A message's `model_key` replaces the run's key from the next model request on: the runner reads it again when it
|
|
1162
|
+
takes the message, before the message reaches the session. That holds while the turn is still going, and for a run
|
|
1163
|
+
that started on the server's key and gets its first key from a message. If that read fails, it is tried again; if it
|
|
1164
|
+
keeps failing, the message waits untaken and is delivered again, never run on the key held before it or the
|
|
1165
|
+
server's. A stop or cancel sent after it still reaches the run. A message without one keeps the key the run holds.
|
|
1166
|
+
|
|
1167
|
+
**The revoke-at-turn-end contract.** The write that ends a run's turn erases its key, and the run reports the turn
|
|
1168
|
+
ended (`run.ended`, the run's `completed`, `failed` or `stopped` status) only after that write. Every model request
|
|
1169
|
+
tied to the turn finishes before then: the job, its subagents, its learned workflows' nodes, its end-of-run compile
|
|
1170
|
+
turn. So a caller may revoke the key as soon as it sees the turn end, and no request of that run will
|
|
1171
|
+
answer 401 for it. Model spend that would run after the turn ends is never sent on the run's key or the server's:
|
|
1172
|
+
|
|
1173
|
+
| Spend | With the run's key | Server holds no key, run brought none |
|
|
1174
|
+
| --- | --- | --- |
|
|
1175
|
+
| A shadow audit, a learned workflow's replay check | Skipped, logged | Skipped, logged |
|
|
1176
|
+
| A grade's feedback round (`PUT /runs/{id}/grade`) | A new turn with no key: the server's, else not opened | Not opened; the grade is kept |
|
|
1177
|
+
| An owner's replay, an SDK run's compile turn | Tied to no run's key | 409 or skipped, in words |
|
|
1178
|
+
| A trigger's firing | Starts a run with no key | 422 `model_key_required` for the firing |
|
|
1179
|
+
|
|
1180
|
+
Jev and the other decision providers run on their own keys (`TYPESAFE_API_KEY`, `PARALLEL_API_KEY`,
|
|
1181
|
+
`OPENROUTER_API_KEY`), which are not model keys and which a run's key does not replace. On a run that brings its own
|
|
1182
|
+
key, no model key is on the env its decision nodes run under, so Jev's route on an openrouter.ai gateway's key is off.
|
|
1183
|
+
|
|
1184
|
+
### Direct Particle-1
|
|
1185
|
+
|
|
1186
|
+
Save a Particle key in **Settings → Model keys → Particle**, then select `particle/particle-1` with the **Pi** harness.
|
|
1187
|
+
Alternatively supply `PARTICLE_API_KEY` where AgentRun starts and set `AGENT_MODEL=particle/particle-1` (or a workflow's
|
|
1188
|
+
`AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`). Get an inference-enabled key from [Particle's platform](https://platform.particle.ai/).
|
|
1189
|
+
The key uses the existing sealed storage and provider-scoped handover; it is not placed in run environments. Saving
|
|
1190
|
+
it checks `GET /v1/models`, which performs no generation. No OpenRouter key is required.
|
|
1191
|
+
|
|
1192
|
+
The provider sends native Chat Completions to `https://api.particle.ai/v1/chat/completions`, using request alias
|
|
1193
|
+
`particle-1`. The [official catalog](https://docs.particle.ai/models) lists text/image input, a 1,048,576-token combined
|
|
1194
|
+
context and a 131,072-token output ceiling (the API's omitted-limit default is 32,000). Strict schema guarantees are
|
|
1195
|
+
not advertised. AgentRun sends native tools and `reasoning_effort`; it does not reuse OpenRouter's reasoning object or
|
|
1196
|
+
its measured text-tools caching workaround. Existing `openrouter/particle-ai/particle-1` definitions and the code-review
|
|
1197
|
+
template keep their OpenRouter route.
|
|
1198
|
+
|
|
1199
|
+
Supported scope is Pi agentic runs and workflow model nodes (including nested learned workflows) through Pi's
|
|
1200
|
+
existing local proxy. Codex, Claude Agent and OpenCode do not support this direct provider. Particle's
|
|
1201
|
+
[Responses API](https://docs.particle.ai/responses) is WebSocket-only; it does not implement HTTP `POST /v1/responses`.
|
|
1202
|
+
Pointing `AGENT_MODEL_BASE_URL` at Particle's global or US API is therefore refused with setup instructions. This
|
|
1203
|
+
integration currently uses the global endpoint and regular service only; it does not expose regional routing, Flex,
|
|
1204
|
+
WebSocket steering, files or other Particle models.
|
|
1205
|
+
|
|
1206
|
+
The [reasoning levels](https://docs.particle.ai/reasoning) map low to low, medium/high/xhigh to high, and max to max.
|
|
1207
|
+
Pi requests with thinking off explicitly send `none`, rather than inheriting the API's high default. Native tool
|
|
1208
|
+
continuations retain the assistant's reasoning and tool-call IDs. Nested learned-workflow and `llm` side calls take
|
|
1209
|
+
the model's limits and reasoning configuration from the live session port, preserving their requested effort.
|
|
1210
|
+
|
|
1211
|
+
An opaque hash of the Pi conversation ID becomes `prompt_cache_key`, within Particle's 256-byte limit. Side requests
|
|
1212
|
+
without an ID share a key for the lifetime of their route. `cacheRetention: "none"` omits the explicit hint;
|
|
1213
|
+
Particle may still derive affinity and cache the prompt. Read the returned cached-token count, since
|
|
1214
|
+
[affinity does not guarantee a cache hit](https://docs.particle.ai/prompt-caching).
|
|
1215
|
+
|
|
1216
|
+
Usage keeps the provider's token counts: uncached input is prompt tokens minus cached input, and reasoning is a
|
|
1217
|
+
breakdown of completion tokens, never added to them again. Cost is an **estimate at regular peak list prices**:
|
|
1218
|
+
$0.25 uncached input, $0.03 cached input and $1 output per million tokens. The same rates reserve the run's cap.
|
|
1219
|
+
[Off-peak discounts, Flex and account-specific pricing](https://docs.particle.ai/usage-billing) can change the bill;
|
|
1220
|
+
Chat usage does not supply an authoritative dollar total. Missing or malformed usage, or a stream missing its terminal
|
|
1221
|
+
`[DONE]`, fails the request with unknown cost rather than reporting a free completion. Cancellation aborts the provider
|
|
1222
|
+
request, but does not undo tokens already generated or guarantee final usage.
|
|
1223
|
+
|
|
1224
|
+
Provider and session transports disable retries. A Pi claim using Particle, including one of its subagent tiers,
|
|
1225
|
+
also disables automatic conversation retries for the whole claim. Errors are surfaced for the caller to decide;
|
|
1226
|
+
even a pre-admission 429 is not retried automatically. This changes request retry configuration, not recovery
|
|
1227
|
+
admission, dispatch, journal fencing, restart or cancellation behavior; the recovery models do not change.
|
|
1228
|
+
|
|
1229
|
+
Offline regressions cover streamed native tools, continuation, reasoning, cache accounting, missing usage, cancellation,
|
|
1230
|
+
errors, credential scoping and actual Pi conversation retries. **Live validation remains outstanding.** A maintainer
|
|
1231
|
+
must supply a key and explicitly authorize a bounded spend before testing real tool continuation, cache-hit behavior,
|
|
1232
|
+
cancellation and billing. The protocol fixtures are not evidence of live compatibility or cache savings.
|
|
1233
|
+
|
|
1053
1234
|
### On a ChatGPT plan
|
|
1054
1235
|
|
|
1055
1236
|
A server needs no model key to start, on any of its deploys. With none, capabilities say `models.ready: false` and
|
|
@@ -1096,6 +1277,44 @@ A run on the plan books its tokens and no dollars (`cost.plan`). Eligible usage
|
|
|
1096
1277
|
Manage usage in your ChatGPT settings. A sign-in is for the person who runs this server: don't share it or let others
|
|
1097
1278
|
run agents on it.
|
|
1098
1279
|
|
|
1280
|
+
### On Claude Code's login on this machine
|
|
1281
|
+
|
|
1282
|
+
On a server one person runs on their own machine, Claude Agent can run on that person's Claude plan through the Claude
|
|
1283
|
+
Code CLI's own login. The CLI holds the login and calls Anthropic itself. AgentRun never reads, copies, stores or relays
|
|
1284
|
+
the login. It tells the CLI where the login is and asks it `claude auth status`, nothing else. Settings → Model keys
|
|
1285
|
+
has the row **Use Claude Code's login on this machine**, over these routes:
|
|
1286
|
+
|
|
1287
|
+
- `PUT /v2/settings/claude-login` `{"only_me": true, "place": "agentrun"}` turns it on. `only_me` is the owner's word
|
|
1288
|
+
that they alone run agents on this server. `place` is where the login is: `agentrun` (the default) is AgentRun's own
|
|
1289
|
+
login directory in the data folder, which you sign in once; `machine` is this machine's own Claude Code login
|
|
1290
|
+
(`~/.claude`), which you opt into by name. A server where more than one person can start runs (more than one API
|
|
1291
|
+
token, the API-only profile) refuses it with `403` and one line saying why, and a turn-on saved before is dropped
|
|
1292
|
+
when such a server starts.
|
|
1293
|
+
- `GET /v2/settings/claude-login` says `state`: `off`, `signed_in` (with the `account` the CLI names: method, email,
|
|
1294
|
+
organization, plan), `signed_out`, `no_cli` (claude-agent's first run installs the pinned CLI), `unknown`, or
|
|
1295
|
+
`other_machine`. `command` is the line that signs the CLI in at the login's place, for a terminal on the server's
|
|
1296
|
+
machine. Where the console is on that machine (a server on loopback with no public address), `can_start` is true and
|
|
1297
|
+
`POST /v2/settings/claude-login/login` starts the pinned CLI's own `auth login`, which opens a browser there.
|
|
1298
|
+
- `DELETE /v2/settings/claude-login` turns it off. The login stays as the CLI keeps it.
|
|
1299
|
+
|
|
1300
|
+
While it is on, a claude-agent run on an `anthropic/<model>` model goes on the login: its CLI gets no
|
|
1301
|
+
`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN` or key, no model proxy runs, and the CLI's sandbox denies its commands
|
|
1302
|
+
reads of the login. A model named on a gateway or OpenRouter keeps its key, and so does a run started with its own
|
|
1303
|
+
`model_key`. With no key at all, claude-agent's default
|
|
1304
|
+
model is `anthropic/claude-sonnet-5-5`. A run whose login is signed out fails at its start and says so. It never
|
|
1305
|
+
switches to a key. The run books its tokens and no dollars (`cost.plan`, `on: "claude_code"`), and the plan's own limits
|
|
1306
|
+
apply. Only a run in a runner place, on the machine the mode was turned on for, goes on the login. A run placed in a
|
|
1307
|
+
sandbox, or on another machine, uses the keys. The login is the server's user's, so a run on it needs runs under that
|
|
1308
|
+
user: where each run is a user of its own (the image, `run_isolation: "uid"`), a claude-agent run that would go on the
|
|
1309
|
+
login fails at its claim and says so. Set `AGENTRUN_RUN_USER=same`, or give the run a `model_key`.
|
|
1310
|
+
|
|
1311
|
+
The mode exists only on a server that listens on loopback (a local install, or one behind a local proxy). A server
|
|
1312
|
+
bound to any other address, such as all interfaces in a container or on a hosting service, has it off
|
|
1313
|
+
with nothing to set. `AGENTRUN_CLAUDE_CODE_LOGIN` overrides the default. `off` turns the mode off anywhere. `on` makes
|
|
1314
|
+
it available past loopback, but a server with more than one API token still refuses it, and so does the API-only
|
|
1315
|
+
profile. While the mode is off, the row is gone and every route above answers `404` naming its operation. A turn-on
|
|
1316
|
+
saved earlier is dropped when the server starts, and claude-agent runs on the model keys.
|
|
1317
|
+
|
|
1099
1318
|
## Tools
|
|
1100
1319
|
|
|
1101
1320
|
A revision names its tools from one closed table (`src/tools.ts`): each name is how the run's process binds it and the
|
|
@@ -1405,7 +1624,8 @@ saying why. Kernel's browsers run headless, and keep no downloads, so a run on K
|
|
|
1405
1624
|
run's process over its pipe, as the rest do. A session's custody (its lease, its tag, what it was
|
|
1406
1625
|
doing) is kept in the run's own store, so a run opened again on its directory reconciles the sessions it held. Each
|
|
1407
1626
|
page it reads is filed under the run's `work/evidence/`, each read in a file of its own (`0001-browser_read.md`, ...),
|
|
1408
|
-
reads at once included.
|
|
1627
|
+
reads at once included. No vendor records it; an agent whose browser computer says `record: true` gets its own video
|
|
1628
|
+
of each session ([A video of each run](#computers)). The owner watches the browser live, takes it over and hands it back, and
|
|
1409
1629
|
the agent can ask them to (below). When the run is let go (its work done, or a SIGTERM)
|
|
1410
1630
|
the sessions it still holds are released at their vendor. An agent's browser stays signed in from one run to the next
|
|
1411
1631
|
([saved sign-ins](#saved-sign-ins)).
|
|
@@ -1638,10 +1858,10 @@ A tool's key comes from one of two places. The server's own environment, through
|
|
|
1638
1858
|
`PUT /v2/settings/tool-keys/{id}` with `{values: {NAME: "..."}}` saves one, field by field (`parallel` takes
|
|
1639
1859
|
`PARALLEL_API_KEY`, `monid` `MONID_API_KEY`, `browserbase` `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`,
|
|
1640
1860
|
`kernel` `KERNEL_API_KEY`, `typesafe` `TYPESAFE_API_KEY`, which unlocks Jev's decisions, `decisions.jev`), and `DELETE` forgets it. A model
|
|
1641
|
-
provider's key is saved the same way (`anthropic`, `openai` and `openrouter`, each `kind: "model"`, the others
|
|
1642
|
-
`"tool"`):
|
|
1861
|
+
provider's key is saved the same way (`anthropic`, `openai`, `particle` and `openrouter`, each `kind: "model"`, the others
|
|
1862
|
+
`"tool"`): a run gets only its model providers' keys, and with no `AGENT_MODEL` a key gives the
|
|
1643
1863
|
default model ([models](#models)); its `harnesses` are pi and the harnesses that talk to that provider's API (OpenAI's:
|
|
1644
|
-
codex and opencode; OpenRouter's, all four), of
|
|
1864
|
+
codex and opencode; Particle's, Pi only; OpenRouter's, all four), of
|
|
1645
1865
|
those this server runs or would run once the key is set, so a row names them before it is saved: one left out is one
|
|
1646
1866
|
this server cannot run for another reason (not installed, not the pinned build, more than this host's memory). `GET
|
|
1647
1867
|
/v2/settings/tool-keys` lists each key, what it unlocks and the harnesses that run that, and each field's `set` and
|
|
@@ -1923,7 +2143,7 @@ save's `422` says, under a harness id when that harness's own MCP client would d
|
|
|
1923
2143
|
- **The credential.** A run whose revision grants a server's tool is handed that server's credential at each launch
|
|
1924
2144
|
(so a new one counts at the next), over its secrets pipe, never its environment; a run that grants none of a
|
|
1925
2145
|
server's tools gets none of it. It stays in the run's process: no harness's CLI, file or log holds it, and a run
|
|
1926
|
-
that writes it into a learned
|
|
2146
|
+
that writes it into a learned workflow is refused by the secret scan.
|
|
1927
2147
|
- **Every harness** gets each granted tool as a host tool, `mcp__<server>__<tool>`, with the pinned description and
|
|
1928
2148
|
schema, on its own channel for host tools: pi binds it in the run's process, claude-agent serves it from its `hands`
|
|
1929
2149
|
MCP server (`mcp__hands__mcp__<server>__<tool>`; the CLI's tool search is off in such a session, so the granted tools
|
|
@@ -2245,6 +2465,44 @@ key, in order, and undoes what it made when a later step fails:
|
|
|
2245
2465
|
deleted with the last.
|
|
2246
2466
|
- The trigger here. Its `source` names what was made: `instance_id` and `hook`.
|
|
2247
2467
|
|
|
2468
|
+
A config field named like a credential is sealed at the create. That is a field whose value is a string (not empty) or
|
|
2469
|
+
a number, and where a word of the name, read as its singular (`tokens` as `token`), is secret, password, passwd,
|
|
2470
|
+
passphrase, passcode, pwd, pat, token, credential, apikey, hapikey, jwt, dsn, sig, authorization, bearer or cookie;
|
|
2471
|
+
where connection is followed by string (`connection_string`); or where the last word is key (`api_key`, `api_keys`). A
|
|
2472
|
+
credential word right next to a count word (max, min, num, number, count, limit, total, used, usage, budget, remaining,
|
|
2473
|
+
per, length, size or quota) names a count, not a credential: `max_tokens`, `token_count`, `token_limit`, `tokens_used`
|
|
2474
|
+
and `maxTokens` stay as they are, a number in one too, while `access_token`, `refresh_token` and `bot_token` are sealed.
|
|
2475
|
+
A string that is an address carrying a credential, in any scheme (`https`, `postgres`, `redis`, `amqp`,
|
|
2476
|
+
`mongodb+srv`...), is sealed whole, whatever its field's name and at any depth: one with a user part (`user:pass@`,
|
|
2477
|
+
`:pass@`, or a token alone as in `https://TOKEN@host`), or with a query or fragment parameter named by the rule above
|
|
2478
|
+
(`token`, `api_key`, `access_token`, `sig`) that has a value. An address with none stays as it is; one whose user part
|
|
2479
|
+
holds no secret (`ssh://git@host`) is sealed all the same. A field the event's schema marks with `format: "password"` or
|
|
2480
|
+
`writeOnly: true` is sealed whatever its name; the create reads the event's schema from Composio for this. A create with
|
|
2481
|
+
such a value below the config's top level is refused `422`, naming it. For example, HubSpot's deal-stage event takes
|
|
2482
|
+
`{app_id, developer_api_key}`. Composio's trigger schemas rarely mark a field secret, so the name mostly decides. A
|
|
2483
|
+
number is sealed as its decimal text and stays a number in what Composio gets; a run's output is cut of that text when
|
|
2484
|
+
it is 8 characters or more, as a string's is. The value is kept in the composio source's sealed settings, next to the subscription's
|
|
2485
|
+
secret. Composio gets it once, in the instance's upsert. Every answer has `"[sealed]"` in its place, and
|
|
2486
|
+
`source.sealed_config` names the field. The events list names these fields per event under `sealed`, and the console
|
|
2487
|
+
takes them as passwords. A PATCH that leaves a sealed field out or sends `"[sealed]"` keeps it. Any other value is a
|
|
2488
|
+
change to the config and is refused, as every config change is: to change a key, delete the trigger and make a new one.
|
|
2489
|
+
The trigger's delete retires the value into a sealed row until the runs that saw it end. A trigger saved by an earlier server with such a value in plain text is answered
|
|
2490
|
+
masked by the same rule at once, at any depth (one below the top level named in `sealed_config` by its JSON Pointer),
|
|
2491
|
+
and sealed at the next start by the same rule. After that start, without holding it up, the server reads the schema of
|
|
2492
|
+
each event such a trigger uses, once, and seals the fields it marks the same way, logging `composio_config_sealed` per
|
|
2493
|
+
trigger. It writes a trigger only while the trigger is as it read it: one changed or deleted meanwhile is left (its
|
|
2494
|
+
values sealed for it removed again, the log saying `composio_config_not_sealed`) for the next start. Being already
|
|
2495
|
+
serving, it runs no `VACUUM`: the rewrite runs with `secure_delete` on, the marker below stays, the log says
|
|
2496
|
+
`store_scrub_not_done` with `reason=deferred`, and the next start's scrub finishes it before it serves. When Composio
|
|
2497
|
+
can't be reached, the log says `composio_config_schemas_unread` once with a code and the next start tries again. On SQLite that rewrite runs with
|
|
2498
|
+
`secure_delete` on, then a `VACUUM` and a WAL checkpoint,
|
|
2499
|
+
so the store's files keep no copy of the old row: neither the one rewritten nor one an earlier update of the row left in
|
|
2500
|
+
free space. A marker beside the database (`store.sqlite.scrub`) is written before the rewrite and removed once the
|
|
2501
|
+
checkpoint is done. A `VACUUM` held off by another connection's write past the store's busy wait is tried once more
|
|
2502
|
+
after a short pause. A start that finds the marker (the server stopped mid-way, or another connection held the
|
|
2503
|
+
`VACUUM` or the checkpoint back, logged as `store_scrub_not_done`) runs the scrub again. On Postgres the old row version stays until the
|
|
2504
|
+
database vacuums it. The log line names the trigger and the field, never the value.
|
|
2505
|
+
|
|
2248
2506
|
The create is refused before Composio is asked anything with `409 composio_no_public_url` when the server has no public
|
|
2249
2507
|
address (`AGENTRUN_PUBLIC_URL`): Composio could not reach it. `features.triggers.public_url` on `GET /v2/capabilities`
|
|
2250
2508
|
says whether there is one, never the address, and the console turns New app trigger off without one, with the line
|
|
@@ -2425,7 +2683,7 @@ rules of an apply are in [templates/README.md](https://github.com/Parcha-ai/agen
|
|
|
2425
2683
|
|
|
2426
2684
|
`agentrun template eval DIR` (`agentrun-serve eval-template DIR`) runs a package's eval cases as real runs of its agent
|
|
2427
2685
|
and grades each run with the case's graders: by default on a server of its own over a temp data directory, so it never
|
|
2428
|
-
touches yours, with each case's fake MCP servers on loopback and its
|
|
2686
|
+
touches yours, with each case's fake MCP servers on loopback and its corrections seeded through the learning API. Real
|
|
2429
2687
|
models cost money: each run is capped at its case's `max_cost_usd`. It exits 0 when every case passed, 1 when one
|
|
2430
2688
|
failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
2431
2689
|
[templates/README.md](https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/templates/README.md#running-the-evals).
|
|
@@ -2444,26 +2702,28 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
2444
2702
|
| Route | Here |
|
|
2445
2703
|
| --- | --- |
|
|
2446
2704
|
| `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
|
|
2447
|
-
| `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
|
|
2705
|
+
| `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. |
|
|
2448
2706
|
| `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. |
|
|
2449
2707
|
| `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0 ([spend cap](#spend-cap)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
|
|
2450
2708
|
| `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. |
|
|
2451
2709
|
| `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
|
|
2452
2710
|
| `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
|
|
2453
2711
|
| `POST /agents/{id}/archive`, `POST /agents/{id}/unarchive` | [Archiving](#archiving): hides the agent and its runs from the lists, or shows them again. Answers the agent, with `archived_at`. |
|
|
2712
|
+
| `DELETE /agents/{id}` | This server's own route (`x-agentrun-serve: "agentdelete/1"`): [deletes an agent another system owns](#deleting-an-agent-another-system-owns) (one an inline run made) whole. `204`; an agent made here is `409 agent_not_external`. |
|
|
2454
2713
|
| `DELETE /agents/{id}/sign-ins/{key}` | This server's own route (`x-agentrun-serve: "signins/1"`): forgets one of the agent's [saved sign-ins](#saved-sign-ins), at its vendor and here. `409 sign_in_held` while a run holds its save lease, or while a run it was handed is still going. |
|
|
2455
2714
|
| `POST /agents/{id}/runs`, `GET /agents/{id}/runs` | A run of the current revision, or of `revision`. An agentic run's input is `{content: string}`; a workflow run's is what its workflow's input schema takes. `file_ids` names [uploaded](#uploads) files, copied into the run's `work/inputs/` before it starts and named in its first message. `labels` (this server's own, `runlabels/1`) is the caller's map of its own strings for the run: at most 16 keys, each 1 to 63 letters, digits, `.`, `_`, `-` or `/` starting with a letter or a digit, each value 1 to 256 characters with no control character; kept as given, served as `labels` on every read of the run (`{}` when none), never read by the server otherwise, so no place for a secret. The agent's runs, newest first; `label` filters them as `GET /runs` does. |
|
|
2456
2715
|
| `GET /runs` | Every agent's runs, newest first, a page of at most 100; `agent`, `revision` and `status` narrow it, `label=<key>:<value>` (`runlabels/1`, split at the first `:`, once per request) keeps the runs holding that label, and `archived=true` lists only archived ones. A failed run's summary carries its `error`, and a waiting run's its `pending`. |
|
|
2457
|
-
| `GET /runs/{id}` | The run: its revision, kind, status, state, result, error, `pending` (this server's own, `pending/1`: what a waiting run waits on, by `kind`: `{kind: "question", question, asked_at}` for a question it asked a person; `approval` for a tool call held for a person's approval, with the tool, its arguments and its price; `budget` for a run paused at its cap ([a run paused at its cap](#a-run-paused-at-its-cap)); `{kind: "browser", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner in its browser; or `{kind: "computer", computer: "desktop"
|
|
2716
|
+
| `GET /runs/{id}` | The run: its revision, kind, status, state, result, error, `pending` (this server's own, `pending/1`: what a waiting run waits on, by `kind`: `{kind: "question", question, asked_at}` for a question it asked a person; `approval` for a tool call held for a person's approval, with the tool, its arguments and its price; `budget` for a run paused at its cap ([a run paused at its cap](#a-run-paused-at-its-cap)); `{kind: "browser", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner in its browser; or `{kind: "computer", computer: "desktop" \| "phone", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner on its desktop or phone; else null, a stopped turn's included) and cost (`basis: estimate`; $0 before its first model request, a cancelled run's included). |
|
|
2458
2717
|
| `GET /runs/{id}/timeline` | JSON pages with the change-number cursor (`after`, `next_after`, `reset`, `drop`, `has_more`, `final`, `wait_ms` long poll, and this server's own `limit`, 1 to 500 rows a page, default 500), or server-sent events with `Accept: text/event-stream` (`id` is the cursor, `Last-Event-ID` resumes). Rows sort by `seq`; the usage row (`Cost so far`), the run's running total, is always the last row, and moves to the end when a row comes after it. |
|
|
2459
|
-
| `POST /runs/{id}/messages` | To an agentic run: `steer` while the agent works, `answer` when it asked the person, `follow_up` after a stop or after it completed: a completed run opens again, the same run on its own session and store, takes a place under `--max-runs` (it waits for one when none is free), and completes again. A failed or cancelled run, an archived run and a run of an archived agent are `409 not_continuable
|
|
2718
|
+
| `POST /runs/{id}/messages` | To an agentic run: `steer` while the agent works, `answer` when it asked the person, `follow_up` after a stop or after it completed: a completed run opens again, the same run on its own session and store, takes a place under `--max-runs` (it waits for one when none is free), and completes again. A failed or cancelled run, an archived run and a run of an archived agent are `409 not_continuable` (a run of an agent [being deleted](#deleting-an-agent-another-system-owns), `409 agent_not_runnable`); a workflow run takes none (`501`). |
|
|
2460
2719
|
| `POST /runs/{id}/stop`, `POST /runs/{id}/cancel` | Stop ends an agentic run's turn and leaves the run `input_required` and idle. Cancel ends a run `cancelled` once its process has exited. |
|
|
2461
2720
|
| `POST /runs/{id}/archive`, `POST /runs/{id}/unarchive` | [Archiving](#archiving) one run. Answers the run, with `archived_at`. |
|
|
2462
2721
|
| `GET /runs/{id}/files`, `GET /runs/{id}/files/{path}` | The files under the run's `work/`, raw, one byte range at a time on asking (`Range`, `206`); and its screen recordings under `recordings/` ([A video of each run](#computers)). |
|
|
2463
2722
|
| `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. |
|
|
2464
2723
|
| `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"`). |
|
|
2465
|
-
| `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. |
|
|
2724
|
+
| `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 the `from` and `to` query parameters (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. |
|
|
2466
2725
|
| `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`). |
|
|
2726
|
+
| `GET /runs/{id}/trace` | A run's trace, for a person who debugs it: each model request that answered and each tool call as one span, in the order they started. A span has its `kind` (`model` or `tool`), its `name` (the model, or the tool), when it started and ended, how it ended (`status`), and the span it ran under (`parent_id`: the request that made a call, the call a subagent's request was started by). A model request also has its `tokens` (`input` not read from cache, `cache_read`, `cache_write`, `output`, and `reasoning` where reported), and its `usd`. A tool call also has the head of its arguments and of its output, as its Timeline rows show them, and what was charged under it (`usd`, `charged`, `not_metered`). A call that asked for approval ends as its approval did: `waiting` until it is answered, `refused` on a deny, `interrupted` when it was withdrawn with its run. Nothing is measured again or estimated: `model_requests` says what the run's record keeps. `priced`: each request is a span with its cost. `tokens_only`: a workflow run. Its model nodes' requests carry tokens and no cost, since the run's cost is its booking's; each of its decisions (a judge's, a route's, a verify's request) is a span too (`decision: true`), named by the model its provider answered with and labelled by its node, with its own cost. `not_recorded`: a CLI harness's record keeps no request, so its trace is its tool calls. A computer's own time is its provider's to bill and is in no span. Readable while the run goes; one read serves the run's first 2,000 spans and counts the rest in `dropped`. Its words are cut as the Timeline's are, and a run whose handed sign-in can't be read back is refused (`403`), as its graph is. The console's Dev tools tab reads it. |
|
|
2467
2727
|
| `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`. |
|
|
2468
2728
|
| `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`. |
|
|
2469
2729
|
| `GET /settings/tool-keys`, `PUT` and `DELETE /settings/tool-keys/{id}` | [Tool keys](#tool-keys), this server's own routes (`x-agentrun-serve: "toolkeys/1"`): each key's fields by name and where each is set, never a value; save one sealed, or forget it. |
|
|
@@ -2536,6 +2796,12 @@ serves these routes alone:
|
|
|
2536
2796
|
`GET /runs`), timeline, messages, stop, cancel, kill (`501` here, as above) and cap raise (`PATCH /runs/{id}`);
|
|
2537
2797
|
- its files (`GET /runs/{id}/files`, `GET /runs/{id}/files/{path}`) and [uploads](#uploads) (`/files`);
|
|
2538
2798
|
- an agent's Archil disk (`GET` and `DELETE /agents/{id}/archil`);
|
|
2799
|
+
- the [delete of an agent another system owns](#deleting-an-agent-another-system-owns) (`DELETE /agents/{id}`), for
|
|
2800
|
+
the backend whose inline runs made it;
|
|
2801
|
+
- the computer settings' two reads, for a backend to check before it launches: `GET /computers` (each provider, its
|
|
2802
|
+
key names and whether each is saved, and whether it is ready) and `GET /workspace/archil` (whether runs' folders are
|
|
2803
|
+
on Archil, and whether its account key is saved). Neither answers a key's value. Their writes, tests and key choices
|
|
2804
|
+
are the console's, refused here;
|
|
2539
2805
|
- `GET /capabilities`, `GET /health` and `GET /usage`.
|
|
2540
2806
|
|
|
2541
2807
|
Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
|
|
@@ -2658,7 +2924,8 @@ codex mcp add agentrun --url "$AGENTRUN_BASE_URL/mcp" --bearer-token-env-var AGE
|
|
|
2658
2924
|
## Harnesses
|
|
2659
2925
|
|
|
2660
2926
|
A definition names the harness that runs it: `pi` (the default, and what a definition that names none gets),
|
|
2661
|
-
`claude-agent`, `codex
|
|
2927
|
+
`claude-agent`, `codex`, `opencode`, or one of this server's harness modules adds (below). Any other is
|
|
2928
|
+
`422 input_invalid` on `definition.harness`. Every answer names it. An edit
|
|
2662
2929
|
(`PUT /agents/{id}/definition`) that names no harness keeps the agent's, as it keeps its skill files; name `pi` to move it
|
|
2663
2930
|
back.
|
|
2664
2931
|
`GET /v2/capabilities` lists each in `harnesses`, with `available` and, when not, the `reason`, and `default_model`: the
|
|
@@ -2732,6 +2999,39 @@ inlined in its system prompt.
|
|
|
2732
2999
|
`GET /v2/openapi.json` marks each `x-agentrun-serve: "harness/1"`, beside the other properties it adds (`model/1`,
|
|
2733
3000
|
`serve/1`), and lists them in `info.x-agentrun-serve.fields`.
|
|
2734
3001
|
|
|
3002
|
+
### Harness modules
|
|
3003
|
+
|
|
3004
|
+
A harness is one entry in serve's harness table (`src/harness-table.ts`). Capabilities, a save's check, the runner and
|
|
3005
|
+
the console all read that table. An owner adds harnesses with a harness module: start the server with
|
|
3006
|
+
`--harness-module MODULE` (repeatable), or set `AGENTRUN_SERVE_HARNESS_MODULES=a,b`. A separate `agentrun-serve runner`
|
|
3007
|
+
takes the same flag and setting, and needs them to run the module's harnesses. MODULE is a path, or a package installed
|
|
3008
|
+
with `npm install --prefix <data>/harnesses <package>`.
|
|
3009
|
+
|
|
3010
|
+
A module exports `entries(builtins)`, which returns new entries by id. Each entry gives `label`, `steer`, `runMib`,
|
|
3011
|
+
`oneAlwaysFits`, `runs`, `onWire`, `model`, `priceModel`, `refusal` and its `runner`, and may give `promises`. A run of
|
|
3012
|
+
the harness runs on its runner's `adapter(launch, extra)`, and is admitted by the `runMib` its entry declares. A module
|
|
3013
|
+
adds harnesses and never replaces one. The start of the server, or of a separate runner, is refused, naming the module
|
|
3014
|
+
and the id, when a module:
|
|
3015
|
+
- gives an id that does not match `^[a-z][a-z0-9-]{0,39}$`;
|
|
3016
|
+
- names an id serve's own runs carry: `learning`, `sdk`, `workflow`, `claude-agent-sdk` or `codex-sdk`;
|
|
3017
|
+
- names a built-in harness;
|
|
3018
|
+
- names an id another module adds;
|
|
3019
|
+
- gives an entry that is missing a member;
|
|
3020
|
+
- does not resolve.
|
|
3021
|
+
|
|
3022
|
+
A module's entry that gives no adapter `facts` runs on the general spec, with pi's tools: capabilities list its id on
|
|
3023
|
+
every tool pi runs (`tools[].harnesses`) and on MCP grants (`features.mcp_client.harnesses`), so an agent on it keeps
|
|
3024
|
+
its tool choices. One that gives `facts` runs the host tools, as the other built-in harnesses do.
|
|
3025
|
+
|
|
3026
|
+
The harnesses a module adds are listed in `capabilities.harnesses` after the built-in ones. Each offer there carries a
|
|
3027
|
+
`label` and `promises`:
|
|
3028
|
+
- `resume`: `exact`, `load` or `restart`.
|
|
3029
|
+
- `tool_gate`: `every_call`, `permission` or `config`.
|
|
3030
|
+
- `billing`: `proxy` or `plan`.
|
|
3031
|
+
|
|
3032
|
+
The built-in harnesses promise `exact`, `every_call` and `proxy`. These fields are marked
|
|
3033
|
+
`x-agentrun-serve: "harness-table/1"`.
|
|
3034
|
+
|
|
2735
3035
|
## Decision workflows
|
|
2736
3036
|
|
|
2737
3037
|
A workflow's typed questions (its `judge`, `pick`, `sift`, `route` and `ask` nodes) run on a decision provider when
|
|
@@ -2787,8 +3087,10 @@ typed answers and their probabilities.
|
|
|
2787
3087
|
|
|
2788
3088
|
## Archiving
|
|
2789
3089
|
|
|
2790
|
-
An agent or a run is archived, never deleted: `DELETE` stays `405
|
|
2791
|
-
|
|
3090
|
+
An agent made here or a run is archived, never deleted: a run's `DELETE` stays `405`, and an agent's is `409
|
|
3091
|
+
agent_not_external` (an agent another system owns is [deleted](#deleting-an-agent-another-system-owns), and is never
|
|
3092
|
+
archived here). These routes are this server's own, outside the `/v2` contract, like `GET /runs` and an agent's
|
|
3093
|
+
revisions; capabilities list them in `features.archive`.
|
|
2792
3094
|
|
|
2793
3095
|
- `POST /v2/agents/{id}/archive` hides the agent and its runs from `GET /agents`, `GET /runs` and
|
|
2794
3096
|
`GET /agents/{id}/runs`; `POST /v2/runs/{id}/archive` hides one run. `.../unarchive` shows them again. Each is
|
|
@@ -2807,6 +3109,45 @@ An agent or a run is archived, never deleted: `DELETE` stays `405`. These routes
|
|
|
2807
3109
|
already going when its agent is archived keeps going.
|
|
2808
3110
|
- The store keeps an archive as `archived_at` on the agent's or the run's row, null when it is not archived.
|
|
2809
3111
|
|
|
3112
|
+
## Deleting an agent another system owns
|
|
3113
|
+
|
|
3114
|
+
An agent made by an inline run (`POST /v2/runs` with `external`) belongs to the system that sent it, which may have to
|
|
3115
|
+
delete what it sent. `DELETE /v2/agents/{id}` deletes such an agent whole, in three steps, each done before the next:
|
|
3116
|
+
|
|
3117
|
+
1. The agent refuses new runs: its `archived_at` is set (only this delete sets it on such an agent, whose archive route
|
|
3118
|
+
is refused) and its triggers are turned off in the same write, so the refusal outlives a restart. From then a run of
|
|
3119
|
+
it, an inline run of its reference, a trigger's firing, an SDK run and a message that would open one of its finished
|
|
3120
|
+
runs again are `409 agent_not_runnable`, saying it is being deleted; so is a new trigger of it (off too), a trigger
|
|
3121
|
+
moved to it or one of its turned on, and a write to its home or its learning (a home file's write or delete, a
|
|
3122
|
+
corrections.md edit, a learned workflow's approve, retire or restore, a run's grade, a replay). Such a write sent
|
|
3123
|
+
while a `DELETE` runs waits for it, then finds the agent gone (`404`), so none lands after its learning went. Each of
|
|
3124
|
+
its runs still going, its learning runs included, is cancelled as `POST /runs/{id}/cancel` cancels it, and the
|
|
3125
|
+
delete waits until every one has ended.
|
|
3126
|
+
2. Its learning is deleted by the learning module: every file of its learning folder, then its promotions and grades.
|
|
3127
|
+
It refuses while learning work of the agent is in flight: `409 learning_busy`, naming
|
|
3128
|
+
that work in `details.runs`.
|
|
3129
|
+
3. The rest: its triggers (and what each registered at its source), its saved sign-ins (and each object at its vendor),
|
|
3130
|
+
its own computer, its Archil disk, each run with everything kept of it (its journal, launch record, messages, origin,
|
|
3131
|
+
live view, channel posts, kept learning, files and scratch folders, and the answers kept under its idempotency keys;
|
|
3132
|
+
a request still at work under a key when its run went keeps no answer, so a key never replays a deleted run),
|
|
3133
|
+
its revisions and the agent. A run whose launch named an Archil disk (`archil_disk`, the caller's) kept its folder
|
|
3134
|
+
there, under the agent's own folder: that folder is deleted on the disk, and the disk and everything else on it are
|
|
3135
|
+
kept; a disk Archil says is gone has nothing left to delete. Shared things are kept: MCP servers, keys, paired computers and uploads. What the agent owns elsewhere is
|
|
3136
|
+
deleted there before the record here that names it (a trigger's registration and its settings before its row, a
|
|
3137
|
+
sign-in's object at its vendor before its tombstone, the disk at Archil before it is forgotten, a run's folder on a
|
|
3138
|
+
disk its launch named before its launch record), so a failure or a crash never leaves one with nothing here to reach
|
|
3139
|
+
it.
|
|
3140
|
+
|
|
3141
|
+
`204` once it is gone; a second `DELETE`, or one of an unknown agent, is `404`. `409 runs_in_flight` (a run did not end
|
|
3142
|
+
within 30 s, or only its application ends it, as an SDK run), `409 learning_busy` and `503 unavailable` leave the agent
|
|
3143
|
+
refusing runs: send the `DELETE` again. `503` says which thing it owns elsewhere is not deleted there yet: a trigger's
|
|
3144
|
+
registration (Composio failed), a saved sign-in (its vendor failed), its own computer (its provider has not deleted it),
|
|
3145
|
+
its Archil disk (Archil failed or was not reached, a run of another agent is on it, or Archil is off on this server
|
|
3146
|
+
with a disk still stored on the agent: turn Archil on again first), or a run's folder on a disk its launch named
|
|
3147
|
+
(Archil failed, a computer still holds the folder, or Archil is off), or a trigger that reached the agent after the
|
|
3148
|
+
delete removed its triggers (the next `DELETE` removes it, its registration upstream first). A delete stopped
|
|
3149
|
+
part way (a crash) is finished the same way: every step is safe to do again.
|
|
3150
|
+
|
|
2810
3151
|
## The console
|
|
2811
3152
|
|
|
2812
3153
|
Open the link the server prints, once, in a browser. `/` is the console (`apps/console` in the repository), on the
|
|
@@ -2819,8 +3160,8 @@ server's own origin, under a CSP that allows that origin only, but for the provi
|
|
|
2819
3160
|
with archived ones behind **Archived**. Build, edit and run actions share the remembered coding-agent dropdown,
|
|
2820
3161
|
including **API playground**. Choosing a template prepares its full definition without creating or running it.
|
|
2821
3162
|
Each agent opens an overview beside its runs, versions and supported workflow, learning and analytics tabs.
|
|
2822
|
-
- **Learning Dojo** (`#/dojo`): learning across connected agents, read from this server. It shows
|
|
2823
|
-
|
|
3163
|
+
- **Learning Dojo** (`#/dojo`): learning across connected agents, read from this server. It shows each agent's
|
|
3164
|
+
corrections and learned workflows, workflows waiting for review, and recent changes with their source runs. Open an agent's
|
|
2824
3165
|
Learning tab to inspect its knowledge, enable learning, or review a pending change. Counts say when a read is
|
|
2825
3166
|
incomplete; missing results are not shown as zero.
|
|
2826
3167
|
- **API playground**: create an agent with `POST /v2/agents`, edit its definition with
|
|
@@ -2838,8 +3179,8 @@ server's own origin, under a CSP that allows that origin only, but for the provi
|
|
|
2838
3179
|
its credential's state, **Refresh**, **Change** (a credential left empty keeps the saved one) and **Delete**. An
|
|
2839
3180
|
agent's Tools step lists each saved server's tools; a box ticked grants `mcp:<server>/<tool>`.
|
|
2840
3181
|
|
|
2841
|
-
A run that reports learning also has a **Learning result** panel: the outcome, the
|
|
2842
|
-
|
|
3182
|
+
A run that reports learning also has a **Learning result** panel: the outcome, the corrections and workflow it kept,
|
|
3183
|
+
the checks' problems, and the seed and merge revisions. Its changed
|
|
2843
3184
|
files remain available beside the result. The agent's Learning tab refreshes after returning to the console and
|
|
2844
3185
|
while visible, without replacing an open edit or review.
|
|
2845
3186
|
|
|
@@ -2868,7 +3209,11 @@ AgentRun Server is for one person, who signs in to the console with a password (
|
|
|
2868
3209
|
no `AGENTRUN_PUBLIC_URL`, listening on loopback (the default), the start prints `Set your password: <url>/setup`, and the
|
|
2869
3210
|
first visit sets it, 12 characters or more. With a public address, or listening on any other address (`0.0.0.0` in the
|
|
2870
3211
|
image, a LAN address), the start prints `Set up this server: <url>/setup#code=<code>`, and setup takes that code (or the
|
|
2871
|
-
token, in the code field or as the Bearer): anyone who reaches the port could otherwise set the password first.
|
|
3212
|
+
token, in the code field or as the Bearer): anyone who reaches the port could otherwise set the password first. A code
|
|
3213
|
+
works once and lasts 30 minutes. `POST /v2/setup/code`, with no credential (the console's **Get a new code**), prints a
|
|
3214
|
+
new one to the log when the last is expired or spent and keeps one still good, so this request never voids a link
|
|
3215
|
+
someone holds; it answers `{printed, expires_at}`, never the code, and 403 once the password is set, while it is being set, or where setup
|
|
3216
|
+
takes no code. A restart prints a new code too. The server keeps a scrypt hash of the password, never the password, in `DIR/owner.json`, and signs its
|
|
2872
3217
|
session cookies with the key in `DIR/.session-secret`; both are 0600, and no run reaches either. A session lasts 30 days.
|
|
2873
3218
|
**Sign out** (`POST /v2/auth/sign-out`) signs out this browser: its session is revoked on the server (a copy of its
|
|
2874
3219
|
cookie stops working too) and its cookie cleared, and every other browser stays signed in. **Sign out everywhere** (`POST /v2/auth/sign-out-everywhere`) ends every session on every browser and phone,
|
|
@@ -2882,7 +3227,12 @@ at once; a new one past that is held by the server's budget only, and no address
|
|
|
2882
3227
|
Behind a proxy every visitor would be the proxy's address, so one guesser would hold the owner too: set
|
|
2883
3228
|
`AGENTRUN_TRUSTED_PROXIES` to the proxy's addresses or ranges (comma-separated, or `loopback`, `linklocal`,
|
|
2884
3229
|
`uniquelocal`), and a request from one of them counts under the client its `X-Forwarded-For` names (the nearest address
|
|
2885
|
-
that is not itself a trusted proxy). Unset, that header is never read.
|
|
3230
|
+
that is not itself a trusted proxy). Unset, that header is never read. A trusted proxy only changes which address a
|
|
3231
|
+
sign-in try counts against, never who the request is: `X-Forwarded-For` signs no one in, and the whole server's 100
|
|
3232
|
+
wrong passwords still hold. So with a wide setting such as `uniquelocal` (10/8, 172.16/12, 192.168/16 and fc00::/7; the
|
|
3233
|
+
VPS installer's tailnet mode sets it, since `tailscale serve` reaches the server through Docker's private bridge),
|
|
3234
|
+
anything on those ranges that fakes the header, an agent's Docker box among them, can only spread its tries over more
|
|
3235
|
+
addresses. The owner's first sign-in of a start (the
|
|
2886
3236
|
right password) that comes with `X-Forwarded-For` from an address the server doesn't trust is logged once, with that
|
|
2887
3237
|
address (`event=forwarded_untrusted peer=<address>`; a server from a release after 0.1.0-beta.32). Only the right
|
|
2888
3238
|
password logs it, so the address is the one that carried the owner's own request: behind a proxy, the proxy's.
|
|
@@ -2992,6 +3342,10 @@ work is done and before the answer is sent, so a retry after a restart gets the
|
|
|
2992
3342
|
between the work and the save loses it, and a save that fails still answers. A run create's key is also kept with its
|
|
2993
3343
|
run in the agent store, written with the run itself, so a retry after any restart, or after that day, gets that run (as
|
|
2994
3344
|
it is now, marked `Idempotent-Replayed: true`), and another body under the key is still `409 idempotency_mismatch`.
|
|
3345
|
+
The file keeps no request body. A key's fingerprint is an HMAC of the body under a key derived from the seal key. A
|
|
3346
|
+
trigger create's answer is kept as a read answers it (a composio trigger's sealed config as `"[sealed]"`); every other
|
|
3347
|
+
answer, a run's input among them, is kept and replayed as it was. A record an earlier server wrote with the body itself
|
|
3348
|
+
is rewritten at the start, and the log says how many.
|
|
2995
3349
|
|
|
2996
3350
|
A completed agentic run's `result` is `{output: null, final_answer}`; a completed workflow run's is
|
|
2997
3351
|
`{output: <the workflow's output>, final_answer: null}`.
|
|
@@ -3003,28 +3357,27 @@ definition that sets it keeps it on its revision, `false` included, and an edit
|
|
|
3003
3357
|
that never sets it stores nothing, so its revision id is the one it had before the switch. The server's `--learning off`
|
|
3004
3358
|
turns learning off for every run it starts, whatever the agent says.
|
|
3005
3359
|
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3360
|
+
An agent learns two things. Its owner's corrections: the words they give after a run (a grade's, or a message after
|
|
3361
|
+
the job's first) become one line of the agent's `corrections.md`, and every later run reads the file whole. And its
|
|
3362
|
+
job, once it repeats: after `learning.compile_after` completed runs (20 by default) the run's end asks one compile turn
|
|
3363
|
+
for the whole job as one workflow, which is checked in code, replayed on the agent's own past inputs, and served as one
|
|
3364
|
+
tool once it agrees with the agent's own answers. The console reads `GET /v2/agents/{id}/learning` for the agent's
|
|
3365
|
+
corrections, workflows and history, and `GET /v2/runs/{id}/learning` and its `/diff` for an individual result.
|
|
3366
|
+
Observation requires no model key; producing new learning requires an agentic run through this server with learning
|
|
3367
|
+
enabled and a configured model.
|
|
3010
3368
|
|
|
3011
|
-
Importing Claude Code, Codex or pi session history does not replay learning or connect a live learning stream.
|
|
3012
|
-
|
|
3013
|
-
integration before the console can display them. Learning Dojo shows this server's actual reflection results, not inferred
|
|
3014
|
-
training scores from imported conversations. Before/after cost and duration are observations, not an accuracy
|
|
3015
|
-
evaluation.
|
|
3369
|
+
Importing Claude Code, Codex or pi session history does not replay learning or connect a live learning stream.
|
|
3370
|
+
Before/after cost and duration are observations, not an accuracy evaluation.
|
|
3016
3371
|
|
|
3017
|
-
An agent that learns has a learning folder, `learning/` in its folder on the disk (`DATA/disk/agents/<key>/learning/`)
|
|
3018
|
-
auto-memory format:
|
|
3372
|
+
An agent that learns has a learning folder, `learning/` in its folder on the disk (`DATA/disk/agents/<key>/learning/`):
|
|
3019
3373
|
|
|
3020
|
-
- `
|
|
3021
|
-
- one
|
|
3022
|
-
`
|
|
3023
|
-
note's text. The server parses it and builds the index with its own code, in [`src/learn/`](src/learn/SPEC.md),
|
|
3024
|
-
whose `SPEC.md` is the folder's contract.
|
|
3374
|
+
- `corrections.md`, its owner's standing corrections, one `- ` line each, at most 2048 bytes;
|
|
3375
|
+
- one folder per learned workflow, `workflows/<name>/`, with its `workflow.json` and its `README.md` (front matter with
|
|
3376
|
+
`name` and `description`, and `status: pending` while it waits for its owner's OK).
|
|
3025
3377
|
|
|
3026
|
-
The
|
|
3027
|
-
|
|
3378
|
+
The server reads and writes it with its own code, in [`src/learn/`](src/learn/SPEC.md), whose `SPEC.md` is the
|
|
3379
|
+
folder's contract. The folder is plain git with `main` checked out. The agent's first run that learns makes it, with
|
|
3380
|
+
one empty commit on `main`; an agent that does not learn never gets one. The server is its only writer. Every git
|
|
3028
3381
|
call the server makes there runs with the folder's hooks and fsmonitor off, no replace refs, no lazy fetch and no system
|
|
3029
3382
|
or global config, one at a time per agent.
|
|
3030
3383
|
|
|
@@ -3032,61 +3385,26 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
|
|
|
3032
3385
|
|
|
3033
3386
|
- `runs/<id>/learning.json` pins that commit (`seed`). It is written once: a resume or a follow-up reads the same
|
|
3034
3387
|
commit, however `main` moves on.
|
|
3035
|
-
-
|
|
3036
|
-
whatever its tools:
|
|
3037
|
-
|
|
3038
|
-
not
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
lexical match (BM25 over its name, description and text; a code review's changed paths weigh three times its prose; no
|
|
3043
|
-
model call), and the run reads the best ones whole while they fit the budget, then one line each
|
|
3044
|
-
(`- <name> (<file>): <description>`, at most 200 lines and 25 KB) for the next ones while they fit what is left, in
|
|
3045
|
-
place of the index. A note that shares no word with the first message is a line at most. A first message that shares
|
|
3046
|
-
no word with any note reads the notes changed last, whole while they fit, then their lines. Whole notes take the
|
|
3047
|
-
budget before lines do, so an agent with hundreds of notes still reads the ones that bear on the run whole; the notes
|
|
3048
|
-
given neither way are left out, and the run's log names them ("starts without N of the notes its agent learned").
|
|
3049
|
-
An agent with the `read` tool is told the notes not given whole are in `.learning/`, to open one when it applies
|
|
3050
|
-
(one without is not). A line
|
|
3051
|
-
before them says to follow a note when it applies. `# Learned` opens, for every run that learns, notes or none, with
|
|
3052
|
-
what the run is told of learning: that only what it answers when it is asked at the end is kept, never a file it
|
|
3053
|
-
writes, so it tells the person it will keep what they ask it to remember, and that a secret is never kept. A run with
|
|
3054
|
-
nothing learned yet is told so. A run that does not learn (or whose seed failed) gets no `# Learned`. Every name, description, text and index line is cut of the server's secrets as they are when the run is made,
|
|
3055
|
-
as a person's reads are. That is pi's system prompt and claude-agent's and codex's instructions: the same channel
|
|
3056
|
-
`CLAUDE.md` and `AGENTS.md` travel in. No such file is written into the run's work (claude-agent keeps project
|
|
3057
|
-
settings off, so a `.claude/` in the work never loads). The pin keeps the section the run
|
|
3058
|
-
reads (`section`), so a resume or a follow-up reads the same; a pin an earlier server wrote, the index alone
|
|
3059
|
-
(`learned`), is read as that server gave it.
|
|
3060
|
-
- `MEMORY.md` and the active notes are copied into the run's `work/.learning/`, made fresh and cut of the server's
|
|
3061
|
-
secrets the same way, for the run to read; a note that is not active is not, and neither is its line in the index.
|
|
3062
|
-
- The skills the agent wrote, each a folder `skills/<name>/` on `main` with its `SKILL.md`, join the revision's own:
|
|
3063
|
-
each is copied, every file of it, into the run's `work/.agents/skills/<name>/`, and the run gets it as it gets the
|
|
3064
|
-
revision's (pi and codex read each `SKILL.md` in their prompt, claude-agent loads the ones its adapter takes through
|
|
3065
|
-
its Skill tool). A skill named like one of the revision's is the revision's, and only an active skill is served: one
|
|
3066
|
-
whose `SKILL.md` front matter says `status: pending` (held for its owner's OK), or any status but `active`, is not.
|
|
3067
|
-
One front-matter reader decides a skill's and a workflow's status everywhere (the checks, the console, the routes and
|
|
3068
|
-
a run's start): front matter that does not read one way (not closed, a key indented under another, a key set twice, a
|
|
3069
|
-
status over more than one line) reads as retired, so no run is given it. A learned skill is served with its `name` and
|
|
3070
|
-
`description` quoted, so a harness reads them as text.
|
|
3071
|
-
The learned ones get 256 KiB, every file of each together, and never more than the revision's skills leave of the 1
|
|
3072
|
-
MiB an adapter takes of a run's skills in all, so they never push the revision's back into the prompt: the one
|
|
3073
|
-
changed last on `main` first, each whole while it fits. One that does not fit, or holds one of the server's secrets,
|
|
3074
|
-
is left out. The pin names the files of the ones laid (`skills`) and the ones left out (`skills_left_out`), and a
|
|
3075
|
-
follow-up gets them laid again, fresh, whatever the run wrote over them; one the work no longer holds whole when the
|
|
3076
|
-
run's process starts is left out of what its harness gets, and the run goes on. A skill whose name or files are out
|
|
3077
|
-
of shape is not read, and a symbolic link or a submodule at `skills/` or anywhere under it is a learning fault.
|
|
3388
|
+
- The agent's corrections go into the run's instructions after the agent's, under `# Learned`, so a run reads them
|
|
3389
|
+
whatever its tools: `corrections.md` whole, after one line that says they are its owner's standing corrections, to
|
|
3390
|
+
follow each one that applies. Nothing picks, ranks or summarizes them: the file's cap keeps it whole. A run with no
|
|
3391
|
+
corrections yet reads "Nothing learned yet." there; a run that does not learn gets no `# Learned`. The text is cut of the server's secrets as they are when the run is made, as a person's reads are. That is
|
|
3392
|
+
pi's system prompt and claude-agent's and codex's instructions: the same channel `CLAUDE.md` and `AGENTS.md` travel
|
|
3393
|
+
in. No file is written into the run's work. The pin keeps the section the run reads (`section`), so a resume or a
|
|
3394
|
+
follow-up reads the same.
|
|
3078
3395
|
- The workflows the agent learned, each a folder `workflows/<name>/` on `main` with its `workflow.json` and its
|
|
3079
3396
|
`README.md`, are the run's as one tool, `learned_workflow {name, input}`, on every harness (pi, claude-agent, codex),
|
|
3080
|
-
with no edit of the agent's definition. Only an active one is
|
|
3081
|
-
|
|
3397
|
+
with no edit of the agent's definition. Only an active one is: its `README.md` sets no status, or `active`; front
|
|
3398
|
+
matter that does not read one way (not closed, a key indented under another, a key set twice, a status over more
|
|
3399
|
+
than one line) reads as retired, so no run is given it. Its description names each workflow with the line its README gives, 8 KiB of lines in all: by name, each
|
|
3082
3400
|
while its line fits, and one that does not, or holds one of the server's secrets, is left out. A README whose front
|
|
3083
3401
|
matter does not read one way (not closed, or a line that is no key at its left edge) is not read. The pin names the
|
|
3084
3402
|
ones the run gets (`workflows`), each kept whole in the run's directory (`learned-workflows.json`), outside its work,
|
|
3085
3403
|
and the ones left out (`workflows_left_out`). The list is fixed when the run starts: a workflow approved or retired
|
|
3086
|
-
while it runs is the next run's to get or not
|
|
3087
|
-
|
|
3404
|
+
while it runs is the next run's to get or not. A call checks the workflow again against the agent's own tools as its
|
|
3405
|
+
run resolves them, as the commit's checks did: one whose call node names a tool the agent was not
|
|
3088
3406
|
granted (or one its run resolves unavailable), whose model node names any tool (a learned model node runs without
|
|
3089
|
-
tools, so the
|
|
3407
|
+
tools, so the checks refuse one too), or that holds a code node or a shell or executor call, is refused before any of
|
|
3090
3408
|
its nodes runs. It runs with the workflow DSL: each model node on the run's own model (the one the run was made with
|
|
3091
3409
|
and handed the key of; a tier the run has no model of runs there too), in a session of its own with no tool of its
|
|
3092
3410
|
own, each call node `via: "tool"` on a tool the agent has, its paid requests booked under
|
|
@@ -3097,147 +3415,77 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
|
|
|
3097
3415
|
requests, booked on the session's records labelled `learned_workflow`. So they go wherever the harness's go (the
|
|
3098
3416
|
operator's gateway at ANTHROPIC_BASE_URL or AGENT_MODEL_BASE_URL, OpenRouter, the vendor's API), and every run is
|
|
3099
3417
|
offered the workflows its pin names. A call a crash cut off is answered interrupted, never run again. The tool gate holds
|
|
3100
|
-
`learned_workflow` like any tool: its settings key is `learned_workflow`, allowed by default (the agent's own
|
|
3101
|
-
|
|
3418
|
+
`learned_workflow` like any tool: its settings key is `learned_workflow`, allowed by default (the agent's own checked
|
|
3419
|
+
and replayed workflow), and tool settings may set it to ask (the run parks until an owner answers) or deny.
|
|
3102
3420
|
When a run's learned workflows name decision providers (Jev, Parallel, OpenRouter), the runner opens those providers'
|
|
3103
3421
|
keys as it opens the run's own, from the server's environment first and then its saved keys, for the run's tools alone:
|
|
3104
|
-
never for its model or a CLI harness's own environment. A provider the run's tool gate denies gets no key.
|
|
3105
|
-
workflows can use them once decision nodes land (see Coming).
|
|
3422
|
+
never for its model or a CLI harness's own environment. A provider the run's tool gate denies gets no key.
|
|
3106
3423
|
A learned workflow's call node can run an MCP tool the agent grants (`mcp:<server>/<tool>`) through the run's own MCP,
|
|
3107
3424
|
under the run's tool gate: allowed, it runs at the run's tool cost; denied, the workflow is refused before any node
|
|
3108
3425
|
runs; set to ask, the `learned_workflow` call asks once, naming every such tool, and the run parks. A run's own draft
|
|
3109
3426
|
can't call one yet: the checks admitting it are coming.
|
|
3110
3427
|
|
|
3111
3428
|
The server reads the commit with git plumbing, never the working tree. What it holds that is not a regular UTF-8 file of
|
|
3112
|
-
1 MiB or less, or a
|
|
3113
|
-
run: when the folder cannot be made or read,
|
|
3429
|
+
1 MiB or less, or a workflow out of shape, is not read, and the server's stderr names it. A learning fault never blocks
|
|
3430
|
+
a run: when the folder cannot be made or read, the run starts with nothing learned. A host without
|
|
3114
3431
|
git 2.32 or later (what learning's own git calls need) is one such fault, said once on stderr.
|
|
3115
3432
|
|
|
3116
3433
|
### What a run learns
|
|
3117
3434
|
|
|
3118
|
-
When a run that learns answers or fails,
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
`
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
index past 200 lines, hidden characters, and text shaped like a secret or holding one of the server's own secrets (the
|
|
3155
|
-
launcher's, the keys and tokens in its environment, its API token, each webhook trigger's signing secret as it
|
|
3156
|
-
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
|
|
3157
|
-
learning names what was left out. The whole answer is refused when it holds a secret or a hidden character (no item of
|
|
3158
|
-
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
|
|
3159
|
-
would pass 200 lines, or when nothing is left. A `MEMORY.md` the
|
|
3160
|
-
answer gives is ignored. What passes is kept as the run's proposal, with what the user said, each message cut of the
|
|
3161
|
-
server's secrets, in the store in the same write as the run's end, beside what the turn answered. The run's end queues a
|
|
3162
|
-
learning run of its own, which no list of runs shows.
|
|
3163
|
-
|
|
3164
|
-
Then one grader decides, in that learning run: `gradePrompt` (`src/learn/grade.ts`), which holds
|
|
3165
|
-
`GRADE_RUBRIC`, the rubric's one statement, bounded (3 minutes), against `main` as it is then, and read by
|
|
3166
|
-
`parseVerdict`, which fails closed. It runs on the model the server grades on: `--grade-model` (or
|
|
3167
|
-
`AGENTRUN_SERVE_GRADE_MODEL`), else the strong tier (`AGENT_MODEL_STRONG`), named as the strong tier takes one; with
|
|
3168
|
-
neither, on the agent's own model. `GET /capabilities` names it as `learning.grade_model` (null for each run's own). A
|
|
3169
|
-
cheap model is a poor grader, so point the strong tier (or `--grade-model`) at a strong one. The grader reads each active
|
|
3170
|
-
note's index line, the whole text only of the notes the proposal supersedes, what the user said in the run (cut of the
|
|
3171
|
-
server's secrets, as the proposal keeps it), and the new notes, so its prompt stays under 200,000 characters however
|
|
3172
|
-
many notes the folder holds. The grader answers General
|
|
3173
|
-
for every item, and one it says is not general is never kept, whatever else it decides. No injection screen runs
|
|
3174
|
-
before it: a page classifier cannot see where a note came
|
|
3175
|
-
from, and read a preference the user stated as a planted instruction; the grader's Planted question decides: a rule the
|
|
3176
|
-
user states in their own words is theirs, even beside a form or a pasted email in the same message, and a rule found only
|
|
3177
|
-
inside text the run read is planted and dropped, never held for the owner's OK. An item that holds an account number is
|
|
3178
|
-
dropped too, even where the user gave it as where money goes; one with a bank account, IBAN, routing or sort-code number
|
|
3179
|
-
beside its word never reaches the grader, since the checks refuse it as they refuse a secret. The Risky question reads one way on every grade model: a
|
|
3180
|
-
limit or threshold that decides whether an approval or a check happens is risky in either direction, as is an exemption
|
|
3181
|
-
from a check, trusting or paying a named site or seller, or naming where money or data goes, whoever asked. What the
|
|
3182
|
-
grade spends is in no run's totals, and is read once its request is booked: it is kept on the run's learning, and counted once on `GET /usage` under the meter
|
|
3183
|
-
`learning`, by agent and by day; a call cut off at its bound spent what nobody knows, so its cost is unknown, never $0.
|
|
3184
|
-
A grade that contradicts itself (it keeps every item yet says not to merge) is asked once more, the contradiction named;
|
|
3185
|
-
a second contradiction drops the proposal, saying the review contradicted itself.
|
|
3186
|
-
|
|
3187
|
-
A kept verdict merges as one commit on `main`, made with plumbing: the new notes added, each with its `origin` (`you`
|
|
3188
|
-
for what the user asked in their own words, `run` for what the run worked out), each note they supersede marked
|
|
3189
|
-
`status: superseded` with `superseded_by`, `MEMORY.md` rebuilt from the active notes, and the checked-out files brought
|
|
3190
|
-
in line. A risky rule (to trust a site or a seller, skip or loosen an approval or a check, or send money or data to
|
|
3191
|
-
an account), whether the user asked for it or the run worked it out, is merged as `status: pending`: in no `MEMORY.md`
|
|
3192
|
-
and no run's copy, to wait for its owner's OK, and named on the run's learning (`pending: [{file, name}]`, detail
|
|
3193
|
-
"Waiting for your OK: <name>.", after what it learned when it kept one too).
|
|
3194
|
-
`GET /capabilities` says so (`learning.pending: true`). Its message is `learning: <run id>: merged`, the grader's reason and a `Run-Id` trailer; `main` moves only from
|
|
3195
|
-
the commit the merge was made on (once more on a `main` that moved meanwhile), and a run a trailer already names is
|
|
3196
|
-
merged, never twice. The merge's own questions are asked again of `main` first: a name another run added since is
|
|
3197
|
-
refused as `exists`. A server that goes between steps picks the run up at its next start, once.
|
|
3435
|
+
When a run that learns answers or fails, its end step (`src/runner/reflect-hook.ts`) keeps two things, one commit a
|
|
3436
|
+
round on the agent's `main`, whatever its harness:
|
|
3437
|
+
|
|
3438
|
+
- Its owner's words. A grade's words, or a message they sent after the job's first, become one line of
|
|
3439
|
+
`corrections.md`, with no model turn: `- ` and the words, whitespace folded. A line that holds one of the server's
|
|
3440
|
+
secrets, text shaped like a secret or a hidden character, or that would take the file past 2048 bytes, is refused
|
|
3441
|
+
whole, nothing of it written, and the run's learning says why (`problems`).
|
|
3442
|
+
- Its job, when a compile is due: once the agent has its `learning.compile_after` completed runs (20 by default) and no
|
|
3443
|
+
learned workflow, or once per hold of one its promotion held, the server asks the same session one more turn, under
|
|
3444
|
+
the fixed request id `learn-reflect-<run id>` and the origin `reflect`, so a server that restarts mid-turn asks again
|
|
3445
|
+
and the run takes it once. The turn (`compilePrompt`, in `src/learn/compile.ts`) gives the agent's last runs (each
|
|
3446
|
+
input, its tool calls, its answer and what the person said after it), the workflow language and one worked example,
|
|
3447
|
+
and asks for the whole job as one workflow draft. The draft is checked in code and dry-run; what the checks refuse
|
|
3448
|
+
goes back to the model, as data, up to 3 times. A draft that passes is committed directly, with no grader: its
|
|
3449
|
+
promotion check (below) decides whether it serves. A compile whose drafts all failed is recorded as the compile's
|
|
3450
|
+
attempt (compile once), and its errors are on the run's learning (`draft_errors`), never silent.
|
|
3451
|
+
[`src/learn/SPEC.md`](src/learn/SPEC.md) has the rules.
|
|
3452
|
+
|
|
3453
|
+
The turn runs under the run's own cap, with no reserve, and within 10 minutes; its rows are labelled `learning`, and the
|
|
3454
|
+
run's answer stays the job's. While it runs, the run reads `reflecting` on every harness. A run with no words from its
|
|
3455
|
+
owner and no compile due spends nothing on learning, and its learning ends `dropped` (`empty`). A run whose only tool
|
|
3456
|
+
work was its learned workflows, each answering, with nothing said after its first message and no compile due, ends
|
|
3457
|
+
`dropped` (`empty`) too: "Nothing new: the run only ran a learned workflow."
|
|
3458
|
+
|
|
3459
|
+
The round's commit is made with plumbing: the passing draft's files added or changed (its `README.md` with
|
|
3460
|
+
`status: pending` when a step calls a tool with no price, to wait for its owner's OK) and the owner's line appended to
|
|
3461
|
+
`corrections.md`. Its message is `learning: <run id>: merged`, the reason and a `Run-Id` trailer; `main` moves only from
|
|
3462
|
+
the commit the change was made on (once more on a `main` that moved meanwhile), and a run a trailer already names is
|
|
3463
|
+
merged, never twice. A draft file that is not on `main` as it was on the run's seed is a conflict, never written over.
|
|
3464
|
+
|
|
3465
|
+
A new workflow revision serves only once its promotion check passes: the first run that lays it replays it on the
|
|
3466
|
+
inputs of the agent's last `compile_after` completed runs, one replay run each at workflow cost, and scores each against
|
|
3467
|
+
the agent's own recorded answer. It is promoted when it agrees on at least `learning.agree_min` (0.8) of them and
|
|
3468
|
+
answers at least `learning.alone_min` (0.7) alone; under either bar it is held, and the next run asks one revision with
|
|
3469
|
+
the inputs it disagreed on. Held again, it stops, and nothing compiles again until its owner acts. A promotion by
|
|
3470
|
+
check is never moved by grades. `GET /agents/{agent_id}/learning/promotions` reads every record.
|
|
3198
3471
|
|
|
3199
3472
|
The run's `learning` (on `GET /runs/{run_id}`, and `{state, reason, detail}` in run lists, the detail cut to 140
|
|
3200
|
-
characters and no time) says how it went: `seeded`, then
|
|
3201
|
-
|
|
3202
|
-
`
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
Four more fields say what the run was given, read, learned and holds for the owner's OK (`learning/2`), on its read and
|
|
3218
|
-
in run lists alike, each absent when it holds no note: `given`, `[{file, name}]`, the notes it started with (each its
|
|
3219
|
-
`# Learned` section names, whole or as an index line naming its file, as it was seeded; absent when it started with
|
|
3220
|
-
nothing learned); `read`, `[{file, name}]`, the notes its job read from `.learning/` (absent when it opened no note file),
|
|
3221
|
-
found once as the run settles from its timeline (each `read` call on any harness whose result was a success, of a note
|
|
3222
|
-
the run started from: never `MEMORY.md`, nor a read its end-of-run turn made, nor a note read through a command such as
|
|
3223
|
-
`bash`'s `cat`) and kept in `serve.json`, so a list never reads a timeline; `learned`, `[{file, name, supersedes}]`, the
|
|
3224
|
-
notes its merge added, once `merged`; and `pending`, `[{file, name}]`, the notes its merge holds for the owner's OK, once
|
|
3225
|
-
`merged`, never among `learned`. A name and a file are cut of the server's secrets as they are now, a file holding one
|
|
3226
|
-
`[redacted]`. Whether a run applied a note is not measured: `given` and `read` say what it had and what it opened. Each
|
|
3227
|
-
note on the agent's learning view and notes page counts its runs of each, `runs: {given, read}`, over the runs the server
|
|
3228
|
-
knows, read from the store.
|
|
3229
|
-
|
|
3230
|
-
`GET /stats` counts the runs that tried to learn under `learning`, over its `from`, `to` and
|
|
3231
|
-
`agent`, from the store (each run's kept learning and its learning run's journal; `in_progress` while a proposal waits
|
|
3232
|
-
for its grade), never opening a run's files; the `learning` meter on `GET /usage` reads each run's grade from the same.
|
|
3233
|
-
|
|
3234
|
-
An eval set of 20 runs and what each proposed, labelled keep or drop (`test/fixtures/learn-eval.json`: lessons the
|
|
3235
|
-
agent worked out, user preferences and a "remember" during the task, one-shop facts, secrets, a tool's failure and four
|
|
3236
|
-
injections), runs in CI through the parser, the checks and the grader's prompt on a faux grader that answers by label
|
|
3237
|
-
(`test/learn-eval.test.mjs`). `scripts/learn-eval.mjs` runs the same set on real models, the grade and the end-of-run
|
|
3238
|
-
turn both, and prints keep-precision, keep-recall and the injection-drop rate per model; it spends. It grades on several
|
|
3239
|
-
models at once (`--grade-models A,B,C`, with how often they agree, note by note), reads the held-out set with
|
|
3240
|
-
`--set heldout`, and lists its plan without calling a model with `--dry`.
|
|
3473
|
+
characters and no time) says how it went: `seeded`, then `reflecting` during its end step, and `merged`, or `dropped`
|
|
3474
|
+
with a reason from a closed list (`seed_failed`, `no_budget`, `unknown_cost`, `cancelled`, `crashed`, `reflect_failed`,
|
|
3475
|
+
`empty`, `checker`, `use`; a run record with any other reason is not counted). It is `null` for a run that does not
|
|
3476
|
+
learn (its agent's `learning` is not true, the server's switch was off when it started, or it is a workflow's or an
|
|
3477
|
+
imported run). Its `detail` says the same in a person's words, never the machine's: "Started from 2 corrections.",
|
|
3478
|
+
"Keeping what this run learned…", "Learned the workflow sort-invoice. Kept your correction.", "Nothing new to keep from
|
|
3479
|
+
this run.", "Not kept: it held something that must not be stored (one of this server's secrets).", "Not kept: learning
|
|
3480
|
+
stopped (…)." and so on (`learning-words.ts`); a client that acts on it reads `state` and `reason`. A workflow's name in
|
|
3481
|
+
it is said again at each read from what the run keeps, cut of the server's secrets as they are then before the words
|
|
3482
|
+
are cut short (300 characters, 140 in a list), so a value that became a secret after the run is never shown in part.
|
|
3483
|
+
Once it is merged or dropped (`seed_failed` included), the run's timeline has one row of kind `learning` whose summary
|
|
3484
|
+
is that detail. Its read also says how many lines its merge added to `corrections.md` (`corrections`) and the workflow
|
|
3485
|
+
it wrote (`workflows`, each `pending` while it waits for the owner's OK).
|
|
3486
|
+
|
|
3487
|
+
`GET /stats` counts the runs that tried to learn under `learning`, over its `from`, `to` and `agent`, from the store
|
|
3488
|
+
(each run's kept learning; `in_progress` while its end step runs), never opening a run's files.
|
|
3241
3489
|
|
|
3242
3490
|
The learning bench, `node scripts/learn-bench.mjs`, runs repeated jobs with learning off and on, on pi and
|
|
3243
3491
|
claude-agent, and reports the follow rate on repeat steps, the work cost per run and its trend, how often workflows are
|
|
@@ -3246,99 +3494,75 @@ proposed and reused, staleness after a rule changes, and wrong keeps after a pla
|
|
|
3246
3494
|
|
|
3247
3495
|
### Coming
|
|
3248
3496
|
|
|
3249
|
-
- One copy of each rule: a note that repeats an active note's rule is a duplicate, and a skill re-filed as a note retires the old skill (#2256).
|
|
3250
|
-
- A learned workflow may hold decision nodes (judge, pick, sift), answered by the run's decision provider under the run's cap (#2363).
|
|
3251
|
-
- Consolidation: related notes merged into one, and a skill and its workflow brought back in step (#2335).
|
|
3252
3497
|
- A learned workflow's node of a tier runs on the server's model of that tier, at its own price (#2408).
|
|
3253
|
-
- A run's workflow draft may call a granted MCP tool: the checks admit it, and
|
|
3254
|
-
- A learned workflow keeps the output format its skill asks for (#2412).
|
|
3498
|
+
- A run's workflow draft may call a granted MCP tool: the checks admit it, and one that writes waits for the owner's OK.
|
|
3255
3499
|
|
|
3256
3500
|
### What a person sees and controls
|
|
3257
3501
|
|
|
3258
3502
|
A person reads and changes an agent's learning through this server's own routes (`learning/1` in `/v2/openapi.json`),
|
|
3259
3503
|
with the token, an archived agent's too:
|
|
3260
3504
|
|
|
3261
|
-
- `GET /agents/{agent_id}/learning`: `main`'s head, `
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
time; a cursor reads the same commit its first page
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
`
|
|
3277
|
-
or
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
`
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
- `
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
values, hidden characters, its format, and every file of a skill's or a draft's folder): a refusal is 400 with
|
|
3296
|
-
`problems`, and the item stays retired. Only a retired item is restored (else 400). It takes the owner's password
|
|
3297
|
-
session alone, as an approval does; one that waited for its owner's OK before its retire is recorded as their approval
|
|
3298
|
-
too (`Approved-Via: console`). The learning view gives each item `last_change` (`{kind, by, at}`: `approved`,
|
|
3299
|
-
`edited`, `created`, `retired` or `restored` by a `person`, or `learned` by a `run`) and each retired one `retired`
|
|
3300
|
-
(`{at, by}`, the time of its retire, which an edit since moves not).
|
|
3301
|
-
- `POST .../learning/workflows/{name}/promote` (`{name?}`) makes an active learned workflow an agent of its own: a new
|
|
3302
|
-
agent, as `POST /agents` makes one, whose revision is a workflow revision of the workflow's `workflow.json`, so its
|
|
3303
|
-
runs run the workflow's nodes with no agent loop, answer the workflow's output, and can be started by a trigger or a
|
|
3304
|
-
pipeline like any agent's. Only an active one: a workflow that waits for its owner's OK, or was retired, is 409
|
|
3305
|
-
`learned_not_active`. Its files are checked again as a restore checks them, and its workflow as the learning checker
|
|
3306
|
-
checks a run's draft against the agent's tools and gate (400 with `problems`), then as any workflow revision's save
|
|
3307
|
-
(422, or 409 `agent_not_runnable`). The new agent's `tools` are the ones its call nodes call, and it keeps the source
|
|
3308
|
-
agent's policy as it is now (its `tool_settings`, `approvals` and `max_cost_usd`), never more. Its id is the
|
|
3309
|
-
workflow's name, with `-2`, `-3` and on past an agent's id or name already here, and its name `name` or the same. It
|
|
3310
|
-
answers 201 with the agent; the learned workflow stays in the folder, unchanged. It takes the owner's password session
|
|
3311
|
-
alone, as an approval does.
|
|
3312
|
-
- `GET /runs/{run_id}/learning`: the run's learning whole (its `given`, `read` and `learned` as on its read, its seed, its merge, the grader's verdict with its item for
|
|
3313
|
-
each new note, `{file, keep, question, why}`, `question` the rubric's question a dropped note failed, the checker's
|
|
3314
|
-
problems, what the grade cost), `null` for a run that does not learn; `verdict` is `null` until a grade ran.
|
|
3315
|
-
`GET /runs/{run_id}/learning/diff`: a merged run's merge commit against its parent, else its proposal against its
|
|
3316
|
-
seed, each file's patch as git writes it from the first `@@`, or `withheld` (`too_large`, `secret`).
|
|
3505
|
+
- `GET /agents/{agent_id}/learning`: `main`'s head, `corrections.md` as `corrections`, the learned workflows (each its
|
|
3506
|
+
name, files, description, status and `etag`; `status` is one word: `pending` or `retired` as its `README.md` says,
|
|
3507
|
+
else where it stands as `.../learning/promotions` says it: `serving`, `checking`, `held` or `stopped`, a champion
|
|
3508
|
+
the cost rule stopped included), the first 20 changes on `main` (newest first, each `by: {run}` from its
|
|
3509
|
+
`Run-Id` trailer or `{user: true}`, with its commit, time, reason and files), how the agent's runs that tried to learn
|
|
3510
|
+
fared (`merged`, `dropped` by reason, `in_progress`), counted as `GET /stats` counts them, and `impact`, what
|
|
3511
|
+
learning changed: the agent's completed runs that started from at least one learned item (a correction, or a learned
|
|
3512
|
+
workflow) against those that started before its first, each side's `runs`; `median_duration_s`, the time to the
|
|
3513
|
+
answer (the run's start to its job's end, before its end-of-run step). What a run costs, learning included, and what
|
|
3514
|
+
learning itself cost are `.../learning/cost`'s (`summary.before`/`after`, the bill's `learning_usd`).
|
|
3515
|
+
Null unless both sides count 2 runs. An agent with no folder answers `main: null`, empty lists and `impact: null`.
|
|
3516
|
+
`GET .../learning/log?cursor=&limit=` pages on, up to 200 at a time; a cursor reads the same commit its first page
|
|
3517
|
+
did.
|
|
3518
|
+
- `GET .../learning/corrections`: `corrections.md` on `main` as `{text, etag, cap_bytes}` (empty text when there is
|
|
3519
|
+
none). `PUT .../learning/corrections` with `{text}` replaces it whole under `If-Match: <etag>`: a stale ETag is 412,
|
|
3520
|
+
none (or `If-Match: *`) 428 `precondition_required`. A text that holds one of the server's secrets, a secret's shape or
|
|
3521
|
+
a hidden character, or passes 2048 bytes, is 422 with the problems, and nothing is written. A text read cut of a
|
|
3522
|
+
secret and sent back keeps the cut: a person's write never puts a secret back. One commit on `main` in the agent's
|
|
3523
|
+
queue, `learning: edited by a person: corrections.md` with a `Changed-By: user` trailer.
|
|
3524
|
+
- `GET .../learning/files/{file}`: `corrections.md` or a workflow's file on `main`, with its `ETag`, the file's git blob
|
|
3525
|
+
id. `POST .../learning/files/{file}/retire` under `If-Match`, on a workflow's `README.md`, sets `status: retired`: no
|
|
3526
|
+
later run is given it. `POST .../learning/files/{file}/approve` makes a pending workflow active (see
|
|
3527
|
+
[Approving a workflow that waits](#approving-a-workflow-that-waits), below). `POST .../learning/files/{file}/restore`
|
|
3528
|
+
under `If-Match` gives a retired workflow to every later run again, after checking its files again as a run's draft
|
|
3529
|
+
is checked (a refusal is 400 with `problems`, and it stays retired); it takes the owner's password session alone, as
|
|
3530
|
+
an approval does. The learning view gives each workflow `last_change` (`{kind, by, at}`: `approved`, `edited`,
|
|
3531
|
+
`created`, `retired` or `restored` by a `person`, or `learned` by a `run`) and each retired one `retired` (`{at, by}`).
|
|
3532
|
+
- `GET .../learning/workflows/{name}/revisions` lists a learned workflow's revisions on `main`;
|
|
3533
|
+
`GET .../learning/promotions` its promotion records; `GET .../learning/loop` each compile turn; and
|
|
3534
|
+
`GET .../learning/cost` the agent's cost per run, run after run.
|
|
3535
|
+
- `GET /runs/{run_id}/learning`: the run's learning whole (its seed, its merge, the corrections it added, the workflow it
|
|
3536
|
+
wrote, its compile turn's attempts and the checks' problems), `null` for a run that does not learn.
|
|
3537
|
+
`GET /runs/{run_id}/learning/diff`: a merged run's merge commit against its parent, each file's patch as git writes it
|
|
3538
|
+
from the first `@@`, or `withheld` (`too_large`, `secret`).
|
|
3317
3539
|
|
|
3318
3540
|
Every read is the folder's snapshot (`.agentrun/snapshot.json`, written last by the same exec as each commit to
|
|
3319
3541
|
`main`), the files it names, each checked against its blob id (a file that is not, read twice, is a write in flight:
|
|
3320
3542
|
`503`), and a merge's `.agentrun/diffs/<run>.json`, through the folder's file API: no git and no exec. Every text it
|
|
3321
|
-
answers is cut of the server's secrets as they are then; a file name holding one (a
|
|
3322
|
-
`[redacted]` whole, in the
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
Every write to `main` (a run's merge, a person's edit, create, retire, approve or restore) is one exec of the learning
|
|
3543
|
+
answers is cut of the server's secrets as they are then; a file name holding one (a workflow named after a value made
|
|
3544
|
+
secret since, say) reads `[redacted]` whole, in the workflows, the log's `files` and a diff's `path`, while its route
|
|
3545
|
+
still answers the real name to a caller who knows it. A log page reads the snapshot alone (it keeps the newest 200
|
|
3546
|
+
changes). A cursor reads at the main it names while this server still holds that snapshot, else as the first page of
|
|
3547
|
+
`main` now. Every write to `main` (a run's merge, a person's corrections, retire, approve or restore) is one exec of the learning
|
|
3327
3548
|
script, a compare and swap on `main`. A symbolic link at the agent's home, its learning folder or the folder's `.git` is never
|
|
3328
3549
|
followed: a read or a write there answers `500`, and nothing is written.
|
|
3329
3550
|
|
|
3330
|
-
### Approving a
|
|
3551
|
+
### Approving a workflow that waits
|
|
3552
|
+
|
|
3553
|
+
A learned workflow whose step calls a tool with no price is committed with `status: pending` in its `README.md` and
|
|
3554
|
+
given to no run until its owner approves it.
|
|
3331
3555
|
|
|
3332
|
-
Who can approve: the owner, signed in with their password. No token approves, the server's own included, so a run that reaches this server only through its API (its MCP tools, a sandbox run) can't approve its own
|
|
3556
|
+
Who can approve: the owner, signed in with their password. No token approves, the server's own included, so a run that reaches this server only through its API (its MCP tools, a sandbox run) can't approve its own workflows. Runs that use bash on the host run as you: they can read this server's files, its session key among them, so no route keeps them from approving. For untrusted tasks, use the sandbox.
|
|
3333
3557
|
|
|
3334
3558
|
`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
|
|
3335
3559
|
a JSON body as every page write is. Any token is 403: the server's own (what scripts and the MCP endpoint's tools
|
|
3336
3560
|
carry) and a token sent beside the session. So is every request on a server with accounts off
|
|
3337
3561
|
(`AGENTRUN_ACCOUNTS=0`), which has no password session: its console session comes from the launch code, never the token. With no credential it is 401, as every route.
|
|
3338
3562
|
`capabilities.learning.approve` is true only for the owner's session; every other caller reads `approve: false` with
|
|
3339
|
-
`approve_needs: "password"`. A
|
|
3340
|
-
commit, `learning: approved by a person: <file>`, with the trailers `Changed-By: user` and `Approved-Via: console`;
|
|
3341
|
-
log shows `by: {user: true, via: "console"}` at the commit's time
|
|
3563
|
+
`approve_needs: "password"`. A workflow that is not pending is 400; a stale ETag is 412, none 428. The approval is one
|
|
3564
|
+
host commit, `learning: approved by a person: <file>`, with the trailers `Changed-By: user` and `Approved-Via: console`;
|
|
3565
|
+
the log shows `by: {user: true, via: "console"}` at the commit's time.
|
|
3342
3566
|
|
|
3343
3567
|
## Spend cap
|
|
3344
3568
|
|
|
@@ -3755,8 +3979,44 @@ carries no cost at all, as from a provider that does not price the model. The te
|
|
|
3755
3979
|
temporary directory the run's environment made for a tool (`createTempDir`). Every other path, a link inside `work/`
|
|
3756
3980
|
included, is resolved and refused (`outside the workspace`), so a run reads neither the server's token,
|
|
3757
3981
|
`store.sqlite`, another run's files (its `work/` or its `tmp/`) nor `/proc`, and writes nowhere else. This is the
|
|
3758
|
-
Workspace's confinement inside the
|
|
3759
|
-
|
|
3982
|
+
Workspace's confinement inside the run's process; in the image the operating system holds the same line (below).
|
|
3983
|
+
- Each run is a process of its own, started by its runner at the claim. It is handed its own keys on a pipe (read and
|
|
3984
|
+
closed as it loads) and a channel to its runner, over which it reads and writes what its loop needs: its journal,
|
|
3985
|
+
under the runner's fence, and the store's rows of its own run and agent, each call checked against its claim (another
|
|
3986
|
+
run's journal or row, another agent's revision, and any call off the list are refused). What the seal key opens for
|
|
3987
|
+
the run, the runner opens and hands over; the seal key, the API token and the store's URL stay in the runner. A frame
|
|
3988
|
+
on the channel past 32 MiB, or one that is no message of it, fails the run. The runner keeps the claim and its end: at
|
|
3989
|
+
the end, or on a stop the run does not take in its grace, the run's process group is killed (in the image, every
|
|
3990
|
+
process of its uid).
|
|
3991
|
+
- In the image, each run's process also runs as a user of its own: slot `s` of its runner is uid and gid `1001 + s`
|
|
3992
|
+
(256 slots), started through `agentrun-runas`, a helper installed root:node `0750` with the file capabilities
|
|
3993
|
+
`cap_setuid`, `cap_setgid` and `cap_setpcap`. The helper reaches only that range and refuses uid and gid 0; it sets
|
|
3994
|
+
the run's uid, gid and groups (its slot's group alone: not node's, not the Docker socket's group compose gives the
|
|
3995
|
+
server), empties every capability set, sets `no_new_privs` and keeps only the run's two descriptors open. So one run
|
|
3996
|
+
reads neither another live run's folder nor its process's memory, environment or descriptors, and none reads the data
|
|
3997
|
+
directory (`0711`: crossed to its own folders, never listed), the store's files (`0600`), the seal key or the
|
|
3998
|
+
server's memory. A run's folders are its slot group's (`2770`), which the server's user is in. At the run's end every
|
|
3999
|
+
process of its uid is killed, one in a session of its own included, its files in `/tmp`, `/var/tmp`, `/dev/shm`,
|
|
4000
|
+
`/run/lock` (`/var/lock`) and `/dev/mqueue` are removed, and its folders go back to the server's group, which the
|
|
4001
|
+
slot's next run cannot enter. SysV IPC objects (`ipcs`) a run leaves are not removed.
|
|
4002
|
+
`GET /v2/capabilities` says `run_isolation: "uid"`.
|
|
4003
|
+
- A platform that strips the image's file capabilities, or starts it with `no-new-privileges` (Docker's
|
|
4004
|
+
`security_opt: no-new-privileges:true`, Kubernetes' `allowPrivilegeEscalation: false`), leaves the helper unable to
|
|
4005
|
+
switch: the runner then refuses to claim, saying so and naming the setting. `AGENTRUN_RUN_USER=same` runs every run as
|
|
4006
|
+
the runner's own user instead, still each in a process of its own, said on the runner's log at its start. Runners in
|
|
4007
|
+
containers of their own on one `/data` volume each take slots from an `AGENTRUN_RUN_SLOT_FIRST` of their own
|
|
4008
|
+
(`deploy/compose.yaml`: 0 and 128). A runner told to hold more runs (`--loops`, `AGENTRUN_MAX_RUNS`) than the slots
|
|
4009
|
+
from its first to the last (255) refuses to start, in words; with no number told, it holds those slots. Each run's
|
|
4010
|
+
slot is also locked on the volume (`/data/run-slots`, util-linux `flock`) from before its run starts until after its
|
|
4011
|
+
reap, so runners whose ranges overlap never run two runs as one user: a slot another runner holds is skipped, and a
|
|
4012
|
+
run that finds every free slot held is handed back unstarted, said on the runner's log.
|
|
4013
|
+
- A local install (`npx`, `node dist/cli.js`) has no helper: each run is a process of its own as the user who started
|
|
4014
|
+
the server, and `run_isolation` is `"process"`. Its runs, and a program one starts, can read what that user reads,
|
|
4015
|
+
another run's folder and the data directory included, as before; keep a local server to agents you trust as you trust
|
|
4016
|
+
that user.
|
|
4017
|
+
- A host that starts the server as root could run each run's process as a user of its own with no file capability: a
|
|
4018
|
+
small spawner, kept as root, that starts the server as an unprivileged user and each run as its slot's uid. The image
|
|
4019
|
+
does not ship one: it never runs anything as root, so it needs the helper's capabilities or `AGENTRUN_RUN_USER=same`.
|
|
3760
4020
|
- No path offers a shell on this machine. On the runner `bash` is not bound: a definition that names it is not saved
|
|
3761
4021
|
here (`422`), one saved before that check is not runnable (`409`), and a model that calls it anyway, as an agent or as
|
|
3762
4022
|
a workflow's model node, is answered that the tool is not available and runs nothing. In a [sandbox](#sandbox) it runs
|