@parcha/agentrun 0.3.6 → 0.4.0

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/start.mjs CHANGED
@@ -31,17 +31,19 @@ export function openLineUrl(line, publicUrl) {
31
31
  export const TAIL_LINES = 20;
32
32
 
33
33
  /** The server's lines this command says too, as they come: its banner's boxes line (whether new agents get the Docker
34
- * box, or why not) and the Docker box image's first build, as it starts and ends. */
35
- export const SAID = /^(Boxes: |Preparing the Docker box image |The Docker box image )/;
34
+ * box, or why not), the Docker box image's first build, as it starts and ends, and, on a server with a public address
35
+ * and no password yet, the setup link with its code, which setup at that address asks for. */
36
+ export const SAID = /^(Boxes: |Preparing the Docker box image |The Docker box image |Set up this server: )/;
36
37
 
37
38
  /** The address a person opens first, as the server says it: the URL of the first "Open " line of its output that names
38
39
  * one (openLineUrl). That line is the server's interface for it (the plain address today, a single-use sign-in link
39
40
  * once the server prints one), so this command never builds the address itself. Resolves undefined when the output ends
40
- * without one. Until then, the last TAIL_LINES lines before it are kept in `seen`: what a start that fails shows. Every
41
- * whole line after it goes to `onLine`; the rest of the output is read and dropped, so the server never blocks on a full
42
- * pipe. */
43
- export function openUrl(stdout, publicUrl, seen = [], onLine = () => {}) {
41
+ * without one. Until then, the last TAIL_LINES lines before it are kept in `seen`: what a start that fails shows, and each
42
+ * goes to `onBefore`. Every whole line after it goes to `onLine`; the rest of the output is read and dropped, so the
43
+ * server never blocks on a full pipe. */
44
+ export function openUrl(stdout, publicUrl, seen = [], onLine = () => {}, onBefore = () => {}) {
44
45
  const keep = (line) => {
46
+ onBefore(line);
45
47
  seen.push(line);
46
48
  if (seen.length > TAIL_LINES) seen.shift();
47
49
  };
@@ -99,7 +101,7 @@ export function npmExecOf(env, from = process.ppid) {
99
101
  }
100
102
 
101
103
  export const USAGE = `Usage: npx @parcha/agentrun [--port N] [--data DIR] [--no-open] start the server
102
- npx @parcha/agentrun import|reset-password [--data DIR] a server command
104
+ npx @parcha/agentrun import|reset-password|runner [--data DIR] a server command (runner: one more runner on this store)
103
105
  npx @parcha/agentrun <command> [args] the server's API: agents, runs, triggers, ..., api (npx @parcha/agentrun help)`;
104
106
 
105
107
  /** The server's launcher, installed with this package (its dependency), or undefined. */
@@ -115,8 +117,61 @@ export function installedServer(resolve = createRequire(import.meta.url).resolve
115
117
  * --open, which itself skips a CI run and a machine with no display). */
116
118
  export const serverArgs = (argv) => (argv.includes("--no-open") ? argv.filter((arg) => arg !== "--no-open") : ["--open", ...argv]);
117
119
 
120
+ /** The server's own commands (its CLI's first word), which this command runs on its store: every other first word is
121
+ * the CLI's, which names a command it has or says it has none. */
122
+ export const SERVER_COMMANDS = ["eval-template", "import", "reset-password", "runner", "validate-template"];
123
+
124
+ /** How many of the server's refusals and ignored deliveries a start says, each route and reason once, before one line
125
+ * that says the rest are not: under this command the server's log goes nowhere else (its stdout is read here and dropped). */
126
+ export const TOLD_MAX = 20;
127
+
128
+ /** Why a request was refused, in words, by the server's reason; any other reason is said as the server names it. */
129
+ const REFUSED = new Map([
130
+ ["wrong_token", "the API token is not this server's"],
131
+ ["no_credential", "it carried no API token"],
132
+ ["wrong_password", "the password is wrong"],
133
+ ["sign_in_table_full", "a sign-in from more addresses than the limit counts one by one"],
134
+ ]);
135
+
136
+ /** The fields of one of the server's log lines (print.ts: `key=value` or `key="value"`); a repeated key keeps its first
137
+ * value, the line's own event. */
138
+ function fieldsOf(line) {
139
+ const fields = {};
140
+ for (const [, key, quoted, plain] of line.matchAll(/(?:^| )([\w-]+)=(?:"([^"]*)"|(\S+))/g)) if (!(key in fields)) fields[key] = quoted ?? plain;
141
+ return fields;
142
+ }
143
+
144
+ /** A teller for one start: given a line of the server's output, what to say of it to the person, or undefined. A refused
145
+ * request (auth_failed) and a verified webhook delivery its trigger does not take (hook_ignored) are said in words, with
146
+ * their route and reason and never what was sent, each route and reason once, at most TOLD_MAX. With AGENTRUN_LOG=quiet,
147
+ * as this command starts the server, those lines are all an operator would otherwise miss. */
148
+ export function tellerOf() {
149
+ const said = new Set();
150
+ let full = false;
151
+ return (line) => {
152
+ const fields = fieldsOf(line);
153
+ let words;
154
+ let key;
155
+ if (fields.event === "auth_failed" && fields.route) {
156
+ key = `auth ${fields.route} ${fields.reason}`;
157
+ words = `AgentRun refused a request to ${fields.route}: ${REFUSED.get(fields.reason) ?? fields.reason}.`;
158
+ } else if (fields.event === "trigger" && fields.condition === "hook_ignored" && fields.route) {
159
+ const hookEvent = [...line.matchAll(/ event=(\S+)/g)][1]?.[1];
160
+ key = `hook ${fields.route} ${fields.reason}`;
161
+ words = `AgentRun ignored a webhook delivery to ${fields.route} (${fields.source}${hookEvent ? `, event ${hookEvent}` : ""}): ${fields.reason}.`;
162
+ } else return undefined;
163
+ if (said.has(key) || full) return undefined;
164
+ if (said.size >= TOLD_MAX) return (full = true), "AgentRun refuses more requests than this terminal shows; it says no more of them here.";
165
+ said.add(key);
166
+ return said.size === 1 ? `${words} (Each route and reason is said once.)` : words;
167
+ };
168
+ }
169
+
118
170
  export async function main(argv, env = process.env) {
119
- if (NOUNS.has(words(argv)[0])) return cli(argv, env);
171
+ // The first argument, past --data and its value: a word there names a command (the server's own, or else the CLI's),
172
+ // and a flag starts the server, whose flags with values (--listen ADDR) follow.
173
+ const first = argv.find((arg, i) => arg !== "--data" && !arg.startsWith("--data=") && argv[i - 1] !== "--data");
174
+ if (NOUNS.has(words(argv)[0]) || (first !== undefined && !first.startsWith("-") && !SERVER_COMMANDS.includes(first))) return cli(argv, env);
120
175
  if (argv.includes("--help") || argv.includes("-h")) return console.log(USAGE), 0;
121
176
  if (process.platform === "win32") return console.error("AgentRun's server runs on macOS and Linux; on Windows, use WSL or its container."), 1;
122
177
  const launcher = installedServer();
@@ -144,7 +199,21 @@ export async function main(argv, env = process.env) {
144
199
  // A name that starts with a dash keeps the equals form: the server's parser reads "--data -x" as a missing value.
145
200
  const data = dataDir.startsWith("-") ? [`--data=${dataDir}`] : ["--data", dataDir];
146
201
  if (rest[0] && !rest[0].startsWith("-")) {
147
- return new Promise((resolve) => spawn(launcher, [rest[0], ...data, ...rest.slice(1)], { stdio: "inherit", env: childEnv }).on("exit", (code) => resolve(code ?? 1)));
202
+ // A server command (an eval among them, which spends while it runs): a stop sent to this command alone (a job
203
+ // runner's SIGTERM, a SIGHUP) is passed on, and this waits for the command to clean up and end. A hangup is passed
204
+ // on as a SIGTERM, which every server command stops on.
205
+ const child = spawn(launcher, [rest[0], ...data, ...rest.slice(1)], { stdio: "inherit", env: childEnv });
206
+ const codes = { SIGINT: 130, SIGTERM: 143, SIGHUP: 129 };
207
+ const pass = Object.fromEntries(Object.keys(codes).map((signal) => [signal, () => child.kill(signal === "SIGHUP" ? "SIGTERM" : signal)]));
208
+ for (const [signal, on] of Object.entries(pass)) process.on(signal, on);
209
+ return new Promise((resolve) => {
210
+ const done = (code) => {
211
+ for (const [signal, on] of Object.entries(pass)) process.off(signal, on);
212
+ resolve(code);
213
+ };
214
+ child.on("error", () => done(1));
215
+ child.on("exit", (code, signal) => done(code ?? codes[signal] ?? 1));
216
+ });
148
217
  }
149
218
  // The server's banner and request lines stay out of this terminal: one line here says where to go, the URL of the
150
219
  // server's own "Open " line; the lines SAID names go to stderr after it, for the person, so stdout stays that one line.
@@ -175,14 +244,20 @@ export async function main(argv, env = process.env) {
175
244
  let timer;
176
245
  let told = false;
177
246
  const held = [];
178
- const tell = (line) => SAID.test(line) && (told ? console.error(line) : held.push(line));
247
+ const teller = tellerOf();
248
+ const tell = (line) => {
249
+ const said = SAID.test(line) ? line : teller(line);
250
+ if (said !== undefined) told ? console.error(said) : held.push(said);
251
+ };
252
+ // A SAID line can come before the "Open " line too (the setup link is printed as the server attaches its owner, before
253
+ // its banner): it is held and said first, in order.
179
254
  const seen = [];
180
- const url = await Promise.race([openUrl(child.stdout, env.AGENTRUN_PUBLIC_URL, seen, tell), new Promise((resolve) => { timer = setTimeout(resolve, 60_000); })]);
255
+ const url = await Promise.race([openUrl(child.stdout, env.AGENTRUN_PUBLIC_URL, seen, tell, tell), new Promise((resolve) => { timer = setTimeout(resolve, 60_000); })]);
181
256
  clearTimeout(timer);
182
257
  if (url === undefined) {
183
258
  child.kill("SIGTERM");
184
259
  // Its stdout is kept out of this terminal, so its last lines are shown here: with its stderr above, they say why.
185
- console.error(seen.length > 0 ? `AgentRun did not start. The server's last lines:\n${seen.map((line) => ` ${line}`).join("\n")}` : "AgentRun did not start, and the server printed nothing.");
260
+ console.error(seen.length > 0 ? `AgentRun did not start. The server's last lines:\n${seen.map((line) => ` ${line}`).join("\n")}` : "AgentRun did not start; the server's own message, if it gave one, is above.");
186
261
  return (await exited) || 1;
187
262
  }
188
263
  console.log(`AgentRun is running at ${url}`);
@@ -0,0 +1,75 @@
1
+ // `agentrun template validate DIR`: a template package folder checked on this machine by the server's own validator,
2
+ // the one a server runs on the packages it ships at its start. The server installed with this command checks it
3
+ // (agentrun-serve validate-template), as it runs import and reset-password: this command reaches the server through its
4
+ // launcher and its API alone. Nothing in the package runs.
5
+ import { spawn, spawnSync } from "node:child_process";
6
+ import { resolve } from "node:path";
7
+
8
+ export const TEMPLATE_VALIDATE = {
9
+ command: ["template", "validate"],
10
+ pathParams: ["dir"],
11
+ summary: "Check a template package folder (agent.md, skills/, rules/, evals/) as a server does before it applies one",
12
+ help: [["DIR", "the package's folder: its name is the package's name. Prints what it holds, or each problem (exit 1)"]],
13
+ options: {},
14
+ async run({ args, cli }) {
15
+ // Loaded here: start.mjs loads cli.mjs, which loads this module.
16
+ const { installedServer } = await import("./start.mjs");
17
+ const launcher = installedServer();
18
+ if (launcher === undefined) throw cli.fail(2, "AgentRun's server is not installed beside this command, and it is the server that checks a package.");
19
+ return spawnSync(launcher, ["validate-template", resolve(args[0])], { stdio: "inherit" }).status ?? 1;
20
+ },
21
+ };
22
+
23
+ // `agentrun template eval DIR`: the package's eval cases run as real runs of its agent and graded (agentrun-serve
24
+ // eval-template, templates/README.md "Running the evals"), on a server the command starts in its own process over a temp
25
+ // data directory, or with --server on that one, its token found as every other command finds it (AGENTRUN_API_KEY, the
26
+ // CLI's config, or the data directory's .token for the server on this machine) and handed to the server's launcher in
27
+ // AGENTRUN_API_KEY, which moves it to a pipe: never in an argument, never printed. Its exit is the eval's: 0 every case
28
+ // passed, 1 one failed, 2 nothing ran (the flags, the package or a case are wrong).
29
+ export const TEMPLATE_EVAL = {
30
+ command: ["template", "eval"],
31
+ pathParams: ["dir"],
32
+ summary: "Run a template package's eval cases as real runs of its agent and grade each run (real models cost money)",
33
+ help: [
34
+ ["DIR", "the package's folder"],
35
+ ["--case NAME", "a case to run (repeat it); without one, every case"],
36
+ ["--runs N", "how many runs of each case, in place of each case's own runs"],
37
+ ["--server URL", "run on that server, with its token (AGENTRUN_API_KEY), instead of on a server of its own over a temp data directory"],
38
+ ["--grader-model PROVIDER/MODEL", "the model of the llm graders (default: the server's)"],
39
+ ["--report FILE", "the whole report, as JSON (a summary goes to stdout either way)"],
40
+ ["--faux MODULE", "answer every model request from MODULE's default export: no key, no network"],
41
+ ],
42
+ options: { case: { type: "string", multiple: true }, runs: { type: "string" }, server: { type: "string" }, "grader-model": { type: "string" }, report: { type: "string" }, faux: { type: "string" } },
43
+ async run({ values, args, env, cli }) {
44
+ const { installedServer } = await import("./start.mjs");
45
+ const launcher = installedServer();
46
+ if (launcher === undefined) throw cli.fail(2, "AgentRun's server is not installed beside this command, and it is the server that runs an eval.");
47
+ const argv = ["eval-template", resolve(args[0])];
48
+ for (const name of values.case ?? []) argv.push("--case", name);
49
+ if (values.runs !== undefined) argv.push("--runs", values.runs);
50
+ if (values["grader-model"] !== undefined) argv.push("--grader-model", values["grader-model"]);
51
+ if (values.report !== undefined) argv.push("--report", resolve(values.report));
52
+ if (values.faux !== undefined) argv.push("--faux", resolve(values.faux));
53
+ let childEnv = env;
54
+ if (values.server !== undefined) {
55
+ const { base, token } = cli.targetOf({ ...values, "base-url": values.server }, env);
56
+ argv.push("--server", base);
57
+ childEnv = { ...env, AGENTRUN_API_KEY: token };
58
+ }
59
+ // A stop sent to this command alone (a job runner's SIGTERM, a SIGHUP) is passed on to the eval, which cancels its
60
+ // run and cleans up before it exits, as it does on the Ctrl-C a terminal sends both: this command waits for that.
61
+ const child = spawn(launcher, argv, { stdio: "inherit", env: childEnv });
62
+ const signals = { SIGINT: 130, SIGTERM: 143, SIGHUP: 129 };
63
+ // The eval stops on SIGINT and SIGTERM; a hangup is passed on as a SIGTERM, which it cleans up after.
64
+ const pass = Object.fromEntries(Object.keys(signals).map((signal) => [signal, () => child.kill(signal === "SIGHUP" ? "SIGTERM" : signal)]));
65
+ for (const [signal, on] of Object.entries(pass)) process.on(signal, on);
66
+ try {
67
+ return await new Promise((done) => {
68
+ child.on("error", () => done(1));
69
+ child.on("exit", (code, signal) => done(code ?? signals[signal] ?? 1));
70
+ });
71
+ } finally {
72
+ for (const [signal, on] of Object.entries(pass)) process.off(signal, on);
73
+ }
74
+ },
75
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "Start AgentRun on this machine with one command: npx @parcha/agentrun",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -10,18 +10,19 @@
10
10
  "files": [
11
11
  "bin",
12
12
  "lib",
13
+ "skills",
13
14
  "README.md",
14
15
  "LICENSE",
15
16
  "NOTICE"
16
17
  ],
17
18
  "dependencies": {
18
- "@parcha/agentrun-serve": "0.1.0-beta.31"
19
+ "@parcha/agentrun-serve": "0.1.0-beta.32"
19
20
  },
20
21
  "scripts": {
21
22
  "test": "node --test 'test/*.test.mjs'"
22
23
  },
23
24
  "engines": {
24
- "node": ">=22.19.0"
25
+ "node": ">=24.11.0"
25
26
  },
26
27
  "repository": {
27
28
  "type": "git",
@@ -0,0 +1,138 @@
1
+ ---
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).
4
+ ---
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): 24f2349fab8ff1d67f4389be8fc8a1c081bbf22f0cf88383b9159a1d78b555c3 -->
7
+
8
+ # AgentRun CLI
9
+
10
+ `agentrun` drives an AgentRun server (the open platform's server for agents) through its API. It is the command `npm install -g @parcha/agentrun` puts on the PATH; without it, write `npx @parcha/agentrun` in its place. Each command prints the server's JSON answer on stdout, one line when piped, and an error's JSON on stderr. `agentrun help` lists the commands, `agentrun GROUP COMMAND --help` gives one's flags, and [references/commands.md](references/commands.md) has every command with its flags and route.
11
+
12
+ ## The server and the token
13
+
14
+ The first of these that is set wins:
15
+
16
+ 1. `--base-url URL` (the API, ending `/v2`), else `AGENTRUN_BASE_URL`, with the token in `AGENTRUN_API_KEY`.
17
+ 2. The config file `$XDG_CONFIG_HOME/agentrun/config.json` (else `~/.config/agentrun/config.json`), written by `agentrun login`, which checks the token first. The CLI refuses the file if anyone else can read it.
18
+ 3. The server started on this machine with `npx @parcha/agentrun`, whose data directory (`~/.agentrun`, or `--data DIR`) says where it listens and holds its token: nothing to set.
19
+
20
+ The token goes on stdin, never on the command line:
21
+
22
+ ```sh
23
+ agentrun login --base-url "$AGENTRUN_BASE_URL" < token.txt
24
+ ```
25
+
26
+ 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).
27
+
28
+ ## Recipes
29
+
30
+ 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.
31
+
32
+ ### 1. Make an agent from a definition file
33
+
34
+ ```sh
35
+ cat > agent.json <<'EOF'
36
+ {"definition": {"id": "notes", "version": 1, "name": "Notes", "instructions": "Do what you are asked, and write what you make to a file.", "skills": [], "tools": ["write", "ask_person"]}}
37
+ EOF
38
+ agentrun agents create --body @agent.json
39
+ # exit 0: the agent; exit 1 with error.code agent_exists: agentrun agents update notes --body @agent.json makes its next revision
40
+ ```
41
+
42
+ Ask the person before you create or change an agent. `agentrun server capabilities` lists the harnesses, models and tools this server has.
43
+
44
+ ### 2. Start a run with a spend cap and wait for it
45
+
46
+ ```sh
47
+ agentrun runs start notes --max-cost-usd 5 --body '{"input": {"content": "Write notes.md with three facts about the Moon."}}' --wait > out.json
48
+ # exit 0 completed (result.final_answer); 1 failed or cancelled (error says why); 8 it waits on a person (recipe 3)
49
+ ```
50
+
51
+ `--wait` follows the run until it ends or needs a person, and `--timeout SECONDS` stops waiting (exit 1, the run goes on). `agentrun runs wait RUN_ID` waits again; `agentrun runs timeline RUN_ID --follow` prints each step as it comes.
52
+
53
+ ### 3. Answer a run that asks
54
+
55
+ ```sh
56
+ agentrun runs start notes --max-cost-usd 5 --body '{"input": {"content": "Ask me which region to cover, then write region.md about it."}}' --wait > out.json
57
+ # exit 8: it waits on a person; out.json has pending.kind question and pending.question, what it asks
58
+ ```
59
+
60
+ Answer only what the person told you, or ask them. Then:
61
+
62
+ ```sh
63
+ run=$(node -p 'require("./out.json").run_id')
64
+ agentrun runs message "$run" --content "Europe"
65
+ agentrun runs wait "$run" > out.json
66
+ # exit 0 completed, as in recipe 2
67
+ ```
68
+
69
+ ### 4. Read what it wrote and what it cost
70
+
71
+ ```sh
72
+ run=$(node -p 'require("./out.json").run_id')
73
+ agentrun runs files "$run"
74
+ agentrun runs read-file "$run" region.md
75
+ agentrun runs get "$run" > out.json && node -p 'JSON.stringify(require("./out.json").cost)'
76
+ # exit 0: files lists each path, read-file prints one file, cost.usd is what it spent and cap_usd its cap
77
+ ```
78
+
79
+ `cost.usd` is null while the cost is unknown: never report it as $0. Tell the person the outcome and give them the run's `console_url`.
80
+
81
+ ### 5. Raise a cap or approve a call
82
+
83
+ A run stopped at its spend cap, or waiting for a tool call to be approved, exits 8 with `pending.kind` `budget` or `approval` in out.json.
84
+
85
+ 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`:
86
+
87
+ ```sh
88
+ 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
89
+ # exit 8 once it stops at its cap: out.json has pending.kind budget, with cap_usd, spent_usd and suggested_cap_usd; 0 if the cap was enough
90
+ ```
91
+
92
+ Only the person who set the cap raises it: ask them for the new cap (`pending.suggested_cap_usd` is one that lets it go on). Then the run goes on from where it stopped:
93
+
94
+ ```sh
95
+ run=$(node -p 'require("./out.json").run_id')
96
+ agentrun runs raise-cap "$run" --max-cost-usd 1
97
+ agentrun runs wait "$run" > out.json
98
+ # exit 0 completed, as in recipe 2
99
+ ```
100
+
101
+ A tool call waiting for approval (`pending.kind` `approval`) is answered by the person in the console (the run's `console_url`): the server takes that answer only from their own session there, never from a token, so the CLI has no command for it. Tell them, then `agentrun runs wait "$run"` once they have.
102
+
103
+ ## Exit codes
104
+
105
+ - 0: done; for `runs wait` and `runs start --wait`, the run completed.
106
+ - 1: the server refused (its error JSON on stderr); for a wait, the run failed or was cancelled, or `--timeout` passed.
107
+ - 2: bad usage, nothing sent: a bad flag or argument, or a base URL that is not http or https or has a query, a fragment, a user or a password.
108
+ - 3: the server cannot be reached.
109
+ - 4: no token, the token was refused, or the config file, the local server's record or its token file was refused (open to others, or not what it should hold).
110
+ - 8: the run waits on a person: a question, its spend cap, a stopped turn, or a paused workflow. stderr says what to run next.
111
+
112
+ ## From a program
113
+
114
+ Two clients call the same API from code, with the same server and token. `@parcha/agentrun-client` is the TypeScript one, `new AgentRun({ baseUrl, apiKey })`; `npm install @parcha/agentrun-client` installs it. `parcha-agentrun` (python/) is the Python one, `AgentRun(base_url=..., api_key=...)` from the `agentrun` module; `pip install parcha-agentrun` installs it. Both default to `AGENTRUN_BASE_URL` and `AGENTRUN_API_KEY` and read no config file. Each command here is a method, grouped the same way: `agentrun runs start` is `client.runs.start`, and `client.runs.wait` and `client.runs.follow` do what `--wait` and `--follow` do.
115
+
116
+ ## Commands
117
+
118
+ - `agentrun agents`: archive, create, forget-sign-in, get, list, runs, unarchive, update
119
+ - `agentrun files`: create, delete, get, list, upload
120
+ - `agentrun home`: delete, list, read, write
121
+ - `agentrun learning`: get, log, notes, read, retire, write
122
+ - `agentrun local`: connect-git-hub, delete-workspace-archil, disconnect-git-hub, get-git-hub-connection, get-workspace-archil, git-hub-callback, git-hub-installed, list-computers, receive-hook-github, test-computer, test-workspace-archil
123
+ - `agentrun login`: Check a server's token, read from stdin, and keep it with the server's address in the config file
124
+ - `agentrun logout`: Remove the config file login wrote, its address and token
125
+ - `agentrun mcp-servers`: delete, get, list, oauth-client, private-hosts, refresh
126
+ - `agentrun revisions`: list, set-current
127
+ - `agentrun runs`: archive, cancel, create-inline-run, files, get, graph, hand-back-run-computer, learning, learning-diff, list, message, pause, raise-cap, read-file, resume, start, stop, take-over-run-computer, timeline, unarchive, wait
128
+ - `agentrun server`: capabilities, health, mcp, openapi
129
+ - `agentrun skill`: install
130
+ - `agentrun stats`: Counts and cost over every agent and run
131
+ - `agentrun template`: apply, eval, list, validate
132
+ - `agentrun tool-keys`: list
133
+ - `agentrun tool-settings`: get, save
134
+ - `agentrun triggers`: create, delete, fire, firings, get, list, rotate-secret, update
135
+ - `agentrun usage`: Usage by meter over a period
136
+ - `agentrun webhook`: delete, deliveries, get, redeliver, save, test
137
+ - `agentrun workflows`: validate
138
+ - `agentrun api METHOD PATH [--body JSON|@FILE|-]`: any route, PATH under the base URL