@parcha/agentrun 0.4.5 → 0.4.7

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/lib/follow.mjs CHANGED
@@ -118,8 +118,9 @@ function settle(client, run, id) {
118
118
  const why = run.status === "paused" ? `is paused: resume it with \`agentrun runs resume ${id}\``
119
119
  : run.pending?.kind === "question" ? `asked a question: answer it with \`agentrun runs message ${id} --content TEXT\``
120
120
  : run.pending?.kind === "budget" ? `is paused at its spend cap: raise it with \`agentrun runs raise-cap ${id} --max-cost-usd ${Number.isFinite(run.pending.suggested_cap_usd) ? run.pending.suggested_cap_usd : "N"}\``
121
+ : run.pending?.kind === "stopped" ? `was stopped by a person: send it a message with \`agentrun runs message ${id} --content TEXT\``
121
122
  : run.pending?.kind ? `waits on a person (${run.pending.kind})`
122
- : `was stopped by a person: send it a message with \`agentrun runs message ${id} --content TEXT\``;
123
+ : `ended its turn: send it a message with \`agentrun runs message ${id} --content TEXT\``;
123
124
  client.io.stderr.write(`Run ${id} ${why}, ${go}.\n`);
124
125
  return EXIT.person;
125
126
  }
package/lib/start.mjs CHANGED
@@ -114,7 +114,7 @@ export function npmExecOf(env, from = process.ppid) {
114
114
  }
115
115
 
116
116
  export const USAGE = `Usage: npx @parcha/agentrun [--port N] [--data DIR] [--no-open] start the server
117
- npx @parcha/agentrun import|reset-password|runner [--data DIR] a server command (runner: one more runner on this store)
117
+ npx @parcha/agentrun import|reset-password|runner|native [--data DIR] a server command (native: discover/connect an existing project)
118
118
  npx @parcha/agentrun <command> [args] the server's API: agents, runs, triggers, ..., api (npx @parcha/agentrun help)`;
119
119
 
120
120
  /** The server's launcher, installed with this package (its dependency), or undefined. */
@@ -132,7 +132,7 @@ export const serverArgs = (argv) => (argv.includes("--no-open") ? argv.filter((a
132
132
 
133
133
  /** The server's own commands (its CLI's first word), which this command runs on its store: every other first word is
134
134
  * the CLI's, which names a command it has or says it has none. */
135
- export const SERVER_COMMANDS = ["eval-template", "import", "reset-password", "runner", "validate-template"];
135
+ export const SERVER_COMMANDS = ["eval-template", "import", "native", "remote-bridge", "reset-password", "runner", "validate-template"];
136
136
 
137
137
  /** How many of the server's refusals and ignored deliveries a start says, each route and reason once, before one line
138
138
  * that says the rest are not: under this command the server's log goes nowhere else (its stdout is read here and dropped). */
package/lib/template.mjs CHANGED
@@ -20,6 +20,48 @@ export const TEMPLATE_VALIDATE = {
20
20
  },
21
21
  };
22
22
 
23
+ // `agentrun template install SOURCE`: a package on GitHub imported into the server (POST /v2/templates/import), which
24
+ // resolves the ref to a commit, reads the package at it and checks it as it checks its own; nothing in it runs. With
25
+ // --dry-run the package is shown whole (its instructions and every skill file) and stored nowhere. The first package from
26
+ // a publisher needs --trust, said once, after reading it. Prints what was imported and the console page that applies it.
27
+ export const TEMPLATE_INSTALL = {
28
+ command: ["template", "install"],
29
+ pathParams: ["source"],
30
+ summary: "Import a template package from GitHub (github:OWNER/REPO[/PATH][@REF]) and print the console page that applies it",
31
+ help: [
32
+ ["SOURCE", "github:OWNER/REPO[/PATH][@REF], or https://github.com/OWNER/REPO/tree/REF/PATH. The ref is resolved to a commit first"],
33
+ ["--dry-run", "check the package and print it whole (instructions, skill files); store nothing"],
34
+ ["--trust", "trust the package's publisher (the GitHub owner): the first package from one needs it"],
35
+ ],
36
+ options: { "dry-run": { type: "boolean" }, trust: { type: "boolean" } },
37
+ async run({ values, args, env, io, cli }) {
38
+ const client = cli.clientOf(cli.targetOf(values, env), io);
39
+ let refusal = "";
40
+ const refused = client.refused;
41
+ client.refused = (response, bytes) => ((refusal = bytes.toString("utf8")), refused(response, bytes));
42
+ const body = JSON.stringify({ source: args[0], ...(values["dry-run"] ? { dry_run: true } : {}), ...(values.trust ? { trust_publisher: true } : {}) });
43
+ const { response, bytes, code } = await cli.request(client, { method: "POST", path: "/templates/import", body, type: "application/json" });
44
+ if (code !== undefined) {
45
+ // The one refusal this command has a flag for: say it, after the server's error.
46
+ if (!values.trust && /"field"\s*:\s*"trust_publisher"/.test(refusal)) io.stderr.write(`Read it first (--dry-run), then run this again with --trust.\n`);
47
+ return code;
48
+ }
49
+ let answer;
50
+ try {
51
+ answer = JSON.parse(bytes.toString("utf8"));
52
+ } catch {
53
+ throw cli.fail(1, `The server's answer (${response.status}) is not JSON.`);
54
+ }
55
+ const { template = {}, stored, replaced, publisher_trusted, console_url } = answer;
56
+ const summary = { id: template.id, source: template.source, sha: template.sha, publisher: template.publisher, publisher_trusted, stored, replaced, console_url };
57
+ client.print(values["dry-run"] ? { ...summary, instructions: answer.instructions, skill_files: answer.skill_files, template } : summary);
58
+ if (!io.stdout.isTTY) return 0;
59
+ // The install it suggests is pinned to the commit just shown: a branch that moves since is not what was read.
60
+ io.stderr.write(stored ? `Apply it: ${console_url}\n` : `Nothing stored. Install what you read: agentrun template install ${template.id}@${template.sha}${publisher_trusted ? "" : " --trust"}\n`);
61
+ return 0;
62
+ },
63
+ };
64
+
23
65
  // `agentrun template eval DIR`: the package's eval cases run as real runs of its agent and graded (agentrun-serve
24
66
  // eval-template, templates/README.md "Running the evals"), on a server the command starts in its own process over a temp
25
67
  // data directory, or with --server on that one, its token found as every other command finds it (AGENTRUN_API_KEY, the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "AgentRun, the open-source platform that supercharges your agents (self-improvement, durable execution and a control plane on top of your favorite agent harness), on this machine with one command: npx @parcha/agentrun",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -16,7 +16,7 @@
16
16
  "NOTICE"
17
17
  ],
18
18
  "dependencies": {
19
- "@parcha/agentrun-serve": "0.1.0-beta.37"
19
+ "@parcha/agentrun-serve": "0.1.0-beta.39"
20
20
  },
21
21
  "scripts": {
22
22
  "test": "node --test 'test/*.test.mjs'"
@@ -1,9 +1,8 @@
1
1
  ---
2
2
  name: agentrun-cli
3
- description: Drive an AgentRun server from a shell with the agentrun CLI. Make an agent from a definition file, start a run with a spend cap and wait for it, answer a run that asks a question, read the files it wrote and what it cost, save tool keys, and call any other route of the server. Use when asked to run or manage AgentRun agents from the terminal or a script, or for anything the server's MCP tools do not cover (files, tool keys, triggers, webhooks, revisions, learning).
3
+ description: Onboard and manage AgentRun agents from a shell. Connect existing Claude Code or Codex setups locally or remotely, import selected history, or create a new agent. Start runs, inspect results and use checked learning. Use when asked to connect, run or manage AgentRun agents from a terminal or script, or for anything the server's MCP tools do not cover (files, triggers, webhooks, revisions, learning).
4
4
  ---
5
5
  <!-- Generated by scripts/generate-clients.mjs from the server's OpenAPI document and its skill template. Do not edit: run node scripts/generate-clients.mjs. -->
6
- <!-- SHA-256 of what the command table is made of (operationsOf in scripts/generate-clients.mjs): daf5a6b21d009c9b74da813a177b33cb79efd89f533ecbbea3be6ca7b3dd242f -->
7
6
 
8
7
  # AgentRun CLI
9
8
 
@@ -11,6 +10,10 @@ description: Drive an AgentRun server from a shell with the agentrun CLI. Make a
11
10
 
12
11
  A list command (`agentrun agents list`, `agentrun runs list` and the others with `--cursor`) prints one page, with the `next_cursor` to pass as `--cursor` for the next; `--all` reads every page and prints them as one list, its `next_cursor` null.
13
12
 
13
+ ## Choose the onboarding path
14
+
15
+ For general setup, first establish whether the user wants to start a new agent or bring an existing Claude Code/Codex setup. Ask only when intent is missing: Build an agent already chose new; Connect agent already chose existing. Reuse the named instance and read its matching `/skills/agentrun-serve/SKILL.md`; do not start a replacement. A new agent starts from a suitable template or custom definition after clarifying its job, inputs and expected result. Inspect configured models before asking for a key. Existing-agent connection and selected history import need no destination model key; live jobs use the source runtime's existing sign-in. Finish with the first requested run's result and console link, or the imported history and counts; offer self-improvement separately.
16
+
14
17
  ## The server and the token
15
18
 
16
19
  The first of these that is set wins:
@@ -27,6 +30,16 @@ agentrun login --base-url "$AGENTRUN_BASE_URL" < token.txt
27
30
 
28
31
  Never print, echo or log the token, and never pass it as an argument; the CLI never prints it. `agentrun logout` removes the config file. Keys and other secrets are set in the console, signed in: the token can't write one, so no command does (`agentrun tool-keys list` names the keys and fields, and whether each is set, never a value).
29
32
 
33
+ ## Connect agent
34
+
35
+ First clarify whether the user wants a live connection, historical import, or both; then establish the source machine, destination instance and selected project/agent/profile. Do not infer history import or learning consent from a connection request. Read the target server's matching `/skills/agentrun-serve/SKILL.md` for the complete flow.
36
+
37
+ On the machine with the existing Claude Code or Codex setup, use `npx @parcha/agentrun native discover --project /absolute/project` to inspect supported project defaults, named Claude agents and Codex profiles without a model call. Then run `npx @parcha/agentrun native connect --project /absolute/project --runtime claude-code` (or `codex`), adding `--agent NAME` or `--profile NAME` for a discovered selector. The local server uses `--data DIR`; `--url http://127.0.0.1:PORT` selects its loopback address. For another machine, use the existing Python connector's `remote` command from the same reviewed build, with the matching `agentrun-serve remote-bridge` runtime. The released observation-only connector is not a remote execution worker. Pair using the console's one-use code entered into the secure CLI prompt; never send a broad server token or put the code in a command argument. Source configuration and sign-in stay on that machine. For completed project history, preview with the matching Python connector’s `remote history-preview --project /absolute/project --runtime claude-code` (or `codex`). Select History only or Both when creating the owner’s code; the source must also explicitly pass `--history-only` or `--history` to `remote connect`. History-only starts no worker or learning and needs no native sign-in. History flags reject named-agent/profile selectors because native logs cannot attribute sessions to them reliably. Re-import the approved target with `remote import-history --state-dir /private/connector`; duplicates are skipped. Historical records never become live jobs or automatic learning. Local-store imports still use the separate maintenance-window flow in the server skill.
38
+
39
+ For an authorized live connection, open the connected agent, verify its native sign-in, and turn Self-improving On only when requested to use the existing checked/graded learning pipeline. Native projects keep their original instructions, tools, hooks, permissions and login. AgentRun adds notes and skills without rewriting those files. Native dollar caps, interactive approvals, learned workflows and attachment to an already-running desktop conversation are unavailable; never bypass native permissions to make a run work. Off supplies and creates no AgentRun learning on subsequent runs. Reflection and grading make additional model calls using native sign-in unless the server has an explicit grading model route.
40
+
41
+ For the remote development build, install the Python connector from `./connector` in the same reviewed checkout after building its Node runtime (Python 3.12+ and Node 24.22.3+). A checkout build does not put `agentrun-serve` on PATH: pass `--bridge /absolute/path/to/checkout/packages/serve/dist/native/remote-worker-bridge.js` to discovery and connection. The Python connector and Node management CLI share the name `agentrun`; verify the executable, or use `python -m agentrun_cli` inside the installed connector environment. Keep its source worker online for live jobs. Inspect accepted notes and skills in Learning Dojo, then verify a fresh run uses them; imported history never supplies that learning automatically.
42
+
30
43
  ## Recipes
31
44
 
32
45
  Run them in order, in one working directory: each writes `out.json`, the run as its command printed it, and the next reads it. The last line of each block says how its last command exits.
@@ -84,10 +97,10 @@ agentrun runs get "$run" > out.json && node -p 'JSON.stringify(require("./out.js
84
97
 
85
98
  A run paused at its spend cap, or waiting for a tool call to be approved, exits 8 with `pending.kind` `budget` or `approval` in out.json.
86
99
 
87
- A cap too small for the task stops the run before a request it cannot pay for. With `--cap-mode strict` no request is sent that the cap cannot cover; under the default, `expected`, a request that misses the cache can go over by at most the run's `cost.overshoot_bound_usd`:
100
+ A cap too small for the task stops the run before a request it cannot pay for. No request is sent that the cap cannot cover, a cache miss included:
88
101
 
89
102
  ```sh
90
- agentrun runs start notes --max-cost-usd 0.05 --cap-mode strict --body '{"input": {"content": "Write moon.md with everything known about the Moon."}}' --wait > out.json
103
+ agentrun runs start notes --max-cost-usd 0.05 --body '{"input": {"content": "Write moon.md with everything known about the Moon."}}' --wait > out.json
91
104
  # exit 8 once it pauses at its cap: out.json has pending.kind budget, with cap_usd, spent_usd and suggested_cap_usd; 0 if the cap was enough
92
105
  ```
93
106
 
@@ -118,20 +131,23 @@ Two clients call the same API from code, with the same server and token. `@parch
118
131
 
119
132
  ## Commands
120
133
 
121
- - `agentrun agents`: archive, create, delete-agent-archil, forget-sign-in, get, get-agent-archil, list, runs, unarchive, update
134
+ - `agentrun agents`: archive, connect-native, create, delete-agent-archil, disconnect-native, discover-native, forget-sign-in, get, get-agent-archil, get-learning-loop, get-native, list, list-learning-promotions, runs, unarchive, update, verify-native
135
+ - `agentrun connectors`: complete-remote-command, enroll-remote-connector, import-remote-history, import-remote-target, list-remote-connectors, poll-remote-connector, register-remote-connector, remote-command-events, revoke-remote-connector
122
136
  - `agentrun files`: create, delete, get, list, upload
123
137
  - `agentrun home`: delete, list, read, write
124
- - `agentrun learning`: batch, batch-cancel, batch-start, batches, cost, evals, get, log, notes, read, record-eval, retire, workflow-revisions, write
125
- - `agentrun local`: create-pairing, delete-computer, delete-workspace-archil, disconnect-git-hub, get-git-hub-connection, get-workspace-archil, list-computer-choices, list-computers, test-computer, test-workspace-archil
138
+ - `agentrun learning`: batch, batch-cancel, batch-start, batches, cost, evals, get, log, notes, read, record-eval, replay, retire, workflow-revisions, write
139
+ - `agentrun local`: create-pairing, delete-composio-subscription, delete-computer, delete-workspace-archil, disconnect-git-hub, get-git-hub-connection, get-workspace-archil, list-composio-events, list-composio-triggers, list-computer-choices, list-computers, receive-hook-composio, rotate-composio-secret, test-computer, test-workspace-archil
126
140
  - `agentrun login`: Check a server's token, read from stdin, and keep it with the server's address in the config file
127
141
  - `agentrun logout`: Remove the config file login wrote, its address and token
128
142
  - `agentrun mcp-servers`: delete, get, list, oauth-client, private-hosts, refresh
143
+ - `agentrun Observations`: get-observations
129
144
  - `agentrun revisions`: list, set-current
130
- - `agentrun runs`: archive, cancel, computer-call, computer-release, create-inline-run, files, get, graph, hand-back-run-computer, learning, learning-diff, list, message, pause, raise-cap, read-file, resume, start, start-held, stop, take-over-run-computer, timeline, unarchive, wait
145
+ - `agentrun runs`: archive, cancel, computer-call, computer-release, create-inline-run, files, get, grade-run, graph, hand-back-run-computer, learning, learning-diff, list, message, pause, raise-cap, read-file, resume, start, start-held, stop, take-over-run-computer, timeline, unarchive, wait
146
+ - `agentrun sdk-runs`: complete, events, get, start
131
147
  - `agentrun server`: capabilities, health, mcp, openapi
132
148
  - `agentrun skill`: install
133
149
  - `agentrun stats`: Counts and cost over every agent and run
134
- - `agentrun template`: apply, eval, list, validate
150
+ - `agentrun template`: apply, delete, eval, import, install, list, validate
135
151
  - `agentrun tool-keys`: list
136
152
  - `agentrun tool-settings`: get, save
137
153
  - `agentrun triggers`: create, delete, fire, firings, get, list, update
@@ -1,7 +1,6 @@
1
1
  # agentrun commands
2
2
 
3
3
  <!-- Generated by scripts/generate-clients.mjs from the server's OpenAPI document. Do not edit: run node scripts/generate-clients.mjs. -->
4
- <!-- SHA-256 of what the command table is made of (operationsOf in scripts/generate-clients.mjs): daf5a6b21d009c9b74da813a177b33cb79efd89f533ecbbea3be6ca7b3dd242f -->
5
4
 
6
5
  Every command of the agentrun CLI, by group. Arguments in capitals are positional; every command also takes `--base-url URL`, `--data DIR` and `--help`. A body field with one value (a string, number or boolean) is a flag of its own, and `--body` gives the whole body. A positional argument is refused when it is or holds a `.` or `..` path segment; a file's PATH keeps its slashes, and no segment of it may be empty.
7
6
 
@@ -13,6 +12,17 @@ Archive the agent: hidden from the lists, kept with its history.
13
12
 
14
13
  Route: `POST /agents/{agent_id}/archive`.
15
14
 
15
+ ### `agentrun agents connect-native`
16
+
17
+ Connect a native project using ordinary agent and revision storage.
18
+
19
+ Route: `POST /native/connect`.
20
+
21
+ - `--project STRING` (string, required)
22
+ - `--runtime claude-code|codex` (string, one of these, required)
23
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
24
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
25
+
16
26
  ### `agentrun agents create`
17
27
 
18
28
  Create an agent home.
@@ -30,6 +40,23 @@ Remove an agent's own Archil disk, and everything on it.
30
40
 
31
41
  Route: `DELETE /agents/{agent_id}/archil`.
32
42
 
43
+ ### `agentrun agents disconnect-native AGENT_ID`
44
+
45
+ Disconnect future native jobs while retaining source configuration and history.
46
+
47
+ Route: `POST /agents/{agent_id}/native/disconnect`.
48
+
49
+ ### `agentrun agents discover-native`
50
+
51
+ Discover existing native projects on this source machine without running a model.
52
+
53
+ Route: `POST /native/discover`.
54
+
55
+ - `--project STRING` (string, required)
56
+ - `--runtime claude-code|codex` (string, one of these)
57
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
58
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
59
+
33
60
  ### `agentrun agents forget-sign-in AGENT_ID KEY`
34
61
 
35
62
  Forget one of the agent's saved sign-ins.
@@ -48,6 +75,18 @@ The agent's own Archil disk, once its first run made it.
48
75
 
49
76
  Route: `GET /agents/{agent_id}/archil`.
50
77
 
78
+ ### `agentrun agents get-learning-loop AGENT_ID`
79
+
80
+ The self-learning loop's own record: each compile turn, and each guarded step of the learned workflows.
81
+
82
+ Route: `GET /agents/{agent_id}/learning/loop`.
83
+
84
+ ### `agentrun agents get-native AGENT_ID`
85
+
86
+ Read a native connection.
87
+
88
+ Route: `GET /agents/{agent_id}/native`.
89
+
51
90
  ### `agentrun agents list`
52
91
 
53
92
  List agents.
@@ -59,6 +98,12 @@ Route: `GET /agents`.
59
98
  - `--archived` (boolean): true lists only archived agents; false, the default, the others.
60
99
  - `--all` (boolean, this CLI's own): every page: follows next_cursor and prints one list, its next_cursor null; stops past 1000 pages, exit 1
61
100
 
101
+ ### `agentrun agents list-learning-promotions AGENT_ID`
102
+
103
+ Each learned workflow revision's promotion: its replay's numbers and whether it serves.
104
+
105
+ Route: `GET /agents/{agent_id}/learning/promotions`.
106
+
62
107
  ### `agentrun agents runs AGENT_ID`
63
108
 
64
109
  The agent's runs index.
@@ -86,6 +131,101 @@ Route: `PUT /agents/{agent_id}/definition`.
86
131
  - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
87
132
  - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
88
133
 
134
+ ### `agentrun agents verify-native AGENT_ID`
135
+
136
+ Check native CLI and sign-in without a paid model call.
137
+
138
+ Route: `POST /agents/{agent_id}/native/verify`.
139
+
140
+ ## connectors
141
+
142
+ ### `agentrun connectors complete-remote-command CONNECTOR_ID COMMAND_ID`
143
+
144
+ Complete a source command once under its valid lease.
145
+
146
+ Route: `POST /connectors/{connector_id}/commands/{command_id}/complete`.
147
+
148
+ - `--lease-token STRING` (string, required)
149
+ - `--error STRING` (string)
150
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
151
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
152
+
153
+ ### `agentrun connectors enroll-remote-connector`
154
+
155
+ Create a ten-minute one-use connection code.
156
+
157
+ Route: `POST /connectors/enrollment`.
158
+
159
+ - `--label STRING` (string)
160
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
161
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
162
+
163
+ ### `agentrun connectors import-remote-history CONNECTOR_ID TARGET_ID`
164
+
165
+ Import explicitly selected, redacted past sessions without running or learning from them.
166
+
167
+ Route: `POST /connectors/{connector_id}/targets/{target_id}/history`.
168
+
169
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
170
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
171
+
172
+ ### `agentrun connectors import-remote-target CONNECTOR_ID`
173
+
174
+ Import an explicitly selected source-native agent reference.
175
+
176
+ Route: `POST /connectors/{connector_id}/import`.
177
+
178
+ - `--target-id STRING` (string, required)
179
+ - `--name STRING` (string)
180
+ - `--history-only` (boolean)
181
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
182
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
183
+
184
+ ### `agentrun connectors list-remote-connectors`
185
+
186
+ List remote source machines and imported agent targets.
187
+
188
+ Route: `GET /connectors`.
189
+
190
+ ### `agentrun connectors poll-remote-connector CONNECTOR_ID`
191
+
192
+ Renew active source leases and claim one command without replay.
193
+
194
+ Route: `POST /connectors/{connector_id}/poll`.
195
+
196
+ - `--worker-id STRING` (string, required)
197
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
198
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
199
+
200
+ ### `agentrun connectors register-remote-connector`
201
+
202
+ Exchange a one-use enrollment code for a connector-scoped credential.
203
+
204
+ Route: `POST /connectors`.
205
+
206
+ - `--installation-id STRING` (string, required)
207
+ - `--operation-id STRING` (string, required)
208
+ - `--label STRING` (string)
209
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
210
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
211
+
212
+ ### `agentrun connectors remote-command-events CONNECTOR_ID COMMAND_ID`
213
+
214
+ Append an ordered idempotent native event batch for a valid command lease.
215
+
216
+ Route: `POST /connectors/{connector_id}/commands/{command_id}/events`.
217
+
218
+ - `--lease-token STRING` (string, required)
219
+ - `--sequence INTEGER` (integer, required)
220
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
221
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
222
+
223
+ ### `agentrun connectors revoke-remote-connector CONNECTOR_ID`
224
+
225
+ Revoke a source connector and stop its outstanding commands.
226
+
227
+ Route: `DELETE /connectors/{connector_id}`.
228
+
89
229
  ## files
90
230
 
91
231
  ### `agentrun files create`
@@ -204,7 +344,7 @@ The agent's cost per run, run after run: its own cost, what learning added and t
204
344
  Route: `GET /agents/{agent_id}/learning/cost`.
205
345
 
206
346
  - `--limit INTEGER` (integer): The latest runs to answer, each keeping its number. At most 10000.
207
- - `--format json|csv` (string, one of these): `csv`: the runs as CSV, columns n, run_id, started_at, path, workflow, learned_revision, cost_usd, learning_usd, total_usd.
347
+ - `--format json|csv` (string, one of these): `csv`: the runs as CSV, columns n, run_id, started_at, path, workflow, learned_revision, cost_usd, cost_upper_bound, learning_usd, total_usd.
208
348
 
209
349
  ### `agentrun learning evals AGENT_ID`
210
350
 
@@ -262,6 +402,12 @@ Route: `POST /agents/{agent_id}/learning/evals`.
262
402
  - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
263
403
  - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
264
404
 
405
+ ### `agentrun learning replay AGENT_ID NAME DIGEST REPLAY_ID`
406
+
407
+ Read a replay's result: running, done or failed, its counts and its score (start one from the console's Learning tab).
408
+
409
+ Route: `GET /agents/{agent_id}/learning/workflows/{name}/revisions/{digest}/replays/{replay_id}`.
410
+
265
411
  ### `agentrun learning retire AGENT_ID FILE`
266
412
 
267
413
  Retire a note, a skill or a workflow draft: out of every later run, kept in history.
@@ -298,6 +444,12 @@ A code that pairs a person's own computer with this server.
298
444
 
299
445
  Route: `POST /computers/pairings`.
300
446
 
447
+ ### `agentrun local delete-composio-subscription NAME`
448
+
449
+ Delete the Composio project's webhook subscription, once no trigger uses it.
450
+
451
+ Route: `DELETE /settings/mcp-servers/{name}/composio/subscription`.
452
+
301
453
  ### `agentrun local delete-computer COMPUTER_ID`
302
454
 
303
455
  Remove a paired computer: its token ends and its socket closes.
@@ -328,6 +480,18 @@ Whether run folders are on Archil disks (Mode 2), the settings, and whether its
328
480
 
329
481
  Route: `GET /workspace/archil`.
330
482
 
483
+ ### `agentrun local list-composio-events NAME`
484
+
485
+ List a saved Composio server's toolkit's events, for a composio trigger.
486
+
487
+ Route: `GET /settings/mcp-servers/{name}/composio/events`.
488
+
489
+ ### `agentrun local list-composio-triggers NAME`
490
+
491
+ A saved Composio server's triggers, each with its instance's state on Composio.
492
+
493
+ Route: `GET /settings/mcp-servers/{name}/composio/triggers`.
494
+
331
495
  ### `agentrun local list-computer-choices PROVIDER`
332
496
 
333
497
  The values a computer provider's picked keys offer, read from the vendor.
@@ -340,6 +504,21 @@ Settings → Computers: the kinds of computer this server offers, each provider
340
504
 
341
505
  Route: `GET /computers`.
342
506
 
507
+ ### `agentrun local receive-hook-composio HOOK`
508
+
509
+ Fire a Composio trigger: a request it checks, no token.
510
+
511
+ Route: `POST /hooks/composio/{hook}`.
512
+
513
+ - `--body JSON|@FILE|-` (*/*, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
514
+ - `--body-type TYPE` (string): The body's type, one of */*; any other than JSON is sent as given.
515
+
516
+ ### `agentrun local rotate-composio-secret NAME`
517
+
518
+ Rotate the Composio project's webhook subscription's secret, and keep the new one.
519
+
520
+ Route: `POST /settings/mcp-servers/{name}/composio/rotate-secret`.
521
+
343
522
  ### `agentrun local test-computer PROVIDER`
344
523
 
345
524
  Test a computer provider's account with its saved keys.
@@ -408,6 +587,17 @@ List a saved MCP server's tools again, keep them, and say what changed.
408
587
 
409
588
  Route: `POST /settings/mcp-servers/{name}/refresh`.
410
589
 
590
+ ## Observations
591
+
592
+ ### `agentrun Observations get-observations`
593
+
594
+ Read activity and token usage reported by externally running agents.
595
+
596
+ Route: `GET /observations`.
597
+
598
+ - `--days INTEGER` (integer): UTC calendar days including today; session details remain visible for their full retention period.
599
+ - `--session-id STRING` (string)
600
+
411
601
  ## revisions
412
602
 
413
603
  ### `agentrun revisions list AGENT_ID`
@@ -474,7 +664,7 @@ Route: `POST /runs`.
474
664
  - `--effort low|medium|high` (string, one of these): How hard a run works. It sets the model's thinking level, and adds a short note on how to work right after the agent's instructions, on every harness: low answers directly, medium plans briefly and checks once, high plans each part, fills the gaps and reviews. A run started with none thinks at its agent revision's own thinking level, else the host's default, and gets no note.
475
665
  - `--max-cost-usd NUMBER` (number): This run's cap, for every turn of it. Default the definition's `max_cost_usd`, else the effort default.
476
666
  - `--quote-id STRING` (string): Run at a quote's terms. A different `effort` or `max_cost_usd` than the quote's is `409 quote_invalid`.
477
- - `--cap-mode expected|strict` (string, one of these): How the run's cap (`max_cost_usd`) prices each model request's input. `expected` (the default): the input the previous request of its conversation reported read from or written to the cache, at the cache-read price, when that request ended less than 4 minutes before; the rest of its input (the previous request's input after the cache, and what the conversation grew by since, a token a byte) at the input price, the cache write's when dearer. With no such request, all of it at that price. Output is limited to what the cap leaves, so output never passes it; a cache miss can, by at most the request's bound (its input uncached less its input expected), served as the run's `cost.overshoot_bound_usd` while it is in flight; its real cost is booked, and the timeline says so. `strict`: every input token at the input or cache-write price, the worst case: no request passes the cap, and a run pauses sooner. Only with a cap. Absent: the agent's (its definition's `cap_mode`), else expected. 422 not_allowed for a run with no cap.
667
+ - `--workflow-first` (boolean): Whether a run of an agent that learns may start on one of its learned workflows. On (absent or true), a run whose input fits exactly one active learned workflow (its input schema has a required field, and the run's input passes it) runs that workflow first, with no turn of the agent's model: its answer is the run's answer, and if it hands the job back (it escalates, a step fails), the same run goes on with the agent, given what the workflow found. The run keeps which path it took: `workflow`, `handed_back` or `agent`. false: the agent takes the run from its first turn.
478
668
  - `--learning use` (string, one of these): `use`: the run starts from what its agent learned (its notes, learned skills and learned workflows, as a run that learns is given them), whatever its agent's `learning` says, and keeps nothing: no end-of-run turn, no proposal, no grade and no merge, at its end or after a follow-up. Its `learning` reads `seeded` while it runs, then `dropped` with reason `use`. So many runs of one agent read one learned state, frozen (a held-out evaluation). On a server whose learning is off it is given nothing, as every run there. Absent: the agent's own (`learning: true` learns). 422 not_an_option for anything else.
479
669
  - `--repo STRING` (string): The GitHub repository (`owner/name`) this run reaches: the one its GitHub App token is made for, so its github MCP calls are scoped to it. It must be one the agent is bound to (a repository its GitHub triggers' `accept` names on `/repository/full_name`); another is 422 at `repo` in words naming the repositories it is bound to. Absent: the agent's repository when it is bound to exactly one and the first message names none; otherwise the repository a `https://github.com/<owner>/<repo>` URL in the first message names. A run a trigger starts takes its repository from its event, and `repo` there is 422.
480
670
  - `--hold` (boolean): true: the run claims its computer and holds it for its owner. Its agent waits until POST /runs/{run_id}/start; meanwhile POST /runs/{run_id}/computer/call sends the computer protocol calls, to set a task up. After the agent's end the run keeps the computer, for the owner's calls (to check what the agent left), until POST /runs/{run_id}/computer/release; then it ends as its agent did. A stop (POST /runs/{run_id}/stop) ends the agent and keeps the computer the same way, and the run ends stopped at the release; a cancel ends the run at once and lets the computer go. Each wait lets the computer go after `hold_minutes` with no call from the owner: before the start, the run then ends cancelled. The run read's `computer.held` says where the hold is. Only for an agent whose computer is a sandbox, a desktop or a phone, never a workflow (422 `hold` not_an_option otherwise). A run that loses its runner, or whose harness restarts after a fault, loses the computer it held: it fails, and `computer.held.why` is `lost`.
@@ -494,6 +684,18 @@ One run.
494
684
 
495
685
  Route: `GET /runs/{run_id}`.
496
686
 
687
+ ### `agentrun runs grade-run RUN_ID`
688
+
689
+ Grade an ended run's answer: right or wrong, and the fields a right answer holds.
690
+
691
+ Route: `PUT /runs/{run_id}/grade`.
692
+
693
+ - `--correct` (boolean, required)
694
+ - `--source feedback|eval` (string, one of these)
695
+ - `--label STRING` (string): The grade's words (a teacher's label, a reviewer's note): what the run's look-back or its workflow's revision ask reads.
696
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
697
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
698
+
497
699
  ### `agentrun runs graph RUN_ID`
498
700
 
499
701
  A workflow run's graph, live.
@@ -588,7 +790,7 @@ Route: `POST /agents/{agent_id}/runs`.
588
790
  - `--effort low|medium|high` (string, one of these): How hard a run works. It sets the model's thinking level, and adds a short note on how to work right after the agent's instructions, on every harness: low answers directly, medium plans briefly and checks once, high plans each part, fills the gaps and reviews. A run started with none thinks at its agent revision's own thinking level, else the host's default, and gets no note.
589
791
  - `--max-cost-usd NUMBER` (number): This run's cap, for every turn of it. Default the definition's `max_cost_usd`, else the effort default.
590
792
  - `--quote-id STRING` (string): Run at a quote's terms. A different `effort` or `max_cost_usd` than the quote's is `409 quote_invalid`.
591
- - `--cap-mode expected|strict` (string, one of these): How the run's cap (`max_cost_usd`) prices each model request's input. `expected` (the default): the input the previous request of its conversation reported read from or written to the cache, at the cache-read price, when that request ended less than 4 minutes before; the rest of its input (the previous request's input after the cache, and what the conversation grew by since, a token a byte) at the input price, the cache write's when dearer. With no such request, all of it at that price. Output is limited to what the cap leaves, so output never passes it; a cache miss can, by at most the request's bound (its input uncached less its input expected), served as the run's `cost.overshoot_bound_usd` while it is in flight; its real cost is booked, and the timeline says so. `strict`: every input token at the input or cache-write price, the worst case: no request passes the cap, and a run pauses sooner. Only with a cap. Absent: the agent's (its definition's `cap_mode`), else expected. 422 not_allowed for a run with no cap.
793
+ - `--workflow-first` (boolean): Whether a run of an agent that learns may start on one of its learned workflows. On (absent or true), a run whose input fits exactly one active learned workflow (its input schema has a required field, and the run's input passes it) runs that workflow first, with no turn of the agent's model: its answer is the run's answer, and if it hands the job back (it escalates, a step fails), the same run goes on with the agent, given what the workflow found. The run keeps which path it took: `workflow`, `handed_back` or `agent`. false: the agent takes the run from its first turn.
592
794
  - `--learning use` (string, one of these): `use`: the run starts from what its agent learned (its notes, learned skills and learned workflows, as a run that learns is given them), whatever its agent's `learning` says, and keeps nothing: no end-of-run turn, no proposal, no grade and no merge, at its end or after a follow-up. Its `learning` reads `seeded` while it runs, then `dropped` with reason `use`. So many runs of one agent read one learned state, frozen (a held-out evaluation). On a server whose learning is off it is given nothing, as every run there. Absent: the agent's own (`learning: true` learns). 422 not_an_option for anything else.
593
795
  - `--repo STRING` (string): The GitHub repository (`owner/name`) this run reaches: the one its GitHub App token is made for, so its github MCP calls are scoped to it. It must be one the agent is bound to (a repository its GitHub triggers' `accept` names on `/repository/full_name`); another is 422 at `repo` in words naming the repositories it is bound to. Absent: the agent's repository when it is bound to exactly one and the first message names none; otherwise the repository a `https://github.com/<owner>/<repo>` URL in the first message names. A run a trigger starts takes its repository from its event, and `repo` there is 422.
594
796
  - `--hold` (boolean): true: the run claims its computer and holds it for its owner. Its agent waits until POST /runs/{run_id}/start; meanwhile POST /runs/{run_id}/computer/call sends the computer protocol calls, to set a task up. After the agent's end the run keeps the computer, for the owner's calls (to check what the agent left), until POST /runs/{run_id}/computer/release; then it ends as its agent did. A stop (POST /runs/{run_id}/stop) ends the agent and keeps the computer the same way, and the run ends stopped at the release; a cancel ends the run at once and lets the computer go. Each wait lets the computer go after `hold_minutes` with no call from the owner: before the start, the run then ends cancelled. The run read's `computer.held` says where the hold is. Only for an agent whose computer is a sandbox, a desktop or a phone, never a workflow (422 `hold` not_an_option otherwise). A run that loses its runner, or whose harness restarts after a fault, loses the computer it held: it fails, and `computer.held.why` is `lost`.
@@ -631,6 +833,7 @@ Route: `GET /runs/{run_id}/timeline`.
631
833
  - `--after INTEGER` (integer): The change cursor last applied, from `next_after` or the last SSE `id`. 0 is the start.
632
834
  - `--wait-ms INTEGER` (integer): JSON only. How long to hold the request for a change after `after`.
633
835
  - `--limit INTEGER` (integer): At most this many rows in a page (1 to 500, default 500); has_more says when another waits.
836
+ - `--calls whole` (string, one of these): `whole`: each `tool_use` row carries its call's arguments (`tool_input`) and each `tool_result` row the head of its output to 8000 characters (`tool_result_text`; a web call's every url, only its long texts cut), both through the run's redaction, for a reader that grades the run (a template eval). Its rows are another page sequence: a cursor (`after`, `Last-Event-ID`) from one read goes with the same `calls`.
634
837
  - `--last-event-id STRING` (string): SSE reconnect. Same meaning as `after`, and wins over it.
635
838
  - `--follow` (boolean, this CLI's own): the timeline as it changes, one page per line (NDJSON), until the run ends; resumes a dropped connection
636
839
 
@@ -648,6 +851,55 @@ Route: `GET /runs/{run_id}/timeline, long-polled, then GET /runs/{run_id}`.
648
851
 
649
852
  - `--timeout SECONDS` (number, this CLI's own): stop waiting after this long, exit 1 (the run goes on)
650
853
 
854
+ ## sdk-runs
855
+
856
+ ### `agentrun sdk-runs complete RUN_ID`
857
+
858
+ Complete a backend SDK task.
859
+
860
+ Route: `POST /sdk-runs/{run_id}/complete`.
861
+
862
+ - `--idempotency-key STRING` (string)
863
+ - `--status completed|failed|cancelled` (string, one of these, required)
864
+ - `--answer STRING` (string, required)
865
+ - `--error STRING` (string)
866
+ - `--model STRING` (string)
867
+ - `--session-id STRING` (string)
868
+ - `--evidence-complete` (boolean)
869
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
870
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
871
+
872
+ ### `agentrun sdk-runs events RUN_ID`
873
+
874
+ Record bounded SDK execution evidence.
875
+
876
+ Route: `POST /sdk-runs/{run_id}/events`.
877
+
878
+ - `--idempotency-key STRING` (string)
879
+ - `--sequence INTEGER` (integer, required)
880
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
881
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
882
+
883
+ ### `agentrun sdk-runs get RUN_ID`
884
+
885
+ Read SDK run and learning state.
886
+
887
+ Route: `GET /sdk-runs/{run_id}`.
888
+
889
+ ### `agentrun sdk-runs start AGENT_ID`
890
+
891
+ Register a task executed by an existing backend SDK.
892
+
893
+ Route: `POST /agents/{agent_id}/sdk-runs`.
894
+
895
+ - `--idempotency-key STRING` (string, required)
896
+ - `--runtime claude-agent-sdk|codex-sdk` (string, one of these, required)
897
+ - `--input STRING` (string, required)
898
+ - `--instructions STRING` (string, required)
899
+ - `--model STRING` (string)
900
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
901
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
902
+
651
903
  ## server
652
904
 
653
905
  ### `agentrun server capabilities`
@@ -716,6 +968,12 @@ Route: `POST /templates/{template}/apply`.
716
968
  - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
717
969
  - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
718
970
 
971
+ ### `agentrun template delete TEMPLATE`
972
+
973
+ Remove an imported template package.
974
+
975
+ Route: `DELETE /templates/{template}`.
976
+
719
977
  ### `agentrun template eval DIR`
720
978
 
721
979
  Run a template package's eval cases as real runs of its agent and grade each run (real models cost money).
@@ -729,9 +987,30 @@ Route: none, it runs on this machine.
729
987
  - `--report FILE` (string, this CLI's own): the whole report, as JSON (a summary goes to stdout either way)
730
988
  - `--faux MODULE` (string, this CLI's own): answer every model request from MODULE's default export: no key, no network
731
989
 
990
+ ### `agentrun template import`
991
+
992
+ Import a template package from a public GitHub repository, or preview it (dry_run).
993
+
994
+ Route: `POST /templates/import`.
995
+
996
+ - `--source STRING` (string, required): Where the package is: `github:<owner>/<repo>[/<path>][@<ref>]` (the ref, a branch, tag or commit, defaults to the default branch), or the folder's https://github.com/<owner>/<repo>/tree/<ref>/<path> URL. A public repository on github.com alone.
997
+ - `--dry-run` (boolean): True: read and check the package and answer it, storing nothing (the install preview). Absent or false: store it, listed by GET /templates.
998
+ - `--trust-publisher` (boolean): The owner's "I trust <publisher>": needed (true) for the first import this server stores from a GitHub account, and remembered for that account. Never needed for a dry run.
999
+ - `--body JSON|@FILE|-` (application/json, required): The whole body: inline, from a file or from stdin. The flags above win over a JSON body's fields.
1000
+ - `--body-type TYPE` (string): The body's type, one of application/json; any other than JSON is sent as given.
1001
+
1002
+ ### `agentrun template install SOURCE`
1003
+
1004
+ Import a template package from GitHub (github:OWNER/REPO[/PATH][@REF]) and print the console page that applies it.
1005
+
1006
+ Route: none, it runs on this machine.
1007
+
1008
+ - `--dry-run` (boolean, this CLI's own): check the package and print it whole (instructions, skill files); store nothing
1009
+ - `--trust` (boolean, this CLI's own): trust the package's publisher (the GitHub owner): the first package from one needs it
1010
+
732
1011
  ### `agentrun template list`
733
1012
 
734
- The template packages this server ships: each makes an agent, its skills and its triggers.
1013
+ The template packages this server ships, and those imported here: each makes an agent, its skills and its triggers.
735
1014
 
736
1015
  Route: `GET /templates`.
737
1016