@parcha/agentrun-serve 0.0.0-stage → 0.1.0-beta.30

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.
Files changed (273) hide show
  1. package/CHANGELOG.md +748 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +5 -0
  4. package/README.md +2190 -2
  5. package/dist/adapters.d.ts +234 -0
  6. package/dist/adapters.js +585 -0
  7. package/dist/agents.d.ts +130 -0
  8. package/dist/agents.js +308 -0
  9. package/dist/app.d.ts +7 -0
  10. package/dist/app.js +384 -0
  11. package/dist/background.d.ts +28 -0
  12. package/dist/background.js +376 -0
  13. package/dist/bound-files.d.ts +4 -0
  14. package/dist/bound-files.js +164 -0
  15. package/dist/box/record.d.ts +6 -0
  16. package/dist/box/record.js +41 -0
  17. package/dist/box/sweep.d.ts +53 -0
  18. package/dist/box/sweep.js +193 -0
  19. package/dist/box-egress.d.ts +98 -0
  20. package/dist/box-egress.js +259 -0
  21. package/dist/box-image.d.ts +98 -0
  22. package/dist/box-image.js +285 -0
  23. package/dist/box-relay-vm.d.ts +80 -0
  24. package/dist/box-relay-vm.js +389 -0
  25. package/dist/box-relay.d.ts +45 -0
  26. package/dist/box-relay.js +227 -0
  27. package/dist/boxes.d.ts +72 -0
  28. package/dist/boxes.js +189 -0
  29. package/dist/browser-cost.d.ts +41 -0
  30. package/dist/browser-cost.js +158 -0
  31. package/dist/cap.d.ts +332 -0
  32. package/dist/cap.js +992 -0
  33. package/dist/catalog.d.ts +20 -0
  34. package/dist/catalog.js +53 -0
  35. package/dist/cli.d.ts +2 -0
  36. package/dist/cli.js +167 -0
  37. package/dist/coding-tools.d.ts +35 -0
  38. package/dist/coding-tools.js +87 -0
  39. package/dist/console/THIRD-PARTY-NOTICES.txt +1721 -0
  40. package/dist/console/assets/index-34jfpIbQ.js +481 -0
  41. package/dist/console/assets/index-DUHbWcIP.css +1 -0
  42. package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  43. package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-CIEtRijs.woff +0 -0
  44. package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-BB5xRk30.woff +0 -0
  45. package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
  46. package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-BHyURHCj.woff +0 -0
  47. package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-C_uLvvQ5.woff2 +0 -0
  48. package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-Dj6eZy5f.woff2 +0 -0
  49. package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-DpeVePZf.woff +0 -0
  50. package/dist/console/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  51. package/dist/console/assets/jetbrains-mono-greek-400-normal-CNojz0t3.woff +0 -0
  52. package/dist/console/assets/jetbrains-mono-greek-600-normal-3KAm9r92.woff +0 -0
  53. package/dist/console/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
  54. package/dist/console/assets/jetbrains-mono-latin-400-normal-B11XCQ5g.woff +0 -0
  55. package/dist/console/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  56. package/dist/console/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  57. package/dist/console/assets/jetbrains-mono-latin-600-normal-DXv3JcnD.woff +0 -0
  58. package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  59. package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-DHMOLxAi.woff +0 -0
  60. package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  61. package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-DiQlUoE6.woff +0 -0
  62. package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-BeU3T8wf.woff +0 -0
  63. package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-ByoDsISC.woff2 +0 -0
  64. package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-CSpzN4cI.woff +0 -0
  65. package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-Dtizs43-.woff2 +0 -0
  66. package/dist/console/assets/schibsted-grotesk-latin-400-normal-Cph9ettZ.woff2 +0 -0
  67. package/dist/console/assets/schibsted-grotesk-latin-400-normal-DfGZKnlb.woff +0 -0
  68. package/dist/console/assets/schibsted-grotesk-latin-600-normal-BGBUNdzT.woff2 +0 -0
  69. package/dist/console/assets/schibsted-grotesk-latin-600-normal-COje25QW.woff +0 -0
  70. package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-4l4lq8zr.woff2 +0 -0
  71. package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-BGzXWJeR.woff +0 -0
  72. package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-8_E36CQj.woff2 +0 -0
  73. package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-C27an7Zc.woff +0 -0
  74. package/dist/console/index.html +15 -0
  75. package/dist/content-filter.d.ts +7 -0
  76. package/dist/content-filter.js +23 -0
  77. package/dist/daytona-api.d.ts +21 -0
  78. package/dist/daytona-api.js +101 -0
  79. package/dist/decision-rows.d.ts +19 -0
  80. package/dist/decision-rows.js +123 -0
  81. package/dist/decisions.d.ts +94 -0
  82. package/dist/decisions.js +184 -0
  83. package/dist/effort-guidance.d.ts +5 -0
  84. package/dist/effort-guidance.js +14 -0
  85. package/dist/environment.d.ts +5 -0
  86. package/dist/environment.js +11 -0
  87. package/dist/errors.d.ts +74 -0
  88. package/dist/errors.js +69 -0
  89. package/dist/exa-keyless.d.ts +35 -0
  90. package/dist/exa-keyless.js +202 -0
  91. package/dist/fetch-page.d.ts +114 -0
  92. package/dist/fetch-page.js +182 -0
  93. package/dist/files.d.ts +65 -0
  94. package/dist/files.js +158 -0
  95. package/dist/grade.d.ts +93 -0
  96. package/dist/grade.js +328 -0
  97. package/dist/graph-served.d.ts +23 -0
  98. package/dist/graph-served.js +75 -0
  99. package/dist/graph-view.d.ts +102 -0
  100. package/dist/graph-view.js +219 -0
  101. package/dist/harness-app.d.ts +40 -0
  102. package/dist/harness-app.js +708 -0
  103. package/dist/harness-opencode/adapter.d.ts +45 -0
  104. package/dist/harness-opencode/adapter.js +272 -0
  105. package/dist/harness-opencode/binary.d.ts +18 -0
  106. package/dist/harness-opencode/binary.js +87 -0
  107. package/dist/harness-opencode/config.d.ts +24 -0
  108. package/dist/harness-opencode/config.js +61 -0
  109. package/dist/harness-opencode/harness.d.ts +77 -0
  110. package/dist/harness-opencode/harness.js +620 -0
  111. package/dist/harness-opencode/host/mcp.d.ts +40 -0
  112. package/dist/harness-opencode/host/mcp.js +208 -0
  113. package/dist/harness-opencode/host/policy.d.ts +71 -0
  114. package/dist/harness-opencode/host/policy.js +419 -0
  115. package/dist/harness-opencode/host/server.d.ts +55 -0
  116. package/dist/harness-opencode/host/server.js +165 -0
  117. package/dist/harness-opencode/index.d.ts +9 -0
  118. package/dist/harness-opencode/index.js +6 -0
  119. package/dist/harness-opencode/verify.d.ts +32 -0
  120. package/dist/harness-opencode/verify.js +75 -0
  121. package/dist/harness-opencode/versions.d.ts +33 -0
  122. package/dist/harness-opencode/versions.js +64 -0
  123. package/dist/harness.d.ts +56 -0
  124. package/dist/harness.js +77 -0
  125. package/dist/home-path.d.ts +27 -0
  126. package/dist/home-path.js +78 -0
  127. package/dist/host-tools.d.ts +30 -0
  128. package/dist/host-tools.js +154 -0
  129. package/dist/host.d.ts +39 -0
  130. package/dist/host.js +85 -0
  131. package/dist/hosted-search.d.ts +27 -0
  132. package/dist/hosted-search.js +133 -0
  133. package/dist/import-sources.d.ts +104 -0
  134. package/dist/import-sources.js +629 -0
  135. package/dist/import-summary.d.ts +25 -0
  136. package/dist/import-summary.js +75 -0
  137. package/dist/import-worker.d.ts +26 -0
  138. package/dist/import-worker.js +41 -0
  139. package/dist/import.d.ts +145 -0
  140. package/dist/import.js +1222 -0
  141. package/dist/index.d.ts +7 -0
  142. package/dist/index.js +6 -0
  143. package/dist/key-check.d.ts +37 -0
  144. package/dist/key-check.js +112 -0
  145. package/dist/key-refusal.d.ts +51 -0
  146. package/dist/key-refusal.js +191 -0
  147. package/dist/learn/check.d.ts +108 -0
  148. package/dist/learn/check.js +277 -0
  149. package/dist/learn/grade.d.ts +80 -0
  150. package/dist/learn/grade.js +445 -0
  151. package/dist/learn/index.d.ts +7 -0
  152. package/dist/learn/index.js +11 -0
  153. package/dist/learn/invisible.d.ts +5 -0
  154. package/dist/learn/invisible.js +42 -0
  155. package/dist/learn/notes.d.ts +59 -0
  156. package/dist/learn/notes.js +147 -0
  157. package/dist/learn/reflect.d.ts +49 -0
  158. package/dist/learn/reflect.js +213 -0
  159. package/dist/learn/secrets.d.ts +18 -0
  160. package/dist/learn/secrets.js +131 -0
  161. package/dist/learn/skills.d.ts +97 -0
  162. package/dist/learn/skills.js +271 -0
  163. package/dist/learned-workflow.d.ts +59 -0
  164. package/dist/learned-workflow.js +191 -0
  165. package/dist/learning-routes.d.ts +196 -0
  166. package/dist/learning-routes.js +609 -0
  167. package/dist/learning-run.d.ts +306 -0
  168. package/dist/learning-run.js +819 -0
  169. package/dist/learning-words.d.ts +76 -0
  170. package/dist/learning-words.js +174 -0
  171. package/dist/learning.d.ts +418 -0
  172. package/dist/learning.js +946 -0
  173. package/dist/llm.d.ts +40 -0
  174. package/dist/llm.js +37 -0
  175. package/dist/llms.txt +37 -0
  176. package/dist/mcp-servers.d.ts +118 -0
  177. package/dist/mcp-servers.js +450 -0
  178. package/dist/mcp.d.ts +51 -0
  179. package/dist/mcp.js +392 -0
  180. package/dist/model.d.ts +186 -0
  181. package/dist/model.js +485 -0
  182. package/dist/monid.d.ts +74 -0
  183. package/dist/monid.js +277 -0
  184. package/dist/openapi/agentrun-v2.openapi.json +4806 -0
  185. package/dist/openapi.d.ts +10 -0
  186. package/dist/openapi.js +1727 -0
  187. package/dist/owner.d.ts +55 -0
  188. package/dist/owner.js +222 -0
  189. package/dist/packs.d.ts +71 -0
  190. package/dist/packs.js +180 -0
  191. package/dist/page.d.ts +32 -0
  192. package/dist/page.js +133 -0
  193. package/dist/paid-calls.d.ts +50 -0
  194. package/dist/paid-calls.js +110 -0
  195. package/dist/pause.d.ts +70 -0
  196. package/dist/pause.js +97 -0
  197. package/dist/pdf-pages.d.ts +44 -0
  198. package/dist/pdf-pages.js +147 -0
  199. package/dist/place.d.ts +69 -0
  200. package/dist/place.js +137 -0
  201. package/dist/print.d.ts +20 -0
  202. package/dist/print.js +29 -0
  203. package/dist/propose.d.ts +40 -0
  204. package/dist/propose.js +112 -0
  205. package/dist/quiet-sqlite-warning.d.ts +1 -0
  206. package/dist/quiet-sqlite-warning.js +14 -0
  207. package/dist/request-start.d.ts +22 -0
  208. package/dist/request-start.js +350 -0
  209. package/dist/result.d.ts +3 -0
  210. package/dist/result.js +5 -0
  211. package/dist/rows.d.ts +46 -0
  212. package/dist/rows.js +121 -0
  213. package/dist/run-box.d.ts +186 -0
  214. package/dist/run-box.js +590 -0
  215. package/dist/run-manifest.d.ts +27 -0
  216. package/dist/run-manifest.js +60 -0
  217. package/dist/runnable.d.ts +83 -0
  218. package/dist/runnable.js +170 -0
  219. package/dist/runs.d.ts +1062 -0
  220. package/dist/runs.js +3020 -0
  221. package/dist/secret-cut.d.ts +27 -0
  222. package/dist/secret-cut.js +109 -0
  223. package/dist/secrets.d.ts +62 -0
  224. package/dist/secrets.js +158 -0
  225. package/dist/server-lock.d.ts +44 -0
  226. package/dist/server-lock.js +140 -0
  227. package/dist/server.d.ts +722 -0
  228. package/dist/server.js +2118 -0
  229. package/dist/sessions.d.ts +4 -0
  230. package/dist/sessions.js +105 -0
  231. package/dist/sign-ins.d.ts +99 -0
  232. package/dist/sign-ins.js +288 -0
  233. package/dist/skills.d.ts +43 -0
  234. package/dist/skills.js +96 -0
  235. package/dist/stats.d.ts +106 -0
  236. package/dist/stats.js +103 -0
  237. package/dist/tool-gate.d.ts +266 -0
  238. package/dist/tool-gate.js +554 -0
  239. package/dist/tool-keys.d.ts +187 -0
  240. package/dist/tool-keys.js +315 -0
  241. package/dist/tool-plane.d.ts +228 -0
  242. package/dist/tool-plane.js +400 -0
  243. package/dist/tools.d.ts +202 -0
  244. package/dist/tools.js +372 -0
  245. package/dist/trigger-secrets.d.ts +32 -0
  246. package/dist/trigger-secrets.js +143 -0
  247. package/dist/triggers.d.ts +439 -0
  248. package/dist/triggers.js +863 -0
  249. package/dist/turn-end.d.ts +24 -0
  250. package/dist/turn-end.js +15 -0
  251. package/dist/turns.d.ts +34 -0
  252. package/dist/turns.js +202 -0
  253. package/dist/uploads.d.ts +104 -0
  254. package/dist/uploads.js +474 -0
  255. package/dist/usage-lines.d.ts +26 -0
  256. package/dist/usage-lines.js +28 -0
  257. package/dist/usage.d.ts +29 -0
  258. package/dist/usage.js +58 -0
  259. package/dist/validate.d.ts +57 -0
  260. package/dist/validate.js +184 -0
  261. package/dist/web-fetch.d.ts +64 -0
  262. package/dist/web-fetch.js +262 -0
  263. package/dist/web-search.d.ts +54 -0
  264. package/dist/web-search.js +136 -0
  265. package/dist/webhooks.d.ts +189 -0
  266. package/dist/webhooks.js +503 -0
  267. package/dist/workspace-paths.d.ts +33 -0
  268. package/dist/workspace-paths.js +104 -0
  269. package/dist/workspace.d.ts +88 -0
  270. package/dist/workspace.js +369 -0
  271. package/launcher/agentrun-serve +109 -0
  272. package/package.json +100 -4
  273. package/skills/agentrun-serve/SKILL.md +128 -0
package/package.json CHANGED
@@ -1,6 +1,102 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-serve",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-beta.30",
4
+ "description": "The Agentrun v2 API on your own machine: an agent store's agents, revisions and runs, served on loopback.",
5
+ "keywords": [
6
+ "agentrun",
7
+ "agent",
8
+ "pi",
9
+ "pi-durable",
10
+ "server",
11
+ "api"
12
+ ],
13
+ "type": "module",
14
+ "license": "Apache-2.0",
15
+ "author": "Parcha Labs, Inc.",
16
+ "engines": {
17
+ "node": ">=22.19.0"
18
+ },
19
+ "main": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "bin": {
29
+ "agentrun-serve": "./launcher/agentrun-serve"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "launcher",
34
+ "skills",
35
+ "README.md",
36
+ "CHANGELOG.md",
37
+ "LICENSE",
38
+ "NOTICE"
39
+ ],
40
+ "sideEffects": false,
41
+ "scripts": {
42
+ "build": "rm -rf dist && tsc -p tsconfig.json && node scripts/copy-page.mjs",
43
+ "prepack": "npm run build",
44
+ "typecheck": "tsc -p tsconfig.test.json",
45
+ "test": "node --test --test-concurrency=8 'test/*.test.mjs'"
46
+ },
47
+ "dependencies": {
48
+ "@browserbasehq/sdk": ">=2.20.0 <3",
49
+ "@modelcontextprotocol/client": "2.4.0",
50
+ "@parcha/agentrun-decisions": "0.1.0-beta.30",
51
+ "@parcha/agentrun-dsl": "0.1.0-beta.30",
52
+ "@parcha/agentrun-harness-claude": "0.1.0-beta.30",
53
+ "@parcha/agentrun-harness-codex": "0.1.0-beta.30",
54
+ "@parcha/agentrun-jev": "0.1.0-beta.30",
55
+ "@parcha/agentrun-kernel": "0.1.0-beta.30",
56
+ "@parcha/agentrun-pi": "0.1.0-beta.30",
57
+ "@parcha/pi-browser": "0.1.0-beta.30",
58
+ "@parcha/pi-durable-agent": "0.1.0-beta.30",
59
+ "@parcha/pi-durable-disk": "0.1.0-beta.30",
60
+ "@secretlint/core": "13.1.0",
61
+ "@secretlint/profiler": "13.1.0",
62
+ "@secretlint/secretlint-rule-preset-recommend": "13.1.0",
63
+ "croner": "11.0.0",
64
+ "undici": "^8.12.2"
65
+ },
66
+ "peerDependencies": {
67
+ "@earendil-works/chord": ">=1.1.0 <1.4.0",
68
+ "@earendil-works/pi-ai": "*",
69
+ "@earendil-works/pi-durable": ">=1.1.0 <1.4.0",
70
+ "@parcha/pi-transport": "0.1.0-beta.30",
71
+ "opencode-ai": "1.19.5"
72
+ },
73
+ "peerDependenciesMeta": {
74
+ "@parcha/pi-transport": {
75
+ "optional": true
76
+ },
77
+ "opencode-ai": {
78
+ "optional": true
79
+ }
80
+ },
81
+ "devDependencies": {
82
+ "@earendil-works/chord": "1.1.0",
83
+ "@earendil-works/pi-ai": "1.1.0",
84
+ "@earendil-works/pi-durable": "1.1.0",
85
+ "@modelcontextprotocol/server": "2.4.0",
86
+ "@parcha/pi-transport": "0.1.0-beta.30",
87
+ "opencode-ai": "1.19.5"
88
+ },
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "git+https://github.com/Parcha-ai/agentrun.git",
92
+ "directory": "packages/serve"
93
+ },
94
+ "bugs": {
95
+ "url": "https://github.com/Parcha-ai/agentrun/issues"
96
+ },
97
+ "homepage": "https://agentrun.ai",
98
+ "publishConfig": {
99
+ "access": "public",
100
+ "tag": "beta"
101
+ }
102
+ }
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: agentrun-serve
3
+ description: Connect to AgentRun Server (start it when it is not running), then create agents, run them, answer their questions and read their results over its MCP endpoint or its /v2 API. Use when asked to run an agent on AgentRun, start or check the AgentRun server, connect to it over MCP, or find out what an AgentRun run did.
4
+ ---
5
+
6
+ # AgentRun Server
7
+
8
+ The open platform's server for agents. One process on this machine's loopback address, port 7340 by default, keeps
9
+ agents (a prompt with tools, or a typed workflow) and every run of them: its timeline, its files and its cost. A coding
10
+ agent drives it over MCP (`/v2/mcp`) or HTTP (`/v2`); a person follows the same runs in its console (`/`).
11
+
12
+ ## 1. Check the server
13
+
14
+ If `AGENTRUN_BASE_URL` is set, check it:
15
+
16
+ ```sh
17
+ curl -sf "$AGENTRUN_BASE_URL/health"
18
+ ```
19
+
20
+ If it is not set, or nothing answers, start the server from a checkout of the repository (Node 22.19 or later), in the
21
+ background, with its data in a directory you name:
22
+
23
+ ```sh
24
+ git clone --branch main --single-branch https://github.com/Parcha-ai/agentrun.git && cd agentrun
25
+ npm ci --ignore-scripts && npm run build
26
+ node packages/serve/dist/cli.js --data "$PWD/.agentrun" > serve.log 2>&1 &
27
+ until grep -q '^AGENTRUN_BASE_URL=' serve.log; do sleep 1; done
28
+ export "$(grep -m1 '^AGENTRUN_BASE_URL=' serve.log)"
29
+ until curl -sf "$AGENTRUN_BASE_URL/health" >/dev/null; do sleep 1; done
30
+ ```
31
+
32
+ It runs on the model `AGENT_MODEL` names, with that provider's key in the environment (for example
33
+ `AGENT_MODEL=openrouter/anthropic/claude-sonnet-5.5` and `OPENROUTER_API_KEY`); the package README lists every way. To
34
+ try it with no key and no network, add `--faux faux.mjs` with a module that answers every request itself:
35
+
36
+ ```sh
37
+ printf '%s\n' 'export default (context, faux) => faux.message("The answer is 42.");' > faux.mjs
38
+ ```
39
+
40
+ ## 2. Get the token
41
+
42
+ The token is made once, mode 0600, in the data directory: `DIR/.token` for `--data DIR` (without `--data`,
43
+ `$XDG_DATA_HOME/agentrun/agents/.token`, else `~/.local/share/agentrun/agents/.token`). Read it into the environment and
44
+ never print it, echo it or write it anywhere else:
45
+
46
+ ```sh
47
+ export AGENTRUN_API_KEY=$(cat .agentrun/.token)
48
+ ```
49
+
50
+ ## 3. Connect over MCP
51
+
52
+ ```sh
53
+ claude mcp add --transport http agentrun "$AGENTRUN_BASE_URL/mcp" --header "Authorization: Bearer $AGENTRUN_API_KEY"
54
+ codex mcp add agentrun --url "$AGENTRUN_BASE_URL/mcp" --bearer-token-env-var AGENTRUN_API_KEY
55
+ ```
56
+
57
+ Then call `whoami` first. It checks the token and says what this server runs: its harnesses, tools, efforts, thinking
58
+ levels, default model and console address. The other tools:
59
+
60
+ | Tool | What it does |
61
+ | --- | --- |
62
+ | `agents_list` | The agents, 20 at a time (`cursor` for the next page). |
63
+ | `agents_create` | Makes an agent: `name`, `instructions`, `tools`, and optionally `id`, `harness`, `model`, `thinking`, and `definition` for any other field (`place`, say). |
64
+ | `agents_revise` | Makes an agent's next revision with the fields you change, and any other in `definition`; the rest stay. |
65
+ | `runs_start` | Starts a run: `agent_id`, `input` (`{content: "..."}` for an agentic agent), optional `effort`. Answers at once. |
66
+ | `runs_get` | A run's status, result or error, `pending` (its question, when it asked one) and `console_url`. |
67
+ | `runs_events` | The run's steps, a page at a time (`after`, `limit`). |
68
+ | `runs_files` | The files it wrote; with `path`, one file's text. |
69
+ | `runs_respond` | Answers a run's question (`content`), or follows up after it completed or was stopped (a fresh turn with its history). |
70
+ | `runs_cancel` | Ends a run for good: it takes no more messages (`409 not_continuable`); go on in a new run. |
71
+
72
+ A refusal comes back as a tool error holding the server's `error`: `code`, `message`, and for a `422` each field to fix.
73
+
74
+ ## 4. Create an agent
75
+
76
+ Look for one first with `agents_list`. Ask the person before you create or revise an agent, and say what it will do.
77
+ Then `agents_create`, for example `{"name": "Release notes", "instructions": "Write release notes from the commits you are given.", "tools": ["read", "write"]}`.
78
+ It writes files only with a tool like `write` in its `tools`; `whoami` lists the tools this server has.
79
+
80
+ ## 5. Run it, poll it, answer it
81
+
82
+ 1. `runs_start` with `{"agent_id": "...", "input": {"content": "..."}}`. It answers at once with the run, `queued`.
83
+ 2. `runs_get` every few seconds, until `status` is `completed`, `failed` or `cancelled`. Never wait on one call.
84
+ 3. `input_required` means the agent asked a question: `pending.question` holds it. Answer with `runs_respond`, or leave
85
+ it for the person in the console, then go on polling.
86
+ 4. `completed`: the answer is `result.final_answer` (a workflow's is `result.output`). `failed`: `error` says why.
87
+ `runs_files` lists what it wrote and reads a file; `runs_events` pages its steps.
88
+ 5. Tell the person the outcome, and end with the run's `console_url`, where they can see all of it.
89
+
90
+ `cost.usd` is null while the cost is unknown; never report it as $0.
91
+
92
+ ## 6. Without MCP: the /v2 API
93
+
94
+ ```sh
95
+ H="authorization: Bearer $AGENTRUN_API_KEY"
96
+ curl -s "$AGENTRUN_BASE_URL/agents" -H "$H" -H 'content-type: application/json' \
97
+ -d '{"definition":{"id":"calc","name":"Calc","instructions":"Answer the question.","tools":[]}}'
98
+ run=$(curl -s "$AGENTRUN_BASE_URL/agents/calc/runs" -H "$H" -H 'content-type: application/json' \
99
+ -H "idempotency-key: calc-$(date +%s)" -d '{"input":{"content":"What is six times seven?"}}' \
100
+ | node -p 'JSON.parse(require("fs").readFileSync(0)).run_id')
101
+ until curl -s "$AGENTRUN_BASE_URL/runs/$run" -H "$H" | node -e 'const r=JSON.parse(require("fs").readFileSync(0));process.exit(["completed","failed","cancelled","input_required"].includes(r.status)?0:1)'; do sleep 2; done
102
+ curl -s "$AGENTRUN_BASE_URL/runs/$run" -H "$H"
103
+ curl -s "$AGENTRUN_BASE_URL/runs/$run/files" -H "$H"
104
+ curl -s "$AGENTRUN_BASE_URL/runs/$run/messages" -H "$H" -H 'content-type: application/json' -d '{"content":"..."}'
105
+ ```
106
+
107
+ To give a run a file, upload it in one call, its bytes the body, then name it in the run's `file_ids`; the run finds it
108
+ at `inputs/<path>` in its workspace (MCP has no upload tool: use the API):
109
+
110
+ ```sh
111
+ file=$(curl -s "$AGENTRUN_BASE_URL/files?path=notes.md" -H "$H" --data-binary @notes.md \
112
+ | node -p 'JSON.parse(require("fs").readFileSync(0)).file.file_id')
113
+ curl -s "$AGENTRUN_BASE_URL/agents/calc/runs" -H "$H" -H 'content-type: application/json' \
114
+ -d '{"input":{"content":"Summarize inputs/notes.md."},"file_ids":["'"$file"'"]}'
115
+ ```
116
+
117
+ The whole API is in `GET $AGENTRUN_BASE_URL/openapi.json`, and in brief at `/llms.txt` on the server's root
118
+ (`curl -s "${AGENTRUN_BASE_URL%/v2}/llms.txt"`). The run's page for a person is `${AGENTRUN_BASE_URL%/v2}/#/runs/$run`.
119
+
120
+ ## Troubleshooting
121
+
122
+ - `401`: the token is not this server's. Read it again from the data directory the server was started with.
123
+ - `403` on `/v2/mcp`: the request carried a browser `Origin` that is not the server's own. Call it from your MCP client, not a web page.
124
+ - `405` on `/v2/mcp`: it takes POST only (no stream, no session).
125
+ - `409 agent_not_runnable`: this server cannot run that agent yet (a harness, tool or key it lacks); `error.details` and `whoami` say which.
126
+ - `422 input_invalid`: `error.fields` names each field to fix.
127
+ - `429 rate_limited` from `runs_start`: the server is at its most runs at once. Start it again when one ends.
128
+ - Keep the server on the loopback address. Started with `--listen` on another one, put TLS in front of it.