@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.48
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 +211 -1
- package/NOTICE +4 -0
- package/README.md +350 -53
- package/dist/acp-package.d.ts +53 -6
- package/dist/acp-package.js +3 -3
- package/dist/adapter-facts.d.ts +3 -4
- package/dist/adapter-facts.js +4 -4
- package/dist/adapters.d.ts +3 -5
- package/dist/adapters.js +1 -31
- package/dist/agents-store.d.ts +5 -3
- package/dist/agents-store.js +13 -8
- package/dist/answer-json.d.ts +10 -0
- package/dist/answer-json.js +24 -0
- package/dist/api-only.d.ts +11 -11
- package/dist/api-only.js +16 -11
- package/dist/archil-routes.js +2 -1
- package/dist/browser-live.d.ts +9 -4
- package/dist/browser-live.js +18 -5
- package/dist/cap.js +10 -2
- package/dist/chatgpt-plan.js +2 -1
- package/dist/cli.js +109 -41
- package/dist/composio-made.d.ts +19 -2
- package/dist/composio-made.js +17 -5
- package/dist/composio-preset.d.ts +42 -7
- package/dist/composio-preset.js +106 -70
- package/dist/composio-triggers.d.ts +9 -4
- package/dist/composio-triggers.js +20 -13
- package/dist/computer-attach.d.ts +11 -10
- package/dist/computer-attach.js +13 -14
- package/dist/computer-commands.d.ts +3 -0
- package/dist/computer-commands.js +3 -2
- package/dist/computer-lost.d.ts +4 -0
- package/dist/computer-lost.js +8 -3
- package/dist/computer-routes.d.ts +8 -5
- package/dist/computer-routes.js +7 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +2 -0
- package/dist/computers.d.ts +14 -76
- package/dist/computers.js +24 -68
- package/dist/conformance.d.ts +4 -0
- package/dist/conformance.js +6 -0
- package/dist/console/assets/index-CTGegcKt.css +1 -0
- package/dist/console/assets/index-D1Se6mgG.js +715 -0
- package/dist/console/index.html +2 -2
- package/dist/cost-heal.d.ts +13 -0
- package/dist/cost-heal.js +27 -0
- package/dist/dial-relay.d.ts +6 -2
- package/dist/dial-relay.js +9 -12
- package/dist/email/routes.js +2 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +5 -0
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/faux-computers.d.ts +2 -3
- package/dist/faux-computers.js +9 -31
- package/dist/github-connection.js +2 -1
- package/dist/harness-archive.d.ts +19 -2
- package/dist/harness-archive.js +49 -15
- package/dist/harness-check.d.ts +75 -0
- package/dist/harness-check.js +518 -0
- package/dist/harness-cursor.d.ts +28 -0
- package/dist/harness-cursor.js +42 -0
- package/dist/harness-goose.d.ts +4 -29
- package/dist/harness-goose.js +6 -86
- package/dist/harness-module.d.ts +4 -0
- package/dist/harness-module.js +1 -0
- package/dist/harness-owned.d.ts +52 -0
- package/dist/harness-owned.js +92 -0
- package/dist/harness-recipe.d.ts +127 -0
- package/dist/harness-recipe.js +335 -0
- package/dist/harness-table.d.ts +120 -5
- package/dist/harness-table.js +280 -6
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +5 -4
- package/dist/host-check.d.ts +6 -0
- package/dist/host-check.js +14 -0
- package/dist/host.d.ts +10 -3
- package/dist/host.js +17 -3
- package/dist/import-sources.d.ts +2 -0
- package/dist/import-sources.js +2 -0
- package/dist/import-summary.d.ts +15 -5
- package/dist/import-summary.js +24 -8
- package/dist/import.d.ts +24 -4
- package/dist/import.js +108 -26
- package/dist/key-refusal.d.ts +3 -1
- package/dist/key-refusal.js +26 -5
- package/dist/key-words.d.ts +1 -1
- package/dist/key-words.js +4 -4
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +31 -20
- package/dist/learn/compile.js +12 -5
- package/dist/learn/promote.d.ts +80 -2
- package/dist/learn/promote.js +95 -3
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +23 -0
- package/dist/learned-nodes.d.ts +4 -3
- package/dist/learned-workflow.js +4 -1
- package/dist/learning-cost.d.ts +6 -16
- package/dist/learning-cost.js +6 -12
- package/dist/learning-model.d.ts +18 -0
- package/dist/learning-model.js +77 -0
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +1 -1
- package/dist/listen-first.d.ts +10 -0
- package/dist/listen-first.js +25 -1
- package/dist/llms.txt +2 -1
- package/dist/mcp-gateway.d.ts +2 -1
- package/dist/mcp-gateway.js +31 -15
- package/dist/mcp-probe.d.ts +18 -6
- package/dist/mcp-probe.js +41 -8
- package/dist/mcp-secret-writes.d.ts +8 -0
- package/dist/mcp-secret-writes.js +104 -4
- package/dist/mcp-servers-store.d.ts +11 -5
- package/dist/mcp-servers-store.js +46 -20
- package/dist/model-form.d.ts +2 -1
- package/dist/model-form.js +30 -16
- package/dist/model-gateway.d.ts +113 -0
- package/dist/model-gateway.js +433 -0
- package/dist/model.d.ts +5 -3
- package/dist/model.js +26 -18
- package/dist/monid.js +1 -1
- package/dist/native/binding.d.ts +4 -0
- package/dist/native/binding.js +9 -0
- package/dist/native/cli.d.ts +3 -2
- package/dist/native/cli.js +6 -5
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +356 -43
- package/dist/owner.d.ts +4 -2
- package/dist/owner.js +10 -4
- package/dist/page.d.ts +9 -0
- package/dist/page.js +10 -2
- package/dist/port-models.js +17 -10
- package/dist/provider.d.ts +3 -3
- package/dist/provider.js +12 -3
- package/dist/public-address.d.ts +28 -0
- package/dist/public-address.js +62 -0
- package/dist/run-launch.d.ts +1 -1
- package/dist/run-launch.js +1 -1
- package/dist/run-secrets.d.ts +3 -2
- package/dist/run-secrets.js +7 -4
- package/dist/run-trace.js +6 -3
- package/dist/runner/adapter-loop.d.ts +14 -8
- package/dist/runner/adapter-loop.js +58 -24
- package/dist/runner/adapter-run-spec.d.ts +15 -2
- package/dist/runner/adapter-run-spec.js +48 -10
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +6 -26
- package/dist/runner/adapters/pi.d.ts +5 -2
- package/dist/runner/adapters/pi.js +7 -4
- package/dist/runner/audit.d.ts +7 -0
- package/dist/runner/audit.js +15 -6
- package/dist/runner/claim-secrets.js +5 -1
- package/dist/runner/cli-run-spec.js +22 -10
- package/dist/runner/compare-end.d.ts +43 -0
- package/dist/runner/compare-end.js +95 -0
- package/dist/runner/computer-journal.d.ts +3 -0
- package/dist/runner/computer-journal.js +22 -2
- package/dist/runner/conformance/host-tools.d.ts +4 -0
- package/dist/runner/conformance/host-tools.js +14 -0
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +94 -54
- package/dist/runner/held.d.ts +5 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +3 -0
- package/dist/runner/loop-contract.d.ts +10 -0
- package/dist/runner/main.d.ts +5 -5
- package/dist/runner/main.js +62 -11
- package/dist/runner/mcp-claim.js +40 -12
- package/dist/runner/meta-tools.js +4 -2
- package/dist/runner/metrics.d.ts +26 -0
- package/dist/runner/metrics.js +44 -1
- package/dist/runner/presence.d.ts +44 -0
- package/dist/runner/presence.js +96 -0
- package/dist/runner/promotion.d.ts +70 -7
- package/dist/runner/promotion.js +178 -28
- package/dist/runner/run-child-host.js +40 -10
- package/dist/runner/runner.d.ts +5 -0
- package/dist/runner/runner.js +8 -0
- package/dist/runner/sdk-loop.js +25 -1
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +19 -7
- package/dist/runner/workflow-first.d.ts +5 -2
- package/dist/runner/workflow-first.js +6 -3
- package/dist/runner/workflow-spec.js +3 -2
- package/dist/runs-over-store.d.ts +7 -2
- package/dist/runs-over-store.js +12 -4
- package/dist/sdk/check.d.ts +31 -0
- package/dist/sdk/check.js +58 -0
- package/dist/sdk/runs.d.ts +11 -3
- package/dist/sdk/runs.js +90 -15
- package/dist/sdk/schema.js +12 -4
- package/dist/secret-writes.d.ts +16 -3
- package/dist/secret-writes.js +28 -3
- package/dist/server-secrets-store.js +5 -0
- package/dist/server.d.ts +34 -2
- package/dist/server.js +437 -90
- package/dist/sign-ins-secrets.js +4 -1
- package/dist/skills/agentrun-serve/SKILL.md +11 -0
- package/dist/slack-url.d.ts +5 -0
- package/dist/slack-url.js +11 -0
- package/dist/slack.d.ts +107 -0
- package/dist/slack.js +292 -0
- package/dist/start-switches.d.ts +28 -0
- package/dist/start-switches.js +37 -0
- package/dist/stats.d.ts +1 -1
- package/dist/stats.js +2 -1
- package/dist/stop-signals.d.ts +11 -0
- package/dist/stop-signals.js +22 -0
- package/dist/store/agent-body.d.ts +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0020_runners.sql +18 -0
- package/dist/store/postgres/store.d.ts +1 -1
- package/dist/store/postgres/store.js +4 -2
- package/dist/store/schema.d.ts +13 -5
- package/dist/store/schema.js +20 -11
- package/dist/store/seal.d.ts +16 -4
- package/dist/store/sqlite/store.d.ts +1 -1
- package/dist/store/sqlite/store.js +112 -28
- package/dist/store/store.d.ts +78 -24
- package/dist/store/store.js +11 -0
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +7 -0
- package/dist/store-reads/cap.js +11 -1
- package/dist/store-reads/journal.js +27 -1
- package/dist/store-reads/learning.d.ts +23 -2
- package/dist/store-reads/learning.js +29 -8
- package/dist/store-reads/runs.d.ts +9 -0
- package/dist/store-reads/runs.js +19 -6
- package/dist/store-reads/stats.d.ts +4 -1
- package/dist/store-reads/stats.js +15 -6
- package/dist/store-view.d.ts +125 -14
- package/dist/store-view.js +156 -21
- package/dist/telemetry.d.ts +7 -7
- package/dist/telemetry.js +38 -15
- package/dist/template-eval.js +5 -2
- package/dist/template-github-permissions.d.ts +5 -1
- package/dist/template-github-permissions.js +7 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +8 -0
- package/dist/timeline/timeline.js +30 -0
- package/dist/tool-gate.d.ts +8 -4
- package/dist/tool-gate.js +6 -7
- package/dist/tool-keys-store.js +2 -2
- package/dist/tool-keys.js +2 -1
- package/dist/tool-plane.d.ts +4 -0
- package/dist/tool-plane.js +12 -12
- package/dist/trigger-adapter.d.ts +3 -4
- package/dist/trigger-adapter.js +2 -2
- package/dist/trigger-composio.js +3 -3
- package/dist/trigger-email.js +0 -2
- package/dist/trigger-feed.js +0 -2
- package/dist/trigger-schedule.js +3 -0
- package/dist/trigger-secrets-shown.d.ts +6 -3
- package/dist/trigger-secrets-shown.js +22 -13
- package/dist/trigger-targets.d.ts +12 -3
- package/dist/trigger-targets.js +90 -10
- package/dist/triggers.d.ts +2 -2
- package/dist/validate.js +5 -1
- package/dist/viewer-credential.d.ts +25 -0
- package/dist/viewer-credential.js +51 -0
- package/dist/webhooks.d.ts +82 -8
- package/dist/webhooks.js +128 -45
- package/dist/wires.d.ts +6 -1
- package/dist/wires.js +5 -0
- package/dist/workspace/attach.d.ts +3 -2
- package/dist/workspace/attach.js +2 -1
- package/dist/workspace/attached-computers.d.ts +6 -8
- package/dist/workspace/attached-computers.js +27 -24
- package/dist/workspace/computer-deps.d.ts +2 -3
- package/dist/workspace/computer-deps.js +3 -6
- package/dist/workspace/computer-for-claim.js +72 -96
- package/dist/workspace/computer-kept.d.ts +0 -7
- package/dist/workspace/computer-kept.js +0 -17
- package/dist/workspace/resolve-computer.d.ts +23 -14
- package/dist/workspace/resolve-computer.js +66 -61
- package/dist/workspace/synced-folder.d.ts +20 -15
- package/dist/workspace/synced-folder.js +33 -43
- package/launcher/agentrun-serve +4 -1
- package/package.json +18 -10
- package/skills/agentrun-serve/SKILL.md +11 -0
- package/templates/README.md +1 -1
- package/templates/code-review/agent.md +2 -3
- package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
- package/templates/code-review/evals/other-repo/case.yaml +0 -1
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
- package/dist/console/assets/index-C2MYaUBa.css +0 -1
- package/dist/console/assets/index-CZZeCReB.js +0 -701
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ An edit is a new revision: `PUT $AGENTRUN_BASE_URL/agents/calc/definition` with
|
|
|
81
81
|
| `--data DIR` | `~/.local/share/agentrun/agents` | The agent store (`DIR/store.sqlite`) and its runs (`DIR/disk/agents/<agent>/runs/<id>/`). The token is `DIR/.token`, mode 0600, made once and kept, unless `AGENTRUN_TOKEN` gives it: then a `DIR/.token` from an earlier start is removed. |
|
|
82
82
|
| `--listen ADDR` | `127.0.0.1` | The address to listen on. On any other, every `Host` name is served and the token is the only lock: put TLS in front of it. |
|
|
83
83
|
| `--port N` | the first free port from `7340` | The port. `0` is any free port. |
|
|
84
|
-
| `--open` | off | Open the console in this machine's browser once the server listens; not in CI, nor on Linux with no display. |
|
|
84
|
+
| `--open` | off | Open the console in this machine's browser once the server listens; not in CI, nor on Linux with no display. While the server has no owner it opens the setup page instead, with the setup code filled in when setup takes one. |
|
|
85
85
|
| `--faux MODULE` | none | Answer every model request from the module's default export (below). |
|
|
86
86
|
| `--faux-browser MODULE` | none | With `--faux` only: the `browser` tool's provider and driver from the module's default export, a fake browser with no vendor and no key ([below](#the-faux-model)). The console's real-browser tests run on it. |
|
|
87
87
|
| `--allow-host NAME` | none | Another `Host` name to accept on a loopback address, on any port. Repeat it. |
|
|
@@ -96,7 +96,18 @@ place: a token from the environment stays out of the logs. `DIR/.token`'s token
|
|
|
96
96
|
it; a later start prints `AGENTRUN_API_KEY=<in DIR/.token>`, to read it there. With `AGENTRUN_ACCOUNTS=0` the `Open`
|
|
97
97
|
link carries a launch code this start made at random (`?launch=<code>`), never the token. `AGENTRUN_PUBLIC_URL`, when set, is the
|
|
98
98
|
address people open (a container's published port, or a proxy's URL): the printed `Open` link and `AGENTRUN_BASE_URL`
|
|
99
|
-
use it
|
|
99
|
+
use it, and on loopback its name is also an allowed `Host`. Started with `npx @parcha/agentrun`, or as its service, pass
|
|
100
|
+
`--public-url https://<name>/` instead; the launcher hands the server that address as `AGENTRUN_PUBLIC_URL`
|
|
101
|
+
([the launcher](../agentrun/README.md)). The server remembers the public address in its data directory (`DIR/.public-url`) once a start serves; a start
|
|
102
|
+
that fails remembers nothing. A start where it changed,
|
|
103
|
+
including set where there was none or unset where there was one, writes one warning line to the log
|
|
104
|
+
(`event=public_url_changed from=<old> to=<new>`). The owner signs in again at the new address, because the session
|
|
105
|
+
cookie belongs to the old host, and links in earlier webhook messages still name the old address. When the old name
|
|
106
|
+
still reaches this server and it has a new public address, a browser that opens the console at the old name gets a 308
|
|
107
|
+
redirect to the new address. The browser keeps the link's `#/runs/<id>` part across the redirect, and the redirect is
|
|
108
|
+
`no-store`, so a browser does not keep it if the address changes back. On a loopback listener, everything else under
|
|
109
|
+
the old name stays refused: the API and webhooks get a 403 `forbidden` that names the new address, and another browser
|
|
110
|
+
page gets a page that links to it. Every other name is refused as before. `AGENTRUN_FREE_MODEL_REQUESTS` (default 60) is the most requests on free models a run makes
|
|
100
111
|
([a limit on free requests](#a-limit-on-free-requests)).
|
|
101
112
|
|
|
102
113
|
`AGENTRUN_TOKENS`, when set, is a list of more tokens, each with an id: `id:secret` entries separated by commas or
|
|
@@ -174,13 +185,17 @@ One line at start, `event=boxes`, says which boxes this server has ([Sandbox](#s
|
|
|
174
185
|
package and pins; [harnesses](#harnesses)), the bulk of its start; quiet keeps it too. It is made at the start only: a
|
|
175
186
|
PUT of `/settings/tools` and a save or delete of a tool key change no harness's offer, so they remake capabilities at
|
|
176
187
|
once without checking again (a key some harness reads would, with `why=key`).
|
|
188
|
+
`event=cost_heal read=<n> healed=<n> failed=<n>` says, once after the start, what the start's sweep did: the ended runs
|
|
189
|
+
whose stored cost was unknown that it read, those whose priced booking it wrote back, and those it could not read (each
|
|
190
|
+
heals on its next read). The rest stay unknown: a charge of no known cost, or a booking with no request to read. It
|
|
191
|
+
names no run, and a store with no such run says nothing; quiet keeps it too.
|
|
177
192
|
|
|
178
193
|
## Anonymous usage counts
|
|
179
194
|
|
|
180
|
-
The server
|
|
195
|
+
The server sends three anonymous events: `server_started`, a daily `heartbeat` and `first_run_completed`. Each holds
|
|
181
196
|
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.
|
|
183
|
-
`AGENTRUN_TELEMETRY=0` or `DO_NOT_TRACK=1` turns it off, as do `CI` and `--faux`; `AGENTRUN_TELEMETRY=debug` prints each
|
|
197
|
+
range; never a prompt, a file, a key or a name.
|
|
198
|
+
`AGENTRUN_TELEMETRY=0` or `DO_NOT_TRACK=1` turns it off, as do `CI`, a test runner (`node --test`) and `--faux`; `AGENTRUN_TELEMETRY=debug` prints each
|
|
184
199
|
event on stderr and sends none. The start that first could send prints one notice and sends nothing at that start.
|
|
185
200
|
[docs/telemetry.md](../../docs/telemetry.md) lists every field.
|
|
186
201
|
|
|
@@ -268,7 +283,18 @@ copy: a service that loses it loses them). With no
|
|
|
268
283
|
`AGENTRUN_TOKEN` from the Environment tab, or the code the start prints in the service's log (`Set up this server: ...`). On another host, set `AGENTRUN_PUBLIC_URL` to
|
|
269
284
|
the address people open before the first start; without it, whoever opens the console first sets the password. Set
|
|
270
285
|
`AGENT_MODEL` and the provider's key there too. Render waits 30 s after SIGTERM, above the image's 6 s drain; it does not
|
|
271
|
-
let a service with a disk change that.
|
|
286
|
+
let a service with a disk change that. It sets `AGENTRUN_RUN_USER=same` (every run as the server's own user, each still
|
|
287
|
+
a process of its own), as Railway's template does: neither platform has been shown to keep the image helper's file
|
|
288
|
+
capabilities.
|
|
289
|
+
|
|
290
|
+
A runner that refuses to claim (its run isolation refused: an `AGENTRUN_RUN_USER` it does not know, or a helper that
|
|
291
|
+
can't switch users) stays up and says so in the store. While every runner there has refused, and one at least is there,
|
|
292
|
+
the server refuses a run's start, and a message to a run, with 503 `runner_refused` in the runner's words and their fix;
|
|
293
|
+
`GET /v2/capabilities` has them in `runner_refused` (null otherwise); `GET /v2/health` answers 200 `degraded`, its
|
|
294
|
+
`runner` check `refused` and the words in `runner_refused`, so a platform's health check never restarts the service over
|
|
295
|
+
a setting; and a run already queued ends `failed` with error code `runner_refused`. A run a runner claimed is left to it.
|
|
296
|
+
A server with `--no-runner` and no runner started yet refuses nothing: runs queue for the runner to come. Once a runner
|
|
297
|
+
that can claim is there, the refusal is gone.
|
|
272
298
|
|
|
273
299
|
## The disk, and earlier data directories
|
|
274
300
|
|
|
@@ -353,6 +379,25 @@ timeline and, once, to the model as an "AgentRun server note"), and the agent's
|
|
|
353
379
|
when it does and 1 when it does not, and 2 when no name is given. Name a runner you start yourself with
|
|
354
380
|
`agentrun-serve runner --data DIR --name N`.
|
|
355
381
|
|
|
382
|
+
## Start-time switches
|
|
383
|
+
|
|
384
|
+
Some of what the server reaches is set only by its operator, in its environment when it starts. No route and no console
|
|
385
|
+
page sets these, so no caller of the API can widen what the server reaches; each takes a restart. A refusal one of them
|
|
386
|
+
causes names the variable, the value that allows it and the restart (`restart the server with
|
|
387
|
+
AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1 to allow it, only on a machine you alone use`), with its usual error code.
|
|
388
|
+
`GET /v2/capabilities` lists them under `switches`, each with `on`, the `value` the server read and what it `allows`.
|
|
389
|
+
|
|
390
|
+
| Variable | What it allows | Default | Why at the start only |
|
|
391
|
+
| --- | --- | --- | --- |
|
|
392
|
+
| `AGENTRUN_MCP_ALLOW_LOOPBACK=1` | An MCP server on this machine's loopback ([MCP servers](#mcp-servers)) | off | Loopback is this machine's other services too: set it only on a machine you alone use |
|
|
393
|
+
| `AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1` | The outbound webhook to a private network or this machine ([Webhooks](#webhooks)) | off | Whoever may set the webhook could make the server POST inside its network: only on a machine you alone use |
|
|
394
|
+
| `AGENTRUN_BOX_ALLOW` | The hosts a run's computer may reach: a comma list, or `none` ([A run in a Docker box](#a-run-in-a-docker-box)) | the package registries and GitHub | A run's network is the operator's policy, not a caller's |
|
|
395
|
+
| `AGENTRUN_BOX_CPUS`, `AGENTRUN_BOX_MEMORY`, `AGENTRUN_BOX_PIDS` | A Docker computer's size ([Computers](#computers)) | 2 CPUs, 4 GiB, 1,024 processes | The machine's capacity is the operator's |
|
|
396
|
+
|
|
397
|
+
On a server the installer runs as a service, `agentrun service install --env AGENTRUN_MCP_ALLOW_LOOPBACK=1 --env
|
|
398
|
+
AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1` saves the two yes-or-no switches in the service and restarts it; `--env KEY=` takes
|
|
399
|
+
one off.
|
|
400
|
+
|
|
356
401
|
## Sandbox
|
|
357
402
|
|
|
358
403
|
A sandbox agent's `bash` runs in a box, a machine apart from this server. Docker is the default box and the only one offered
|
|
@@ -449,7 +494,7 @@ go through `work/` by path.
|
|
|
449
494
|
`AGENTRUN_BOX_ALLOW` replaces it with a comma list of host names, such as
|
|
450
495
|
`pypi.org,files.pythonhosted.org,registry.npmjs.org,registry.yarnpkg.com,github.com,codeload.github.com,deb.debian.org`
|
|
451
496
|
to add one (`*.example.com` names the hosts below `example.com`); `AGENTRUN_BOX_ALLOW=none` is the box offline, as it
|
|
452
|
-
was: no proxy, no network at all. `*`, an address or a CIDR refuses the start.
|
|
497
|
+
was: no proxy, no network at all ([start-time switches](#start-time-switches)). `*`, an address or a CIDR refuses the start.
|
|
453
498
|
- How: the run's process starts the proxy with the list on a Unix socket in a directory of its own under
|
|
454
499
|
`/tmp/agentrun-egress-<uid>/`, bound into the box read-only at `/run/agentrun/egress/`. A `socat` in the box relays
|
|
455
500
|
`127.0.0.1:3128` to it, and `HTTP_PROXY` and `HTTPS_PROXY` (and their lowercase twins) name that port, with
|
|
@@ -524,7 +569,7 @@ go through `work/` by path.
|
|
|
524
569
|
It may use 2 CPUs' time, 4 GiB of memory, swap included, and 1,024 processes and threads (`--cpu-period 100000
|
|
525
570
|
--cpu-quota 200000 --memory 4096m --memory-swap 4096m --pids-limit 1024`), so a runaway build or a fork bomb stops in
|
|
526
571
|
the box. `AGENTRUN_BOX_CPUS`, `AGENTRUN_BOX_MEMORY` and `AGENTRUN_BOX_PIDS` change them, for Docker computers only
|
|
527
|
-
([a Docker computer's size](#computers)). `AGENTRUN_BOX_CPUS` caps CPU
|
|
572
|
+
([a Docker computer's size](#computers); [start-time switches](#start-time-switches)). `AGENTRUN_BOX_CPUS` caps CPU
|
|
528
573
|
time, as a CFS quota (the cap `--cpus` sets), so it holds whatever CPU count Docker's VM has, and where the kernel
|
|
529
574
|
gives Docker no CPU controller (a rootless Docker without one delegated), Docker ignores it with a warning.
|
|
530
575
|
- `bash` takes pi's `{command, timeout?}`, `timeout` in seconds, 300 when the call names none; a timeout kills the
|
|
@@ -695,7 +740,7 @@ Settings → Computers. The kind says what the agent is given, and the provider
|
|
|
695
740
|
| Kind | What the agent gets | Providers |
|
|
696
741
|
|---|---|---|
|
|
697
742
|
| `none` | The run's folder alone: no computer, and no provider (`{"kind": "none"}`) | |
|
|
698
|
-
| `sandbox` | A Linux shell, with files and processes | `docker`, `daytona`, `modal`, `e2b`, `boxd`, `cloudflare` (through a relay Worker you deploy) |
|
|
743
|
+
| `sandbox` | A Linux shell, with files and processes | `docker`, `daytona`, `modal`, `e2b`, `boxd`, `smolcloud`, `cloudflare` (through a relay Worker you deploy) |
|
|
699
744
|
| `desktop` | The computer's tools (`computer_observe`, `computer_act`, `computer_screenshot`), the computer as `codemode`'s `computer`, and a shell where its provider mounts the run's folder | `docker` (with an image that has an X server), `e2b`, `orgo`, `boxd`, or [a paired computer](#a-persons-own-computer) by its id |
|
|
700
745
|
| `phone` | A rented Android, through the same computer tools | `phone-harness` |
|
|
701
746
|
| `browser` | A hosted browser (the browser tools) | `browserbase`, `kernel` |
|
|
@@ -732,7 +777,7 @@ the provider with them and starts nothing. A key set in the server's environment
|
|
|
732
777
|
`DAYTONA_API_KEY` (with `DAYTONA_API_URL` and `DAYTONA_TARGET` optional), `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET`,
|
|
733
778
|
`E2B_API_KEY`, `AGENT37_API_KEY` and `AGENT37_SSH_KEY`, `MORPH_API_KEY`, `ORGO_API_KEY`, `PHONE_HARNESS_API_KEY`,
|
|
734
779
|
`BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`, `KERNEL_API_KEY`, `BOXD_API_KEY` (with `BOXD_ORG` and
|
|
735
|
-
`BOXD_REGION` optional), `CLOUDFLARE_RELAY_URL` and `CLOUDFLARE_RELAY_TOKEN` (the relay Worker's,
|
|
780
|
+
`BOXD_REGION` optional), `SMOLCLOUD_API_KEY`, `CLOUDFLARE_RELAY_URL` and `CLOUDFLARE_RELAY_TOKEN` (the relay Worker's,
|
|
736
781
|
`packages/computer/relays/cloudflare`), and `FLY_API_TOKEN` and `FLY_APP`; Docker takes none.
|
|
737
782
|
The vendors bill their computers by time on their own pages: this server meters no
|
|
738
783
|
computer time. The older [`place`](#place) is this setting's v2 view: `{"mode": "runner"}` is kind `none`, and
|
|
@@ -748,7 +793,10 @@ size its provider makes it, and is never given them. A value the Docker provider
|
|
|
748
793
|
the provider's words.
|
|
749
794
|
|
|
750
795
|
**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
|
|
796
|
+
longer has it. The tool call in flight when the loss is confirmed fails with code `gone`: `the computer <name> was lost
|
|
797
|
+
while this call ran, and it was not run again: <the provider's words>. A new computer starts at the next call.` It is
|
|
798
|
+
never sent again, to the new sandbox or anywhere, so a command that is not safe to repeat runs at most once. Whatever it
|
|
799
|
+
wrote to the run's folder before the loss stays there. The run's next tool call starts a new
|
|
752
800
|
sandbox under the same claim and runs there, also when the lost one was kept through a park. A start that fails is
|
|
753
801
|
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
802
|
credential, and the lost one's credential is removed. The run's folder is kept; what was on the lost sandbox outside it
|
|
@@ -891,7 +939,10 @@ passes the binding's conformance cases (below) needs no change here.
|
|
|
891
939
|
relay, save the relay's address as `DAYTONA_ARCHIL_EGRESS` (Settings → Computers, beside `DAYTONA_API_KEY`) and name
|
|
892
940
|
a snapshot of `box/Dockerfile` in `AGENTRUN_DAYTONA_SNAPSHOT` (below): the Daytona sandbox then mounts the run's
|
|
893
941
|
folder and is ready. With the relay but no snapshot named, it is refused, saying to name one. A boxd sandbox takes no
|
|
894
|
-
mount yet, so it is refused in both modes; a boxd desktop runs in either.
|
|
942
|
+
mount yet, so it is refused in both modes; a boxd desktop runs in either. Which folder a provider's computer holds on
|
|
943
|
+
this server now is on its row in `GET /v2/computers`, by the rule a run's claim picks it by: `folder` is `archil`
|
|
944
|
+
(mounted from the disk), `sync` (a synced folder the runner keeps on the disk), `bind` (Mode 1's folder of this
|
|
945
|
+
machine) or null (none).
|
|
895
946
|
|
|
896
947
|
The PUT is a secret write, so it takes the owner's signed-in session. A server with none to give it (API only, or
|
|
897
948
|
`AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
|
|
@@ -960,6 +1011,25 @@ A Daytona computer mounts the run's folder only where `DAYTONA_ARCHIL_EGRESS` na
|
|
|
960
1011
|
egress relay (see Mode 2 above), and then it needs this snapshot. A changed recipe is a new name, so build again after
|
|
961
1012
|
an upgrade that changes `box/`. A Daytona [box](#sandbox) never reads it.
|
|
962
1013
|
|
|
1014
|
+
**Before unsetting `DAYTONA_ARCHIL_EGRESS` on a server with open runs.** Each open run's folder moves from the Archil
|
|
1015
|
+
mount to a synced folder at its next claim. The synced claim reads the folder through Archil's file API, which lists a
|
|
1016
|
+
link an exec made (a venv, `node_modules/.bin`) as a file and won't read it. So it takes the folder's links from the
|
|
1017
|
+
`sync.json` beside it (`agents/<agent>/runs/<run>/sync.json`), which an Archil computer writes at its park and release
|
|
1018
|
+
from 0.1.0-beta.45 on. A run whose last Archil claim ran an earlier release, or never reached its park or release, has
|
|
1019
|
+
no record. If its folder holds a link, its next synced claim is refused. New runs need nothing, and neither do runs
|
|
1020
|
+
that take no more messages (cancelled, failed, a workflow's, an imported or a learning run). Before the switch, run
|
|
1021
|
+
0.1.0-beta.45 or later with the variable still set and count the runs at risk. The count is read-only:
|
|
1022
|
+
|
|
1023
|
+
1. List the disk under `agents/*/runs/*/` through the file API. Keep each run with files under `work/` and no
|
|
1024
|
+
`sync.json`.
|
|
1025
|
+
2. Keep only the runs that can take a message (`GET /runs`): one not ended, or an agentic run that completed or that a
|
|
1026
|
+
person stopped, since a follow-up opens it again on the same folder.
|
|
1027
|
+
3. Probe every file the listing has under each kept run's `work/` with a one-byte ranged GET. A 501 answer means a
|
|
1028
|
+
link: that run is at risk. A run with a file not yet probed stays in the count.
|
|
1029
|
+
|
|
1030
|
+
Claim each run left once on the mount (a message, or a resume), so its park or release records it, or accept that it
|
|
1031
|
+
won't continue where it syncs. Unset the variable once the count is 0.
|
|
1032
|
+
|
|
963
1033
|
A desktop, a phone and a browser run in either mode. The run's folder is at
|
|
964
1034
|
`/workspace` in every computer that mounts it: a sandbox always, and a desktop whose provider mounts the mode's folder
|
|
965
1035
|
(Docker's in Mode 1, Agent37's and E2B's in Mode 2). A phone and a browser never mount it. On a desktop that mounts it, the
|
|
@@ -1069,6 +1139,22 @@ model with no price set that the catalog does not list in any form; null while `
|
|
|
1069
1139
|
gets that as a warning. One
|
|
1070
1140
|
without a cap runs, on every harness, with each request's cost unknown: codex's and opencode's proxy books it unknown,
|
|
1071
1141
|
never $0, so the run's `cost.usd` is `null` and `/usage` counts it in `unpriced_runs`.
|
|
1142
|
+
- A model gateway saved in the console (Settings → Model keys → **Use a model gateway**), the same gateway kept in the
|
|
1143
|
+
store instead of the environment, for a LiteLLM or other OpenAI-compatible proxy the owner already runs: its address
|
|
1144
|
+
(the one rule `AGENT_MODEL_BASE_URL` follows), its key (optional; sealed under the seal key, never shown again, never in
|
|
1145
|
+
a run's environment), how it takes ids (`as_named`, or `bare` as `AGENT_MODEL_GATEWAY_IDS=bare`), and the default
|
|
1146
|
+
model of each tier (`AGENT_MODEL`, `AGENT_MODEL_FAST`, `AGENT_MODEL_STRONG`). **Test** asks the gateway's
|
|
1147
|
+
`GET <base>/v1/models` from the server, with no redirect followed, and lists the ids to pick from. A save or removal
|
|
1148
|
+
takes effect at once, with no restart: capabilities read it, and the runner reads it at each claim. Over the API:
|
|
1149
|
+
`GET`, `PUT` and `DELETE /v2/settings/model-gateway` and `POST /v2/settings/model-gateway/test`; every one but the GET
|
|
1150
|
+
takes the owner's signed-in session, never the API token. Which wins: `AGENT_MODEL_BASE_URL` set where AgentRun starts
|
|
1151
|
+
makes the environment's gateway the one in force, whole, and the saved one is not read (its `PUT` and `DELETE` are 409
|
|
1152
|
+
`key_set_by_server`); else the saved gateway is in force with its own key alone (never an `AGENT_MODEL_API_KEY` set
|
|
1153
|
+
without a base URL), and each of `AGENT_MODEL`, `AGENT_MODEL_FAST`, `AGENT_MODEL_STRONG` and
|
|
1154
|
+
`AGENT_MODEL_GATEWAY_IDS` set where AgentRun starts wins over its saved field. A saved key goes only to the origin it
|
|
1155
|
+
was saved for: changing the address to another origin asks for the key again (or `api_key: null`, no key). With no key
|
|
1156
|
+
saved, each run brings its own (`model_key`, below). Prices are read as for `AGENT_MODEL_BASE_URL`
|
|
1157
|
+
(`AGENT_MODEL_PRICE`, else the catalog). Removing it puts the provider keys back in force.
|
|
1072
1158
|
- A ChatGPT plan signed in here ([below](#on-a-chatgpt-plan)), with no provider's key: `source` is `chatgpt`, and pi
|
|
1073
1159
|
and codex run on the plan's models (`chatgpt/<model-id>`) with no key.
|
|
1074
1160
|
- Otherwise pi-ai's providers serve them, each with its key from the environment (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
|
|
@@ -1230,8 +1316,10 @@ Offline regressions cover streamed native tools, continuation, reasoning, cache
|
|
|
1230
1316
|
errors, credential scoping and actual Pi conversation retries. A live pass against Particle's API (2026-11-18, twelve
|
|
1231
1317
|
checks) saved a key, then completed a plain run, tool calls continued after the model's reasoning, a follow-up, a
|
|
1232
1318
|
cancel, a capped run and a workflow's model nodes. Replies reported cached input tokens and no cache writes, and each
|
|
1233
|
-
priced run's cost equaled its tokens at list price.
|
|
1234
|
-
|
|
1319
|
+
priced run's cost equaled its tokens at list price. A later workflow run (2026-11-19, three requests) matched
|
|
1320
|
+
Particle's usage page: the same cached, uncached and output token counts, and the same cost to the six decimals the
|
|
1321
|
+
page shows. Not yet seen live: a rate limit or server error from Particle. The protocol fixtures alone are not
|
|
1322
|
+
evidence of live compatibility.
|
|
1235
1323
|
|
|
1236
1324
|
### On a ChatGPT plan
|
|
1237
1325
|
|
|
@@ -1928,7 +2016,8 @@ not known, so not cut, and the import says so.
|
|
|
1928
2016
|
## MCP servers
|
|
1929
2017
|
|
|
1930
2018
|
Add a remote MCP server once, with its credential, and see its tools before you keep it. An agent that grants one of
|
|
1931
|
-
its tools calls it on pi and on claude-agent ([below](#agents-call-a-servers-tools)).
|
|
2019
|
+
its tools calls it on pi and on claude-agent ([below](#agents-call-a-servers-tools)). Which kind of server to choose for a
|
|
2020
|
+
service's CLI, and why its token never goes in the box: [Give an agent tools](../../docs/connect-tools.md).
|
|
1932
2021
|
|
|
1933
2022
|
```sh
|
|
1934
2023
|
curl -X POST "$BASE/v2/settings/mcp-servers/preview" -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \
|
|
@@ -1953,18 +2042,58 @@ preset: you give your Composio API key, a toolkit (`github`, `slack`...), the ac
|
|
|
1953
2042
|
toolkit's list) and a server name, and the server has Composio make a managed MCP server for them, then saves it as an
|
|
1954
2043
|
ordinary MCP server with the key sealed as an `x-api-key` header. `POST /v2/settings/mcp-servers/composio/tools`
|
|
1955
2044
|
`{api_key, toolkit}` lists the actions; `PUT /v2/settings/mcp-servers/{name}/composio` `{api_key, toolkit, tools,
|
|
1956
|
-
user_id?}` makes and saves the server. When the toolkit needs your account and `user_id`
|
|
1957
|
-
active, the answer's `connect_url` is Composio's page to connect it; nothing here signs
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2045
|
+
user_id?, auth_config_id?, price_usd?}` makes and saves the server. When the toolkit needs your account and `user_id`
|
|
2046
|
+
(default `agentrun`) has none active, the answer's `connect_url` is Composio's page to connect it; nothing here signs
|
|
2047
|
+
in. The server and its connect link are made against the toolkit's Composio-managed auth config (found, else made), or
|
|
2048
|
+
against `auth_config_id`, one you already have at Composio (your own OAuth app's, say): it is read first, and one
|
|
2049
|
+
Composio doesn't know, of another toolkit, or disabled is `422` under `auth_config_id` before anything is made. From
|
|
2050
|
+
that save on it is yours: no delete or later save removes it, even when AgentRun made it for this or another saved
|
|
2051
|
+
server. `price_usd` (0 or more, as a `prices` value) is what each call costs you: every granted action is saved at that
|
|
2052
|
+
price, so a call is held under its run's cap and booked as the run's tool cost (its trace span's `usd`, the run's
|
|
2053
|
+
`cost.usd`), as any priced MCP tool's. A re-save that names no price keeps the server's prices for the actions it still
|
|
2054
|
+
lists. Composio's server can leave out an action it was allowed (it did for `HACKERNEWS_GET_FRONTPAGE`), so the answer's
|
|
2055
|
+
`not_served` names any chosen action the saved server doesn't list. Both routes are the owner's session alone, and a
|
|
2056
|
+
saved Composio server is gated, approved and shown on the Timeline as any MCP server's tools are, "not metered" until
|
|
2057
|
+
you price them (`price_usd`, or the server's `prices`). Composio's own meta tools stay refused, and the helper actions
|
|
2058
|
+
that connect an account are left off the server's address. Deleting the server in Settings deletes what its save made in Composio too, with the saved key: the Composio MCP server, the connected account its connect link started (the link with it) and the auth config it made (Composio's "already gone" is fine). What another saved server uses is kept until the last of them goes, and what was there before the save (an auth config or account you had) is never deleted. The `DELETE` answers `200 {deleted: true, composio: {removed, note}}`: the note says what it removed, what it kept and why, and, when Composio refuses or does not answer, what is left to remove in Composio yourself (`removed: false`; the server is still forgotten here). The console shows it. A save that fails removes in Composio what it made there and never what it found, and its error names what is left when Composio refuses that too (a 422 on a field says it in `details.composio` as well). A save over a preset server removes, once it is saved, the Composio MCP server its earlier save made, and what that save made and the new one no longer stands on (the account of another `user_id`, the auth config of another toolkit), with the key it was made with, unless another saved server uses it, and answers `composio: {removed, note}` saying so. An ordinary `PUT` that moves a preset server to another address makes it another service's server: it removes what the preset made for it in Composio as its delete would, and answers `composio` too. While Composio triggers use the server, that move, and a preset save over it as another `user_id` or auth config, are refused as its delete is (`409 composio_in_use`, naming them). Preset saves and MCP server deletes run one at a time, so a delete never removes what a save in progress reuses; an ordinary save of a preset server lists its tools at once and takes its turn only to write the server and clean up.
|
|
1963
2059
|
[Connect Composio tools and triggers](../../docs/tutorials/composio.md) walks through the preset and a Composio
|
|
1964
2060
|
trigger in the console, with each step's API call.
|
|
1965
2061
|
|
|
2062
|
+
#### One Composio server, an account per run
|
|
2063
|
+
|
|
2064
|
+
A preset server is saved for one Composio user. To let each run act as its own person's account instead, save it with
|
|
2065
|
+
`user_id: "per_run"` (a word reserved for this, never a Composio user id): the server keeps no user and no connected
|
|
2066
|
+
account in its address, looks up no account and makes no connect link. Composio refuses an address that names no user,
|
|
2067
|
+
even to list its tools, so the save, a refresh, a preview and an agent's save list them as `agentrun~tool-listing`, a
|
|
2068
|
+
user no save or run can name, never stored and never used for a call. Each run then names the account its calls of that
|
|
2069
|
+
server run as, in `mcp_auth` on its start or on a message:
|
|
2070
|
+
|
|
2071
|
+
```sh
|
|
2072
|
+
curl -X POST "$BASE/v2/agents/$AGENT/runs" -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \
|
|
2073
|
+
-d '{"input": {"content": "..."}, "mcp_auth": {"mail": {"composio_user_id": "user-1234", "connected_account_id": "ca_abc123"}}}'
|
|
2074
|
+
```
|
|
2075
|
+
|
|
2076
|
+
`composio_user_id` is a Composio user id; `connected_account_id`, optional, is one of that user's connected accounts
|
|
2077
|
+
(`ca_...`), and without it Composio picks the user's account for the toolkit. Each request to the server carries that
|
|
2078
|
+
user and account, the Composio key staying the server's own. The binding is kept as a `per_run` server's headers are:
|
|
2079
|
+
sealed into the run's launch, erased by the write that ends the run, never on the server's row, the run's view, its
|
|
2080
|
+
timeline, its trace or a log line, and its values are cut from whatever the run shows. A message's binding replaces the
|
|
2081
|
+
run's for the turn it starts. A run that names no account has its calls of the server answered, unsent, that it was
|
|
2082
|
+
handed none, so a per-run server never calls as a default account. A malformed user or account is `422 input_invalid` at
|
|
2083
|
+
`mcp_auth.<server>.composio_user_id` or `.connected_account_id`, and so is a binding to the preset's default user
|
|
2084
|
+
`agentrun` (`not_allowed`: the user single-user preset servers call as); headers for such a server, or a binding for any
|
|
2085
|
+
other server, are `422` at `mcp_auth.<server>`, and no run starts. A per-run server makes no Composio trigger: a trigger
|
|
2086
|
+
runs as one account. A server saved for one user before this mode keeps calling as that user.
|
|
2087
|
+
|
|
2088
|
+
With `user_id: "per_run"`, whoever can start a run chooses its Composio user, so the host (Grep, say) owns which user
|
|
2089
|
+
each run binds: it binds each run to its own person and never takes the ids from that person. Only `agentrun` is
|
|
2090
|
+
refused, so a host must not bind a per-run server to a `user_id` that a single-user server calls as.
|
|
2091
|
+
|
|
1966
2092
|
What can go wrong, told apart:
|
|
1967
2093
|
|
|
2094
|
+
- `403 forbidden` with `details.console_url`: the API token sent, dropped or changed a credential, which only the
|
|
2095
|
+
owner's console saves. The link opens Settings → MCP servers with the form filled in (name, URL, kind of credential,
|
|
2096
|
+
toolkit; for a saved server, its Change form), never the credential. A URL that could hold one is left out.
|
|
1968
2097
|
- `422 auth_required`: the server answered 401 or 403. `details.auth` is `oauth` when it names protected-resource
|
|
1969
2098
|
metadata (in its `WWW-Authenticate`, or at `/.well-known/oauth-protected-resource`), else `bearer`.
|
|
1970
2099
|
- `422 not_mcp`: the URL answered, but nothing it answered was a JSON-RPC reply (a web page, a JSON API, a 404).
|
|
@@ -2056,7 +2185,7 @@ and `X-Forwarded-Proto: https`: without them a start reads as another address (o
|
|
|
2056
2185
|
and every start answers `409 wrong_origin`. For an MCP server whose URL is not loopback, every endpoint its authorization server names (and
|
|
2057
2186
|
every request to one) must be `https` and resolve to no private, loopback or link-local address, or the sign-in or
|
|
2058
2187
|
refresh is refused with words and nothing is sent. A loopback MCP server (a `127.0.0.1` or `localhost` URL) is taken only
|
|
2059
|
-
by a server started with `AGENTRUN_MCP_ALLOW_LOOPBACK=1
|
|
2188
|
+
by a server started with `AGENTRUN_MCP_ALLOW_LOOPBACK=1` ([start-time switches](#start-time-switches)), which says this is a local install: set it only on a machine you
|
|
2060
2189
|
alone use, since loopback is this machine's other services too. Without it such a URL is refused at the save, the preview
|
|
2061
2190
|
and the sign-in, in words naming the variable, and a runner never reaches one. The runner beside such a server reaches
|
|
2062
2191
|
one, never at that server's own ports (where it listens, and its public address when that is on loopback), which the
|
|
@@ -2222,7 +2351,7 @@ save's `422` says, under a harness id when that harness's own MCP client would d
|
|
|
2222
2351
|
|
|
2223
2352
|
One URL hears of your runs without anyone watching the page. `PUT /v2/settings/webhook` with `{url}` sets it: an `http`
|
|
2224
2353
|
or `https` address, with no user or password in it, on a public host: a loopback or private-network address is refused
|
|
2225
|
-
unless the operator allows it (`AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1`, below). Two kinds of message are POSTed to it about runs: `run.needs_input` when a run comes to
|
|
2354
|
+
unless the operator allows it (`AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1`, below; [start-time switches](#start-time-switches)). Two kinds of message are POSTed to it about runs: `run.needs_input` when a run comes to
|
|
2226
2355
|
need its person (`input_required`: a question, a call held for approval, a pause at its cap, an ask for its person in
|
|
2227
2356
|
its browser, desktop or phone, or a stopped turn) and `run.ended` when it ends
|
|
2228
2357
|
(completed, failed or cancelled, once the run's end is written). A [schedule](#schedules) whose firing fails sends a third,
|
|
@@ -2268,10 +2397,14 @@ it is still cut. A `PUT` that changes the URL makes a new secret and shows it on
|
|
|
2268
2397
|
URL keeps it. `GET` and the log show the URL's origin and its last four characters, never the whole URL (a chat
|
|
2269
2398
|
service's incoming-hook URL is a credential itself). The URL is refused when it is on a private network or this machine,
|
|
2270
2399
|
by address or by any address its name resolves to, and each try resolves the name again and dials the address it
|
|
2271
|
-
checked; an operator who sends to an internal receiver sets `AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1` where the server starts
|
|
2400
|
+
checked; an operator who sends to an internal receiver sets `AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1` where the server starts
|
|
2401
|
+
and restarts it, which the refusal says, at the `PUT` and in a try's log entry. A `DIR/webhook.json` an earlier build left is not read: the
|
|
2272
2402
|
server says so at its start (`condition=webhook_left_over`), and a `PUT` sets the webhook again. A new secret for the
|
|
2273
|
-
same URL is
|
|
2274
|
-
|
|
2403
|
+
same URL is `POST /v2/settings/webhook/secret` (Settings → Webhook → Rotate secret in the console), from the owner's
|
|
2404
|
+
signed-in session alone, as every secret write is: it answers the new secret once, as `signing_secret`, and retires the
|
|
2405
|
+
old one at once, so every try after it is signed with the new one, a message queued before it included. A `404` says no
|
|
2406
|
+
webhook is set. A secret that no longer opens under the server's key (sealed under another) is replaced, and shown
|
|
2407
|
+
once, by a rotation or the next `PUT`. The URL and its secret go live together: a `PUT` whose write the store
|
|
2275
2408
|
refuses leaves the webhook as it was, and the secret it made is never used.
|
|
2276
2409
|
|
|
2277
2410
|
A try that is not answered 2xx within 15 s fails; a redirect is not followed. A failed message is tried again on the
|
|
@@ -2286,6 +2419,45 @@ lists the last 50 attempts (`webhook_id`, type, status code, latency, error, whe
|
|
|
2286
2419
|
410 turned off sends nothing, a test or a redelivery included (`409 webhook_off`), until a `PUT` sets it again.
|
|
2287
2420
|
`DELETE /v2/settings/webhook` removes the webhook and drops its pending messages.
|
|
2288
2421
|
|
|
2422
|
+
### Post to Slack
|
|
2423
|
+
|
|
2424
|
+
Slack shows a message, not the webhook's signed JSON, so the server can post to a Slack channel itself. In Slack, add an
|
|
2425
|
+
incoming webhook to the channel (an app with Incoming Webhooks turned on), then paste its URL in the console under
|
|
2426
|
+
Settings → Slack, or `PUT /v2/settings/slack` with `{"url": "https://hooks.slack.com/services/..."}` from the owner's
|
|
2427
|
+
signed-in session. The URL must be `https://hooks.slack.com/services/...`, with no port, query or user.
|
|
2428
|
+
|
|
2429
|
+
The URL is the credential: anyone who has it can post to the channel. So saving it is a secret write (the API token is
|
|
2430
|
+
refused `403`, with `details.console_url` opening Settings → Slack, never the URL), it is sealed under the server's seal key like a [tool key](#tool-keys), and no answer, log line or
|
|
2431
|
+
delivery shows more than its last four characters. A replaced or removed URL stays sealed in the store, so a run that
|
|
2432
|
+
echoes it, or its token, is still cut.
|
|
2433
|
+
|
|
2434
|
+
Each event posts one message (Block Kit, with `text` for notifications):
|
|
2435
|
+
|
|
2436
|
+
| Event | The message |
|
|
2437
|
+
| --- | --- |
|
|
2438
|
+
| `run.ended` | The agent (its `agent_name`: its name, else its id), the status in a word (completed, failed, was cancelled), the run's title linked to the run in the console. |
|
|
2439
|
+
| `run.needs_input` | The same, with "needs you" and what the run waits on: a question, an approval, a paused cap, a hand-over or a stopped turn. |
|
|
2440
|
+
| `trigger.failed` | The trigger's name, linked to it, and the error's code and message; and whether it turned itself off. |
|
|
2441
|
+
|
|
2442
|
+
```json
|
|
2443
|
+
{ "text": "Lead triage: run completed: Qualify ACME",
|
|
2444
|
+
"blocks": [
|
|
2445
|
+
{ "type": "section", "text": { "type": "mrkdwn", "text": "*Lead triage* · run completed\n<https://agents.example.com/#/runs/…|Qualify ACME>" } },
|
|
2446
|
+
{ "type": "context", "elements": [{ "type": "mrkdwn", "text": "AgentRun · run.ended · run `…`" }] } ] }
|
|
2447
|
+
```
|
|
2448
|
+
|
|
2449
|
+
A message never carries a run's input, its output or a tool's arguments, as the webhook's never does: open the run
|
|
2450
|
+
from the link to read them. Every string in it (an agent's or a trigger's name, a run's title, an error) is cut of the
|
|
2451
|
+
secrets the server holds before it is saved or posted: a key typed into a name reads `[redacted]`. Every event is on by default. `PUT /v2/settings/slack` with
|
|
2452
|
+
`{"events": {"run.needs_input": false}}` turns one off; a body with `events` alone is no secret write.
|
|
2453
|
+
|
|
2454
|
+
Delivery is the webhook's: the same outbox in the store, retries on the same schedule, one message per run's end or
|
|
2455
|
+
wait, deliveries at `GET /v2/settings/slack/deliveries`, a message posted again with
|
|
2456
|
+
`POST /v2/settings/slack/deliveries/{webhook_id}/redeliver`, and a test message with `POST /v2/settings/slack/test`.
|
|
2457
|
+
Slack answers `200 ok`. A `404` or `410` (`no_service`, `channel_not_found`, `channel_is_archived`) turns Slack off
|
|
2458
|
+
(`disabled` in `GET`, with Slack's word) until a URL is saved again; a test or a redelivery is then `409 slack_off`.
|
|
2459
|
+
`DELETE /v2/settings/slack` removes the URL and drops pending messages.
|
|
2460
|
+
|
|
2289
2461
|
## Schedules
|
|
2290
2462
|
|
|
2291
2463
|
A schedule starts an agent's runs with no one there. `POST /v2/triggers` with a `source` and a `target`:
|
|
@@ -2303,7 +2475,10 @@ change repeats fires once, at its first pass; one it skips fires at the first ti
|
|
|
2303
2475
|
reckoned from the last nominal one, so a timer that wakes late does not drift. Every run a trigger starts is capped: by
|
|
2304
2476
|
the target's `max_cost_usd`, else by the agent's default (its definition's `max_cost_usd`) as it stands when the firing
|
|
2305
2477
|
starts. A target with neither is `422`, and a firing that finds neither (the default removed since) fails, so no trigger
|
|
2306
|
-
starts an uncapped run, a workflow agent's included ([workflow runs](#a-workflow-run-under-its-cap)).
|
|
2478
|
+
starts an uncapped run, a workflow agent's included ([workflow runs](#a-workflow-run-under-its-cap)). The one
|
|
2479
|
+
exception is a connected agent ([native agents](../../docs/native-agents.md)): its own CLI keeps its own limits and
|
|
2480
|
+
AgentRun cannot hold it to a dollar cap, so a trigger on one takes no `max_cost_usd` (on the target or as the agent's
|
|
2481
|
+
default) and no `effort`, each `422 not_allowed`, and its runs start uncapped, as the ones a caller starts do. Each run's
|
|
2307
2482
|
input ends with a line naming the schedule and the time it fired for, in its zone, and the run's `trigger` names the
|
|
2308
2483
|
trigger and the firing, in the run's view and in the runs lists (`GET /v2/runs`, `GET /v2/agents/{id}/runs`) alike;
|
|
2309
2484
|
a run a caller started has `trigger: null`.
|
|
@@ -2483,14 +2658,14 @@ A string that is an address carrying a credential, in any scheme (`https`, `post
|
|
|
2483
2658
|
(`token`, `api_key`, `access_token`, `sig`) that has a value. An address with none stays as it is; one whose user part
|
|
2484
2659
|
holds no secret (`ssh://git@host`) is sealed all the same. A field the event's schema marks with `format: "password"` or
|
|
2485
2660
|
`writeOnly: true` is sealed whatever its name; the create reads the event's schema from Composio for this. A create with
|
|
2486
|
-
such a value below the config's top level is refused `422`, naming it.
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
`
|
|
2492
|
-
|
|
2493
|
-
|
|
2661
|
+
such a value below the config's top level is refused `422`, naming it. Composio's trigger schemas rarely mark a field
|
|
2662
|
+
secret, so the name mostly decides. A number is sealed as its decimal text and stays a number in what Composio gets; a
|
|
2663
|
+
run's output is cut of that text when it is 8 characters or more, as a string's is. The value is kept in the composio
|
|
2664
|
+
source's sealed settings, next to the subscription's secret. Composio gets it once, in the instance's upsert. Every
|
|
2665
|
+
answer has `"[sealed]"` in its place, and `source.sealed_config` names the field. The events list names these fields per
|
|
2666
|
+
event under `sealed`, and the console takes them as passwords. A PATCH that leaves a sealed field out or sends
|
|
2667
|
+
`"[sealed]"` keeps it. Any other value is a change to the config and is refused, as every config change is: to change a
|
|
2668
|
+
key, delete the trigger and make a new one.
|
|
2494
2669
|
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
|
|
2495
2670
|
masked by the same rule at once, at any depth (one below the top level named in `sealed_config` by its JSON Pointer),
|
|
2496
2671
|
and sealed at the next start by the same rule. After that start, without holding it up, the server reads the schema of
|
|
@@ -2709,8 +2884,8 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
2709
2884
|
| `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
|
|
2710
2885
|
| `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. |
|
|
2711
2886
|
| `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. |
|
|
2712
|
-
| `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)). |
|
|
2713
|
-
| `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
|
|
2887
|
+
| `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 schedule trigger starts is handed that trigger's last completed `result.output` after its message; no other source's runs are, since each of their firings is a different event. A result over 32 KiB (as 2-space JSON) is handed only as the top-level fields its run's output schema (that run's revision's, not the agent's current one) names in `x-carried`, an array of unique names of the schema's root `properties`, with words naming them and the whole result's size. A carried array is kept oldest first by convention (the template that writes it owns the order; the engine reads no dates): when the carried fields are themselves over 32 KiB, the array largest in bytes right then gives up its first (oldest) entry, one at a time, measured again after each, a tie going to the first in `x-carried`, until they fit, and the words say per field how many oldest entries were dropped (`seen: 12 oldest entries dropped`). A scalar or object is never cut, nor anything inside an entry; with no `x-carried`, or carried fields still over the limit with no entry left to drop, the run is told the result was too large and handed none of it. A save refuses any other `x-carried` (`422`, field `definition.output_schema.x-carried`); the server leaves it out of every tool schema a model is sent. `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)). It also adds `run_blockers` (`x-agentrun-serve: "runblockers/1"`): `{message, fields}` as a start with no overrides would be refused now (`409 agent_not_runnable`), or null. It is always null for an archived, native or SDK agent and for a revision whose MCP tools its first run pins, and the read asks no other service, so under the agent's `max_cost_usd` an OpenRouter decision model's missing price is named only once a save or a start has read OpenRouter's catalog: null is no promise that a start is accepted. |
|
|
2888
|
+
| `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 and name stay those it was made with (another name is `422` on `definition.name`). Its description is a label kept on the agent, not on a revision: a PUT that names a new one makes the next revision (even when nothing else changed) and writes the description with it in one commit, so a stale or refused edit changes neither; a PUT that leaves it out keeps it. `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. |
|
|
2714
2889
|
| `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
|
|
2715
2890
|
| `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
|
|
2716
2891
|
| `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`. |
|
|
@@ -2718,7 +2893,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
2718
2893
|
| `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. |
|
|
2719
2894
|
| `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. |
|
|
2720
2895
|
| `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`. |
|
|
2721
|
-
| `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
|
|
2896
|
+
| `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` `reported`, `estimate` or `unpriced`, with its model requests' `tokens`: [A run's cost](#a-runs-cost-its-tokens-and-its-basis); $0 before its first model request, a cancelled run's included). |
|
|
2722
2897
|
| `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. |
|
|
2723
2898
|
| `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`). |
|
|
2724
2899
|
| `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. |
|
|
@@ -2726,7 +2901,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
2726
2901
|
| `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)). |
|
|
2727
2902
|
| `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. |
|
|
2728
2903
|
| `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"`). |
|
|
2729
|
-
| `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` `
|
|
2904
|
+
| `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` (`reported`, `estimate` or `unpriced`: [A run's cost](#a-runs-cost-its-tokens-and-its-basis)), 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. |
|
|
2730
2905
|
| `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`). |
|
|
2731
2906
|
| `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. |
|
|
2732
2907
|
| `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`. |
|
|
@@ -2741,7 +2916,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
2741
2916
|
| `GET` and `POST /triggers`, `GET`, `PATCH` and `DELETE /triggers/{id}`, `POST /triggers/{id}/fire`, `GET /triggers/{id}/firings`, `POST /triggers/{id}/secret`, `POST /hooks/{id}` (no token: [signed](#webhook-triggers)) | [Schedules](#schedules), this server's own routes (`x-agentrun-serve: "trigger/1"`): schedules that start an agent's capped runs, each firing once, and their history. |
|
|
2742
2917
|
| `GET /templates`, `POST /templates/{name}/apply` | [Templates](#templates), this server's own routes (`x-agentrun-serve: "templates/1"`): the template packages it ships, and an apply that makes one's agent and triggers, all or nothing. |
|
|
2743
2918
|
| `POST /mcp` | This server's own route (`x-agentrun-serve: "mcp/1"`): the [MCP endpoint](#for-coding-agents), Streamable HTTP with one JSON-RPC message per POST (`initialize`, `ping`, `tools/list`, `tools/call`), answered as JSON, stateless. Its ten tools call these routes in process with the caller's token. The Bearer token only, never the page's cookie; a browser `Origin` other than this server's own is `403`; any other method is `405`. |
|
|
2744
|
-
| `GET /usage` | The runs'
|
|
2919
|
+
| `GET /usage` | The runs' costs, by meter, agent, key, day or region (`key` and `region` are one line, `local`). A run of unknown cost adds what it is known to have spent so far (its `so_far_usd`: each priced charge, browser time and paid tools included) and is counted in `unpriced_runs` (in the total and in each line it is unknown on), so no sum is ever null, it never passes as $0, and a total is never below a line of its own: with `unpriced_runs` above 0 the total is a lower bound. `basis` says how the costs were reached ([A run's cost](#a-runs-cost-its-tokens-and-its-basis)). |
|
|
2745
2920
|
|
|
2746
2921
|
Quotes answer `501 unsupported_here` naming the feature. Home export and import (`GET` and `PUT /agents/{id}/home`) and
|
|
2747
2922
|
`POST /runs/{id}/kill` are not served here: they answer `404`, and the served document leaves them out (its
|
|
@@ -2807,11 +2982,22 @@ serves these routes alone:
|
|
|
2807
2982
|
key names and whether each is saved, and whether it is ready) and `GET /workspace/archil` (whether runs' folders are
|
|
2808
2983
|
on Archil, and whether its account key is saved). Neither answers a key's value. Their writes, tests and key choices
|
|
2809
2984
|
are the console's, refused here;
|
|
2810
|
-
- `GET /capabilities`, `GET /health` and `GET /usage
|
|
2985
|
+
- `GET /capabilities`, `GET /health` and `GET /usage`;
|
|
2986
|
+
- a run's desktop or phone, for a backend that shows its user the live view and lets them take over: see below.
|
|
2987
|
+
|
|
2988
|
+
A run's computer here takes the server's token, the backend's own, since there is no owner to sign in: `GET
|
|
2989
|
+
/runs/{id}/computer`, `POST /runs/{id}/computer/take-over` and `POST /runs/{id}/computer/hand-back`. For its user's
|
|
2990
|
+
browser, the backend asks `POST /runs/{id}/computer/viewer` for `{ url, expires_at }`: a link on `AGENTRUN_PUBLIC_URL`
|
|
2991
|
+
(refused in words when it is unset) to the run's live page, with a viewer credential in its query that opens that run's
|
|
2992
|
+
page and socket, from the public address alone, for 5 minutes. The credential is an HMAC of the run and its expiry under
|
|
2993
|
+
a key from the seal key, so every server on the store checks it, across restarts; the run's end (completed, failed or
|
|
2994
|
+
cancelled) revokes it and closes a socket open on it, and a stop does not, as the run goes on. The person watches, and
|
|
2995
|
+
takes over and hands back in the viewer's own bar; nothing else opens to the credential. A server that is not API-only
|
|
2996
|
+
answers the mint `404`, and its live page takes the owner's sign-in alone.
|
|
2811
2997
|
|
|
2812
2998
|
Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
|
|
2813
2999
|
assets, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
|
|
2814
|
-
`POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and
|
|
3000
|
+
`POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no
|
|
2815
3001
|
page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
|
|
2816
3002
|
`false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
|
|
2817
3003
|
|
|
@@ -2991,6 +3177,22 @@ OPENROUTER_API_KEY (401: User not found): set it where AgentRun starts, or save
|
|
|
2991
3177
|
harness, with the provider's first sentence only.
|
|
2992
3178
|
Every request to OpenRouter carries AgentRun's app attribution (`HTTP-Referer: https://github.com/Parcha-ai/agentrun`, `X-OpenRouter-Title: AgentRun`), so a self-hosted server's usage on its own key counts toward AgentRun's listing on OpenRouter; `AGENTRUN_OPENROUTER_ATTRIBUTION=off` where AgentRun starts sends none.
|
|
2993
3179
|
|
|
3180
|
+
**Claude Code through a gateway.** Set `ANTHROPIC_BASE_URL` to a gateway that speaks Anthropic Messages, such as
|
|
3181
|
+
LiteLLM's `/v1/messages`, and `ANTHROPIC_API_KEY` to the key it wants, or any placeholder when it adds its own. No
|
|
3182
|
+
Anthropic key is needed, and capabilities show claude-agent ready. The base follows `AGENT_MODEL_BASE_URL`'s rules: https,
|
|
3183
|
+
or plain http to this machine only, with one trailing `/v1` dropped. The gateway must:
|
|
3184
|
+
|
|
3185
|
+
- take `POST <base>/v1/messages` (Claude Code adds `?beta=true`) with the key in `x-api-key`, never as a bearer token, and
|
|
3186
|
+
accept the `anthropic-version` and `anthropic-beta` headers the pinned CLI sends;
|
|
3187
|
+
- accept Anthropic's own model ids (`claude-haiku-5-5`, with dashes);
|
|
3188
|
+
- report each answer's usage: the run is booked from it at serve's catalog price for that id. When the gateway's
|
|
3189
|
+
response carries a positive `x-litellm-response-cost` (LiteLLM's), that figure is booked instead, with the catalog's
|
|
3190
|
+
kept beside it; a missing, malformed or zero figure (LiteLLM writes 0 on a streamed answer) leaves the catalog price.
|
|
3191
|
+
|
|
3192
|
+
AgentRun asks Anthropic's token count only on `api.anthropic.com`, so through a gateway a run's `max_cost_usd` holds each
|
|
3193
|
+
request at a bound from its size instead. The same setting routes pi's Anthropic models (above). Contract test:
|
|
3194
|
+
`test/gateway-contract.test.mjs` ("claude-agent through ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY").
|
|
3195
|
+
|
|
2994
3196
|
`claude-agent` loads the revision's skills itself: the model is shown each as `agentrun:<name>`, loads one with the Skill
|
|
2995
3197
|
tool and reads its other files with `read_skill_file`, and the system prompt holds the instructions alone. A skill the
|
|
2996
3198
|
adapter does not take (a name that is not lowercase letters, digits and dashes, a `SKILL.md` without front matter giving
|
|
@@ -3012,22 +3214,30 @@ the console all read that table. An owner adds harnesses with a harness module:
|
|
|
3012
3214
|
takes the same flag and setting, and needs them to run the module's harnesses. MODULE is a path, or a package installed
|
|
3013
3215
|
with `npm install --prefix <data>/harnesses <package>`.
|
|
3014
3216
|
|
|
3015
|
-
A module exports `entries(builtins)`, which returns new entries by id.
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
and
|
|
3217
|
+
A module exports `entries(builtins, kit)`, which returns new entries by id. [HARNESS.md](../../HARNESS.md) walks through
|
|
3218
|
+
writing one, and [examples/harness-module](../../examples/harness-module/README.md) is a whole one.
|
|
3219
|
+
|
|
3220
|
+
An entry made without `kit` gives `label`, `steer`, `runMib`, `oneAlwaysFits`, `runs`, `onWire`, `model`, `priceModel`,
|
|
3221
|
+
`refusal` and its `runner`, and may give `promises`; a run of it runs on its runner's `adapter(launch, extra)`. Every
|
|
3222
|
+
harness is admitted by the `runMib` its entry declares. A module adds harnesses and never replaces one: the built-in
|
|
3223
|
+
harnesses' facts, offers, key rows, default models and tool names are the same with any module loaded. The start of the
|
|
3224
|
+
server, or of a separate runner, is refused, naming the module and the id, when a module:
|
|
3020
3225
|
- gives an id that does not match `^[a-z][a-z0-9-]{0,39}$`;
|
|
3021
|
-
-
|
|
3226
|
+
- takes a name serve reserves (listed in [HARNESS.md's `id` row](../../HARNESS.md#field-by-field));
|
|
3022
3227
|
- names a built-in harness;
|
|
3023
3228
|
- names an id another module adds;
|
|
3024
3229
|
- gives an entry that is missing a member;
|
|
3230
|
+
- names in an entry's `ownKeys` a key a built-in harness owns (`HARNESS_KEY_OWNED`);
|
|
3025
3231
|
- does not resolve.
|
|
3026
3232
|
|
|
3027
3233
|
A module's entry that gives no adapter `facts` runs on the general spec, with pi's tools: capabilities list its id on
|
|
3028
3234
|
every tool pi runs (`tools[].harnesses`) and on MCP grants (`features.mcp_client.harnesses`), so an agent on it keeps
|
|
3029
3235
|
its tool choices. One that gives `facts` runs the host tools, as the other built-in harnesses do.
|
|
3030
3236
|
|
|
3237
|
+
A module's author proves its harness with `@parcha/agentrun-serve/conformance`: the same suite (`registerHarnessConformance`),
|
|
3238
|
+
adapter loop (`createAdapterLoop`) and host tools (`suiteHostTools`) this repository proves its own harnesses with. An ACP
|
|
3239
|
+
agent's module runs it on `@parcha/agentrun-harness-acp/testing`'s fake ACP agent, which needs no binary, model or key.
|
|
3240
|
+
|
|
3031
3241
|
The harnesses a module adds are listed in `capabilities.harnesses` after the built-in ones. Each offer there carries a
|
|
3032
3242
|
`label` and `promises`:
|
|
3033
3243
|
- `resume`: `exact`, `load` or `restart`.
|
|
@@ -3278,6 +3488,11 @@ CLAUDE.md or AGENTS.md and its skill folders, and each session becomes a run you
|
|
|
3278
3488
|
this machine, and the values of key-shaped environment variables are cut out of what it writes. Run it again and it takes
|
|
3279
3489
|
only what it has not taken already. Sessions written in the last 10 minutes wait for the next import.
|
|
3280
3490
|
|
|
3491
|
+
A run's cost is what its source recorded (Claude Code's and pi's). A session its source did not price, such as a Codex
|
|
3492
|
+
session, keeps the model catalog's estimate for its tokens beside an unknown cost, and every place that shows a run's
|
|
3493
|
+
cost reads that estimate, as an estimate: the run (`cost.usd`, basis `estimate`), its usage row, `GET /stats` and its
|
|
3494
|
+
analytics, and `GET /usage`. A session on a model the catalog does not price stays unknown.
|
|
3495
|
+
|
|
3281
3496
|
- `--dry-run` lists what it would import and writes nothing.
|
|
3282
3497
|
- `--from claude-code,codex,pi` picks the sources.
|
|
3283
3498
|
- `--include-deleted` also imports the sessions of project folders that no longer exist, such as a git worktree you
|
|
@@ -3368,8 +3583,20 @@ job, once it repeats: after `learning.compile_after` completed runs (20 by defau
|
|
|
3368
3583
|
for the whole job as one workflow, which is checked in code, replayed on the agent's own past inputs, and served as one
|
|
3369
3584
|
tool once it agrees with the agent's own answers. The console reads `GET /v2/agents/{id}/learning` for the agent's
|
|
3370
3585
|
corrections, workflows and history, and `GET /v2/runs/{id}/learning` and its `/diff` for an individual result.
|
|
3371
|
-
Observation requires no model key
|
|
3372
|
-
enabled and
|
|
3586
|
+
Observation requires no model key. Creating workflow drafts requires an agentic run executed or reported through this
|
|
3587
|
+
server with learning enabled and access to its configured compile model. For a connected SDK agent, compilation runs
|
|
3588
|
+
on this server; shadow execution and tool access remain in the original application, as described below.
|
|
3589
|
+
|
|
3590
|
+
Set up **Settings → API Keys → Model keys** with a provider key that matches the learning model, such as OpenRouter,
|
|
3591
|
+
Anthropic or OpenAI, or a supported server sign-in. An unrelated provider key, tool API key, AgentRun connection key or
|
|
3592
|
+
decision-provider key does not supply compiler access. Background compilation cannot borrow a caller's per-request
|
|
3593
|
+
gateway key. The new SDK shadow comparison is deterministic and needs no separate Jev key. Native project connections
|
|
3594
|
+
use their original runtime's sign-in for corrections; learned workflows are not available on that connection.
|
|
3595
|
+
|
|
3596
|
+
The agent's Learning tab and Learning Dojo show missing setup for that agent's actual model. `learning_model` in
|
|
3597
|
+
`GET /v2/agents/{id}/learning` describes that route; the same field in capabilities describes the server default.
|
|
3598
|
+
`ready` means the route and credentials are configured, not that quota or provider availability has been verified.
|
|
3599
|
+
These reads make no paid request, and saving a matching key refreshes the setup guidance.
|
|
3373
3600
|
|
|
3374
3601
|
Importing Claude Code, Codex or pi session history does not replay learning or connect a live learning stream.
|
|
3375
3602
|
Before/after cost and duration are observations, not an accuracy evaluation.
|
|
@@ -3399,7 +3626,8 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
|
|
|
3399
3626
|
follow-up reads the same.
|
|
3400
3627
|
- The workflows the agent learned, each a folder `workflows/<name>/` on `main` with its `workflow.json` and its
|
|
3401
3628
|
`README.md`, are the run's as one tool, `learned_workflow {name, input}`, on every harness (pi, claude-agent, codex),
|
|
3402
|
-
with no edit of the agent's definition. Only an active
|
|
3629
|
+
with no edit of the agent's definition. Only an active, promoted revision is: its `README.md` sets no status, or `active`,
|
|
3630
|
+
and its promotion record names the checked champion. A compiled draft without that record is withheld; front
|
|
3403
3631
|
matter that does not read one way (not closed, a key indented under another, a key set twice, a status over more
|
|
3404
3632
|
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
|
|
3405
3633
|
while its line fits, and one that does not, or holds one of the server's secrets, is left out. A README whose front
|
|
@@ -3467,13 +3695,48 @@ The round's commit is made with plumbing: the passing draft's files added or cha
|
|
|
3467
3695
|
the commit the change was made on (once more on a `main` that moved meanwhile), and a run a trailer already names is
|
|
3468
3696
|
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.
|
|
3469
3697
|
|
|
3470
|
-
A new workflow revision serves only once its promotion check passes
|
|
3698
|
+
A new workflow revision serves only once its promotion check passes. For a server-run agent, the first run that lays it replays it on the
|
|
3471
3699
|
inputs of the agent's last `compile_after` completed runs, one replay run each at workflow cost, and scores each against
|
|
3472
3700
|
the agent's own recorded answer. It is promoted when it agrees on at least `learning.agree_min` (0.8) of them and
|
|
3473
3701
|
answers at least `learning.alone_min` (0.7) alone; under either bar it is held, and the next run asks one revision with
|
|
3474
3702
|
the inputs it disagreed on. Held again, it stops, and nothing compiles again until its owner acts. A promotion by
|
|
3475
3703
|
check is never moved by grades. `GET /agents/{agent_id}/learning/promotions` reads every record.
|
|
3476
3704
|
|
|
3705
|
+
Connected SDK agents (Claude Agent SDK, Codex SDK and Eve) check where their original tools live. When an application
|
|
3706
|
+
starts an SDK run with a workflow bridge, `learning.workflows` contains only compatible promoted revisions. If a
|
|
3707
|
+
compiled draft needs a check, the server instead reserves one candidate in
|
|
3708
|
+
`learning.check: {id, revision, digest, workflow}` and returns an empty `learning.workflows` list. The candidate is
|
|
3709
|
+
not a tool for the model. The application completes its ordinary native turn first, then the bridge executes the
|
|
3710
|
+
candidate in shadow using that turn's recorded tool results. It makes no fresh tool calls by default and never repeats
|
|
3711
|
+
a write. A host can explicitly enable `shadowReadFallback` for its declared read-only callbacks under its original
|
|
3712
|
+
policy. Missing or changed evidence, an input that cannot be bound to the workflow, and unsupported adapters fail the
|
|
3713
|
+
check closed.
|
|
3714
|
+
|
|
3715
|
+
The bridge posts one `workflow_check` event with the reservation's `id` and `digest`, its execution `outcome`
|
|
3716
|
+
(`answered`, `handed_back`, `failed` or `skipped_write`), and its answer or reason. It does not choose whether the
|
|
3717
|
+
workflow passes. The server compares the answer with the immutable native completion and applies the same
|
|
3718
|
+
`agree_min` and `alone_min` promotion policy. This initial SDK check uses **one independent native turn** (`n: 1`),
|
|
3719
|
+
not the server-run agent's historical replay set. Agreement is whole-answer equality (JSON values or trimmed text), or equality of the owner's
|
|
3720
|
+
configured `agree_on` fields; there is no semantic model grader on this path. A paraphrase can therefore be held even
|
|
3721
|
+
when a person would consider it equivalent.
|
|
3722
|
+
|
|
3723
|
+
A start reserves a check only on a turn that can be its baseline: a JSON object task must pass the draft's input
|
|
3724
|
+
schema (a prose task's input is resolved by the bridge), and a start whose task or instructions held a protected value
|
|
3725
|
+
reserves nothing. A reserved turn that still cannot be the baseline (cancelled or failed, incomplete, redacted or
|
|
3726
|
+
workflow-assisted evidence, no `workflow_check` report, or a shadow that `failed` or `skipped_write`) gives the
|
|
3727
|
+
reservation back: the record stays `replaying` with no `runs`, counts it in `check.released`, and the next turn the
|
|
3728
|
+
draft takes is checked. The fifth given-back turn stops the check with nothing checked (no recompile). A turn the
|
|
3729
|
+
backend never completes within an hour is decided as one failed input through the same check, so its hold asks the
|
|
3730
|
+
one recompile and a recompile's check that ends the same way stops. Connected checks' records say `via: "sdk"`;
|
|
3731
|
+
`check.fresh_reads` counts the shadow's `shadowReadFallback` reads.
|
|
3732
|
+
|
|
3733
|
+
Concurrent starts reserve at most one check per workflow; retries keep the same reservation, and a late report cannot
|
|
3734
|
+
replace a recorded decision.
|
|
3735
|
+
An older checked champion can still serve while a newer revision is checking or held, except on the independent
|
|
3736
|
+
check turn itself. Learning Off returns neither workflows nor a check. Without a workflow bridge the application gets
|
|
3737
|
+
no workflow to execute. The application's tools, model callbacks and credentials stay in its process; the server receives
|
|
3738
|
+
evidence and the shadow result through the run-scoped SDK credential.
|
|
3739
|
+
|
|
3477
3740
|
The run's `learning` (on `GET /runs/{run_id}`, and `{state, reason, detail}` in run lists, the detail cut to 140
|
|
3478
3741
|
characters and no time) says how it went: `seeded`, then `reflecting` during its end step, and `merged`, or `dropped`
|
|
3479
3742
|
with a reason from a closed list (`seed_failed`, `no_budget`, `unknown_cost`, `cancelled`, `crashed`, `reflect_failed`,
|
|
@@ -3569,6 +3832,40 @@ carry) and a token sent beside the session. So is every request on a server with
|
|
|
3569
3832
|
host commit, `learning: approved by a person: <file>`, with the trailers `Changed-By: user` and `Approved-Via: console`;
|
|
3570
3833
|
the log shows `by: {user: true, via: "console"}` at the commit's time.
|
|
3571
3834
|
|
|
3835
|
+
## A run's cost: its tokens and its basis
|
|
3836
|
+
|
|
3837
|
+
A run's `cost` (on `GET /runs/{id}` and on each row of `GET /runs`, `costbasis/1`) carries its model requests' tokens
|
|
3838
|
+
and says how its figure was reached.
|
|
3839
|
+
|
|
3840
|
+
- `tokens`: `input` (cached input left out: the whole input is `input + cache_read + cache_write`), `output`,
|
|
3841
|
+
`cache_read`, `cache_write`, `requests` (every model request the run's model proxy booked: its turns, its subagents,
|
|
3842
|
+
its side calls) and `unmetered` (those that reported no tokens: refused, cut or never answered). Read from each
|
|
3843
|
+
answer's usage as the provider or gateway reported it: OpenAI's Responses `usage.input_tokens` and `output_tokens`,
|
|
3844
|
+
Anthropic's Messages `usage` with its cache reads and writes, streamed or whole. Absent while the run has booked no
|
|
3845
|
+
model request and stored none; a native or SDK run reports its whole task's tokens at its end, with no request
|
|
3846
|
+
count, and none while any count is unknown. The model proxy forwards only those two APIs (`/v1/responses`,
|
|
3847
|
+
`/v1/messages`); no harness here sends Chat Completions through it.
|
|
3848
|
+
- `basis`: `reported` when every request priced had its provider's or gateway's own figure (LiteLLM's
|
|
3849
|
+
`x-litellm-response-cost` header, OpenRouter's usage `cost`); `estimate` when any was priced from a price table (the
|
|
3850
|
+
model catalog, `AGENT_MODEL_PRICE`, a cut request counted at its hold); `unpriced` when no request was priced (none sent,
|
|
3851
|
+
every one refused at $0, or none with a known figure). Paid tool calls and decisions are charged at their own figures
|
|
3852
|
+
and do not change it. A native, SDK or imported run's figure is its harness's own, an `estimate`; so is an imported
|
|
3853
|
+
session's catalog estimate where its source priced none ([importing your sessions](#importing-your-sessions)). LiteLLM writes no
|
|
3854
|
+
cost into a streamed answer's headers, so a run whose answers stream through LiteLLM reads `estimate`.
|
|
3855
|
+
- `tools_usd` (on `GET /runs/{id}` alone, `toolsusd/1`): the part of `usd` its paid tool calls cost (monid's endpoints,
|
|
3856
|
+
MCP tools with a saved price, Parallel behind `web_search` and `web_fetch`, browser time), as the run's ledger booked
|
|
3857
|
+
them, rounded as `usd` is. It is inside `usd`, never added to it: `usd` less `tools_usd` is what its model requests and
|
|
3858
|
+
decisions cost. A paid call in a learning run's end-of-run turn is learning's (in `learning_usd`), never in
|
|
3859
|
+
`tools_usd`. 0 when it made no paid call. Null while a paid call's charge is unknown (as `usd` is then); while the run
|
|
3860
|
+
is at work (until it ended, stopped or failed); for a learning run a follow-up opened again, whose `usd` is what its
|
|
3861
|
+
first round had cost; and for an imported, native or SDK run, whose `usd` is its import's or its harness's own figure
|
|
3862
|
+
and whose tool calls the server never books. Each call's own charge is its span's `usd` on `GET /runs/{id}/trace`.
|
|
3863
|
+
- `GET /stats` (`cost.basis`) and `GET /usage` (`basis`) say the same words over the runs they sum: `estimate` when any
|
|
3864
|
+
run's is, else `reported` when any run's is, else `unpriced`. A run whose end stored no basis (one that ended before
|
|
3865
|
+
this, or a workflow run: its run read still says its basis from its booking) counts as `estimate` when it cost anything.
|
|
3866
|
+
|
|
3867
|
+
The console shows the tokens beside the run's cost, and the figure says its basis: `$0.0042 est.`, `$0.0042 reported`.
|
|
3868
|
+
|
|
3572
3869
|
## Spend cap
|
|
3573
3870
|
|
|
3574
3871
|
A run may name `max_cost_usd`, an agentic run or a workflow run ([below](#a-workflow-run-under-its-cap)). A run that names none takes its agent's default,
|