@parcha/agentrun-serve 0.1.0-beta.42 → 0.1.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -0
- package/README.md +221 -31
- package/dist/cli.js +42 -8
- package/dist/composio-preset.d.ts +4 -3
- package/dist/composio-preset.js +12 -4
- package/dist/composio-triggers.d.ts +20 -2
- package/dist/composio-triggers.js +183 -17
- package/dist/computer-lost.d.ts +11 -0
- package/dist/computer-lost.js +19 -0
- package/dist/computer-record.d.ts +10 -2
- package/dist/computer-record.js +50 -18
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +2 -2
- package/dist/console/assets/index-BUktRvS-.css +1 -0
- package/dist/console/assets/index-nB9kTfIN.js +711 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.js +0 -4
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/harness-table.d.ts +51 -3
- package/dist/harness-table.js +101 -13
- package/dist/harness.d.ts +18 -1
- package/dist/harness.js +21 -9
- package/dist/host.d.ts +12 -10
- package/dist/host.js +18 -16
- package/dist/import-sources.js +25 -5
- package/dist/import-worker.d.ts +3 -0
- package/dist/import-worker.js +7 -5
- package/dist/import.d.ts +22 -1
- package/dist/import.js +141 -28
- package/dist/learn/audit.d.ts +123 -0
- package/dist/learn/audit.js +159 -0
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +1 -1
- package/dist/learn/compile.d.ts +50 -74
- package/dist/learn/compile.js +90 -124
- package/dist/learn/delete.d.ts +17 -0
- package/dist/learn/delete.js +44 -0
- package/dist/learn/folder.d.ts +9 -0
- package/dist/learn/folder.js +13 -2
- package/dist/learn/promote.d.ts +92 -200
- package/dist/learn/promote.js +65 -187
- package/dist/learn/replay-calls.d.ts +5 -0
- package/dist/learn/replay-calls.js +12 -1
- package/dist/learn/secrets.d.ts +8 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learn/skills.d.ts +4 -0
- package/dist/learn/skills.js +19 -5
- package/dist/learn/workflow-nodes.d.ts +23 -3
- package/dist/learn/workflow-nodes.js +30 -12
- package/dist/learned-nodes.d.ts +9 -34
- package/dist/learned-nodes.js +11 -23
- package/dist/learned-workflow.d.ts +6 -8
- package/dist/learned-workflow.js +18 -57
- package/dist/learning-batch.d.ts +13 -5
- package/dist/learning-batch.js +34 -8
- package/dist/learning-cost.d.ts +111 -4
- package/dist/learning-cost.js +120 -3
- package/dist/learning-evals.d.ts +2 -0
- package/dist/learning-evals.js +4 -3
- package/dist/learning-routes.d.ts +8 -0
- package/dist/learning-routes.js +18 -1
- package/dist/learning-setting.d.ts +16 -1
- package/dist/learning-setting.js +34 -2
- package/dist/learning.d.ts +1 -1
- package/dist/listen-first.d.ts +30 -0
- package/dist/listen-first.js +115 -0
- package/dist/llms.txt +2 -1
- package/dist/mcp-servers-store.d.ts +12 -12
- package/dist/model.d.ts +8 -4
- package/dist/model.js +16 -8
- package/dist/openapi.js +203 -87
- package/dist/owner.d.ts +8 -0
- package/dist/owner.js +11 -0
- package/dist/paid-calls.d.ts +6 -0
- package/dist/paid-calls.js +11 -1
- package/dist/place.d.ts +8 -3
- package/dist/place.js +13 -9
- package/dist/provider.js +15 -1
- package/dist/run-launch.d.ts +6 -3
- package/dist/run-launch.js +2 -0
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-model-key.d.ts +64 -0
- package/dist/run-model-key.js +147 -0
- package/dist/runner/adapter-loop.d.ts +10 -0
- package/dist/runner/adapter-loop.js +26 -4
- package/dist/runner/adapter-run-spec.d.ts +6 -3
- package/dist/runner/adapter-run-spec.js +83 -25
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +13 -4
- package/dist/runner/audit.d.ts +68 -0
- package/dist/runner/audit.js +349 -0
- package/dist/runner/beside.d.ts +2 -1
- package/dist/runner/beside.js +6 -3
- package/dist/runner/claim-secrets.d.ts +49 -0
- package/dist/runner/claim-secrets.js +110 -1
- package/dist/runner/cli-run-spec.d.ts +2 -1
- package/dist/runner/cli-run-spec.js +44 -15
- package/dist/runner/commands.d.ts +3 -6
- package/dist/runner/feedback-round.d.ts +3 -2
- package/dist/runner/feedback-round.js +8 -7
- package/dist/runner/harness-loops.js +31 -23
- package/dist/runner/journal-kinds.d.ts +5 -7
- package/dist/runner/journal-kinds.js +0 -7
- package/dist/runner/learning-dispatch.d.ts +0 -16
- package/dist/runner/learning-dispatch.js +4 -47
- package/dist/runner/learning-end.d.ts +55 -13
- package/dist/runner/learning-end.js +128 -44
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +1 -4
- package/dist/runner/learning-loop.d.ts +2 -38
- package/dist/runner/learning-loop.js +8 -116
- package/dist/runner/loop-contract.d.ts +6 -0
- package/dist/runner/loop-contract.js +4 -0
- package/dist/runner/loop.js +6 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +25 -8
- package/dist/runner/memory-claim.d.ts +9 -6
- package/dist/runner/memory-claim.js +12 -9
- package/dist/runner/promotion.d.ts +55 -54
- package/dist/runner/promotion.js +232 -585
- package/dist/runner/reflect-hook.d.ts +14 -0
- package/dist/runner/reflect-hook.js +28 -3
- package/dist/runner/runner.js +57 -4
- package/dist/runner/store-secrets.js +9 -5
- package/dist/runner/workflow-first.d.ts +6 -5
- package/dist/runner/workflow-first.js +17 -12
- package/dist/runner/workflow-spec.js +10 -2
- package/dist/runs-over-store.d.ts +5 -4
- package/dist/runs-over-store.js +13 -3
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +64 -50
- package/dist/server.js +516 -134
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/seal.d.ts +20 -2
- package/dist/store/seal.js +24 -8
- package/dist/store/sqlite/run-launch.d.ts +4 -1
- package/dist/store/sqlite/run-launch.js +12 -0
- package/dist/store/sqlite/store.d.ts +3 -2
- package/dist/store/sqlite/store.js +119 -16
- package/dist/store/store.d.ts +41 -3
- package/dist/store-reads/analytics.js +11 -1
- package/dist/store-reads/learning.d.ts +57 -7
- package/dist/store-reads/learning.js +194 -28
- package/dist/store-reads/loop.d.ts +4 -39
- package/dist/store-reads/loop.js +10 -79
- package/dist/store-reads/stats.js +13 -3
- package/dist/store-view.d.ts +5 -1
- package/dist/store-view.js +12 -1
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.js +153 -0
- package/dist/tool-keys-store.d.ts +1 -1
- package/dist/tool-keys.d.ts +2 -2
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +11 -11
- package/dist/tools.js +18 -5
- package/dist/trigger-adapter.d.ts +3 -0
- package/dist/trigger-adapters.d.ts +4 -0
- package/dist/trigger-adapters.js +13 -0
- package/dist/trigger-composio.d.ts +58 -1
- package/dist/trigger-composio.js +160 -6
- package/dist/triggers.d.ts +4 -0
- package/dist/triggers.js +22 -3
- package/dist/validate.d.ts +11 -7
- package/dist/validate.js +8 -7
- package/dist/workspace/computer-for-claim.d.ts +15 -5
- package/dist/workspace/computer-for-claim.js +228 -32
- package/dist/workspace/resolve-computer.d.ts +8 -2
- package/dist/workspace/resolve-computer.js +1 -1
- package/dist/workspace/run-tools.d.ts +1 -1
- package/dist/workspace/run-tools.js +14 -3
- package/package.json +10 -9
- package/dist/console/assets/index-C3gNPz58.css +0 -1
- package/dist/console/assets/index-DYJ_wj27.js +0 -711
- package/dist/learn/general.d.ts +0 -69
- package/dist/learn/general.js +0 -75
- package/dist/learn/refit.d.ts +0 -48
- package/dist/learn/refit.js +0 -264
- package/dist/runner/step-guard.d.ts +0 -62
- package/dist/runner/step-guard.js +0 -93
package/dist/openapi.js
CHANGED
|
@@ -17,15 +17,18 @@ import { TAKE_OVER_MINUTES } from "./computer-routes.js";
|
|
|
17
17
|
import { HOLD_MAX_MINUTES, HOLD_MINUTES } from "./computer-held.js";
|
|
18
18
|
import { CALL_MS, PROTOCOL_METHODS } from "./computer-channel.js";
|
|
19
19
|
import { LAUNCH_LOST, SETUP_LOST } from "./files.js";
|
|
20
|
-
import { HARNESSES } from "./harness.js";
|
|
20
|
+
import { HARNESS_ID_PATTERN, HARNESSES } from "./harness.js";
|
|
21
21
|
import { LEARNING_LABEL, LEARNING_MODES, LEARNING_REASONS, LEARNING_STATES, RUN_LEARNING_USE } from "./learning.js";
|
|
22
22
|
import { BATCH_CELL_MAX, BATCH_ROWS_MAX } from "./learning-batch.js";
|
|
23
|
+
import { AUDIT_DEFAULTS, AUDIT_MAX } from "./learning-setting.js";
|
|
23
24
|
import { AFTER_STATES, CHEAPER_AFTER_RUNS, COST_CSV_COLUMNS, COST_WINDOW, COST_RUNS_DEFAULT, COST_RUNS_MAX, RUN_PATHS } from "./learning-cost.js";
|
|
24
25
|
import { FEEDBACK_ROUNDS, FEEDBACK_STATUSES } from "./runner/feedback-round.js";
|
|
25
26
|
import { EVAL_JOBS_MAX, EVAL_TEXT_MAX, EVALS_KEPT } from "./learning-evals.js";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
27
|
+
import { COMPILE_AFTER_MAX } from "./learning-setting.js";
|
|
28
|
+
import { LOOP_COMPILES_MAX } from "./store-reads/loop.js";
|
|
29
|
+
import { GRADE_SOURCES, GRADES_KEPT, LABEL_MAX } from "./learn/promote.js";
|
|
28
30
|
import { MODEL_SOURCES, THINKING_LEVELS } from "./model.js";
|
|
31
|
+
import { MAX_MODEL_KEY_CHARS } from "./run-model-key.js";
|
|
29
32
|
import { BOX_IDS, BOX_NETWORKS, BOX_STATES } from "./place-offers.js";
|
|
30
33
|
import { PLACE_MODES } from "./place.js";
|
|
31
34
|
import { TOOL_KEYS, UNREADABLE } from "./tool-keys.js";
|
|
@@ -89,15 +92,26 @@ export const NOT_SERVED = ["exportHome", "importHome", "killRun"];
|
|
|
89
92
|
const ref = (name) => ({ $ref: `#/components/${name}` });
|
|
90
93
|
const errors = (...codes) => Object.fromEntries(codes.map((code) => [String(code), ref(`responses/${{ 400: "BadRequest", 401: "Unauthenticated", 403: "Forbidden", 404: "NotFound", 409: "Conflict", 412: "PreconditionFailed", 413: "PayloadTooLarge", 415: "UnsupportedMediaType", 422: "Unprocessable", 429: "RateLimited", 500: "Internal", 501: "Unsupported", 503: "Unavailable" }[code]}`)]));
|
|
91
94
|
const json = (schema, description) => ({ description, content: { "application/json": { schema } } });
|
|
92
|
-
/** GET /health's answer (host.ts Health). */
|
|
95
|
+
/** GET /health's answer (host.ts Health; listen-first.ts while the server is warming). */
|
|
93
96
|
const HEALTH = {
|
|
94
97
|
type: "object", additionalProperties: false, required: ["status", "checks"],
|
|
95
98
|
properties: {
|
|
96
|
-
status: { enum: ["ok", "failing"] },
|
|
97
|
-
checks: { type: "object", additionalProperties: false, required: ["store", "disk"], properties: { store: { enum: ["ok", "does_not_open"] }, disk: { enum: ["ok", "below_floor", "cannot_check"] } } },
|
|
99
|
+
status: { enum: ["ok", "failing", "warming"] },
|
|
100
|
+
checks: { type: "object", additionalProperties: false, required: ["store", "disk"], properties: { store: { enum: ["ok", "does_not_open", "opening"] }, disk: { enum: ["ok", "below_floor", "cannot_check"] } } },
|
|
98
101
|
},
|
|
99
102
|
};
|
|
100
103
|
const COUNT = { type: "integer", minimum: 0 };
|
|
104
|
+
/** What a harness promises (harness-table.ts HarnessPromises), as capabilities show it. */
|
|
105
|
+
const HARNESS_PROMISES = {
|
|
106
|
+
type: "object", additionalProperties: false, required: ["resume", "tool_gate", "billing"],
|
|
107
|
+
description: "What the harness promises, each measured on its pinned build, never named. The built-in harnesses (pi, claude-agent, codex, opencode) promise exact resume, every call gated, proxy billing.",
|
|
108
|
+
"x-agentrun-serve": "harness-table/1",
|
|
109
|
+
properties: {
|
|
110
|
+
resume: { enum: ["exact", "load", "restart"], description: "After a crash: `exact`, its state mirrored into the run's journal; `load`, the agent's own session load; `restart`, the turn restarts with a recovery note." },
|
|
111
|
+
tool_gate: { enum: ["every_call", "permission", "config"], description: "What holds its tool calls: `every_call`, each blocks until journaled; `permission`, the agent's permission requests; `config`, its own tools off by its config and this server's tools gated." },
|
|
112
|
+
billing: { enum: ["proxy", "plan"], description: "Who pays for its model: `proxy`, through the run's model proxy, on this server's keys and under its cap; `plan`, the vendor bills the person's own plan, bounded by turn and tool-call limits, not by this server's cap." },
|
|
113
|
+
},
|
|
114
|
+
};
|
|
101
115
|
const closed = (properties, description) => ({ type: "object", additionalProperties: false, required: Object.keys(properties), properties, ...(description ? { description } : {}) });
|
|
102
116
|
const USD = { type: ["number", "null"], minimum: 0, description: "The sum of the known costs, rounded to 1e-6; null when no run's cost is known, never 0 for unknown." };
|
|
103
117
|
/** Runs counted together (AgentStoreReader.analytics's AnalyticsGroup). */
|
|
@@ -1198,7 +1212,7 @@ const RUN_LEARNING = {
|
|
|
1198
1212
|
from_notes: { type: "array", items: { type: "string" }, description: "The notes it absorbed, by file name: once merged, each carries `compiled_into: <workflow>` in its front matter and is still served on the by-hand path." },
|
|
1199
1213
|
attempts: { type: "array", items: closed({ ok: { type: "boolean" }, errors: { type: "array", items: { type: "string" }, description: "What the static checks and the dry run refused of this attempt, sent back to the model for the next one." } }), description: "Each attempt in order: the first, then a retry for each refusal, at most 4." },
|
|
1200
1214
|
digest: { type: ["string", "null"], description: "The kept draft's digest (the first 16 hex of its workflow.json's sha256): what a run serving it records as `workflow_digest`, and its promotion records' `digest`; null when no attempt passed." },
|
|
1201
|
-
promoted: { type: ["boolean", "null"], description: "Whether the kept draft serves the agent's runs, from its promotion records (GET /agents/{agent_id}/learning/promotions): true once promoted
|
|
1215
|
+
promoted: { type: ["boolean", "null"], description: "Whether the kept draft serves the agent's runs, from its promotion records (GET /agents/{agent_id}/learning/promotions): true once promoted, false while held, null while it is checked, before its first claim decides it, or when no attempt passed." },
|
|
1202
1216
|
}), { type: "null" }], description: "The run's compile turn, when its end-of-run look-back wrote the agent's job as a learned workflow (the agent kept enough notes or ran the job enough, and has none yet; or its workflow handed a run back, cost more than by hand, or its promotion held it); null when the run compiled nothing." },
|
|
1203
1217
|
draft_errors: { type: "array", items: { type: "string" }, description: "What the checks refused of a compiled draft that never passed after its retries, cut of the host's secrets; empty when none." },
|
|
1204
1218
|
cost_usd: closed({ grade: { type: ["number", "null"], description: "The grade's, outside the run (GET /usage's `learning` meter); null before a grade ran, or when its cost is unknown. The end-of-run turn's cost is in the run's own totals." } }),
|
|
@@ -1242,18 +1256,18 @@ const WRITE_ERRORS = { ...errors(400, 401, 403, 404, 412, 429, 500), "428": PREC
|
|
|
1242
1256
|
const SIGN_IN_WITHHELD = "Every text is cut of the agent's own browser sign-in pointers too, live or forgotten, and a note holding one is refused as one holding a host secret; when one of them does not open on this server (its seal key changed or is missing, or the sign-in is damaged), every learning route of the agent answers 403 `forbidden`, so nothing is shown over a shorter list.";
|
|
1243
1257
|
const WRITE_DESCRIPTION = "As a person, with no grader: one host commit on main in the agent's queue, `learning: <edited|created|retired> by a person: <file>` with a `Changed-By: user` trailer, MEMORY.md rebuilt from the active notes, and the folder's files brought in line. A note that fails the structural checks a run's notes pass (front matter, the 4 KB cap, UTF-8, hidden characters, text shaped like a secret or holding one of the host's) is 400 `bad_request` with `problems`, and nothing is written; so is an index past 200 lines. MEMORY.md is 400: the server builds it. Answers the note as it now is, with its new ETag. An archived agent's notes are written as its definition is. " + SIGN_IN_WITHHELD;
|
|
1244
1258
|
/** GET /agents/{agent_id}/learning/cost (learning-cost.ts, store-reads/learning.ts agentCostOverStore). */
|
|
1245
|
-
const COST_USD = (description) => ({ type: ["number", "null"], minimum: 0, description: `${description}
|
|
1259
|
+
const COST_USD = (description) => ({ type: ["number", "null"], minimum: 0, description: `${description} As booked (its float noise rounded off at 1e-12, the precision of a run's own cost): a decision's sub-micro-dollar cost is in it; null when unknown, never 0 for unknown.` });
|
|
1246
1260
|
const COST_MEAN = (description) => ({ oneOf: [closed({ runs: { ...COUNT, minimum: 1, description: "How many runs the mean is over." }, mean_usd: { type: "number", minimum: 0, description: "Their mean, rounded to 1e-6." } }), { type: "null" }], description });
|
|
1247
1261
|
const COST_RUN = closed({
|
|
1248
1262
|
n: { type: "integer", minimum: 1, description: "The run's number among the agent's runs counted here, oldest first: 1 is its first." },
|
|
1249
1263
|
run_id: { type: "string" },
|
|
1250
1264
|
started_at: DATE_TIME,
|
|
1251
|
-
path: { enum: [...RUN_PATHS], description: "The path the run took: `workflow`, a learned workflow finished it alone (its job's only tool calls were learned_workflow calls, each answering, and nothing was said after its first message, so it was not asked to look back); `handed_back`, a learned workflow ran and the agent went on (it failed or escalated, or the agent worked on after it); `agent`, no learned workflow ran; `replay`, a replay run: a learned workflow's new revision run alone on one of the agent's graded inputs, at workflow cost, to decide whether it serves first (its cost is learning's, shown as its own run)
|
|
1265
|
+
path: { enum: [...RUN_PATHS], description: "The path the run took: `workflow`, a learned workflow finished it alone (its job's only tool calls were learned_workflow calls, each answering, and nothing was said after its first message, so it was not asked to look back); `handed_back`, a learned workflow ran and the agent went on (it failed or escalated, or the agent worked on after it); `agent`, no learned workflow ran; `replay`, a replay run: a learned workflow's new revision run alone on one of the agent's graded inputs, at workflow cost, to decide whether it serves first (its cost is learning's, shown as its own run); `audit`, never a row here: a shadow run auditing a served run is no run of the series, its cost that run's `learning_usd`." },
|
|
1252
1266
|
workflow: { ...NULL_STRING, description: "The learned workflow the job called last, by name; null when it called none." },
|
|
1253
1267
|
learned_revision: { ...NULL_STRING, description: "The commit of the agent's learning folder the run started from: the learned revision that served it. Null for a run that does not learn." },
|
|
1254
1268
|
cost_usd: COST_USD("The job's own cost: what the run had cost when its answer was final, before it looked back; for a run that did not look back, its whole cost."),
|
|
1255
1269
|
cost_upper_bound: { type: "boolean", description: "The run's stored cost is only a bound (its row's `costAtMostUsd`: a model request cut at its cap hold): `cost_usd` and `total_usd` are null, never a known cost. `summary` counts such a run as `at_most`, not `unknown`." },
|
|
1256
|
-
learning_usd: COST_USD("What learning cost for the run: its end-of-run look-back and the grade of what it proposed, outside the run. 0 for a run that does not learn or kept nothing to grade; a grade still running adds nothing yet."),
|
|
1270
|
+
learning_usd: COST_USD("What learning cost for the run: its end-of-run look-back and the grade of what it proposed, outside the run. 0 for a run that does not learn or kept nothing to grade; a grade still running adds nothing yet. An audit's shadow run of it is its learning too: null while that shadow is queued or running, never $0."),
|
|
1257
1271
|
total_usd: COST_USD("The run's all-in cost, `cost_usd` and `learning_usd` together; null when either is."),
|
|
1258
1272
|
});
|
|
1259
1273
|
const LEARNING_COST = closed({
|
|
@@ -1279,12 +1293,49 @@ const LEARNING_COST = closed({
|
|
|
1279
1293
|
hand_backs: { oneOf: [closed({ ran: COUNT, back: COUNT }), { type: "null" }], description: "Of the runs a learned workflow ran first on from the takeover on (`path` `workflow` or `handed_back`), how many (`ran`) and how many it handed back to the agent (`back`); null before a takeover." },
|
|
1280
1294
|
withheld: { oneOf: [closed({ unknown: { ...COUNT, description: "Runs whose cost is unknown." }, at_most: { ...COUNT, description: "Runs whose cost is known only as at most (`cost_upper_bound`)." } }), { type: "null" }], description: "After a takeover, the runs `before` and `after` would read whose cost is not known exactly: while any is, `times_cheaper` is null, so the ratio is never over a partial set. Null when every one is known, and before a takeover." },
|
|
1281
1295
|
replay: { oneOf: [closed({
|
|
1282
|
-
n: { ...COUNT, description: "The
|
|
1283
|
-
workflow_pct: { type: "number", minimum: 0, maximum: 100, description: "The
|
|
1284
|
-
agent_pct: { type: "number", minimum: 0, maximum: 100, description: "The agent's accuracy on them, in percent
|
|
1285
|
-
cleared: { type: "boolean", description: "The
|
|
1286
|
-
|
|
1296
|
+
n: { ...COUNT, description: "The inputs its check ran on." },
|
|
1297
|
+
workflow_pct: { type: "number", minimum: 0, maximum: 100, description: "The share of them it answered alone with the agent's own recorded answer, in percent to a tenth." },
|
|
1298
|
+
agent_pct: { type: "number", minimum: 0, maximum: 100, description: "The agent's accuracy on them, in percent: 100, its own answers being the label." },
|
|
1299
|
+
cleared: { type: "boolean", description: "The check passed: a serving champion was promoted on it." },
|
|
1300
|
+
agreed: { ...COUNT, description: "Of the inputs it answered alone (`alone`), how many said what the agent's own recorded answer said." },
|
|
1301
|
+
alone: { ...COUNT, description: "The inputs it answered alone (no hand-back, no failed step)." },
|
|
1302
|
+
agree_min: { type: "number", minimum: 0, maximum: 1, description: "The agreement bar it passed (the definition's `learning.agree_min`): `agreed` over `alone` at least this. Passing it says the workflow agreed with the agent that often, never that it is as accurate." },
|
|
1303
|
+
}), { type: "null" }], description: "The check the serving promotion was decided on: the current champion of the learned workflow the newest served run ran. Null when none serves." },
|
|
1287
1304
|
}, "What the series shows, over every run it counts, `limit` aside."),
|
|
1305
|
+
bill: closed({
|
|
1306
|
+
baseline: COST_MEAN("The agent for one run: the mean own cost (`cost_usd`, learning left out) of the `agent` runs started before the agent's first run on a served path (`workflow`, `handed_back`, or an audit's shadow run), read from the run records (every one with none yet), each known exactly; null when there is none."),
|
|
1307
|
+
promoted: { oneOf: [closed({ n: { type: "integer", minimum: 1, description: "Its place on the bill's index." }, run_id: { type: "string" }, at: DATE_TIME }), { type: "null" }], description: "The first run that does a job started at or after the agent's first run on a served path (`at`: when that run started); null before one." },
|
|
1308
|
+
points: { type: "array", items: closed({
|
|
1309
|
+
n: { type: "integer", minimum: 1, description: "The run's place among the agent's runs that do a job (`agent`, `workflow` and `handed_back`), oldest first: a `replay` checks a revision and a shadow audits a run, so neither is on the index." },
|
|
1310
|
+
run_id: { type: "string" },
|
|
1311
|
+
actual_usd: { type: "number", minimum: 0, description: "Booked to this run, every run before it included: each run all in (`total_usd`: its own cost, its look-back with any compile turn, its grade and its audit shadow), and each replay run's cost at the run that does a job it followed. As booked (float noise rounded off at 1e-12)." },
|
|
1312
|
+
agent_usd: { type: ["number", "null"], minimum: 0, description: "The agent for all of it: `baseline` times the runs shown to here. Null with no baseline." },
|
|
1313
|
+
}), description: "One a run that does a job whose all-in cost is known exactly, every one: a run whose cost is unknown or only a bound is on neither line and counted in `withheld` (its number skipped)." },
|
|
1314
|
+
break_even: { oneOf: [closed({ n: { type: "integer", minimum: 1 }, run_id: { type: "string" } }), { type: "null" }], description: "The first run from `promoted` on after which `actual_usd` is never again over `agent_usd`, `booked_usd` against the line at the last point included: learning has paid for itself there. Null while it has not (`gap_usd` says by how much), and before a run on a served path." },
|
|
1315
|
+
gap_usd: { type: ["number", "null"], description: "While `break_even` is null: `booked_usd` less `agent_usd` at the last point (over 0: the bill is that much over the agent for all of it), spend booked after that point included. Null with a break-even, with no baseline or no run." },
|
|
1316
|
+
withheld: { ...COUNT, description: "Runs (replays included) whose cost is unknown or only a bound: on neither line." },
|
|
1317
|
+
booked_usd: { type: "number", minimum: 0, description: "The booked total: every priced run's cost (0 with none). Spend with no point to join (a replay after a run of unknown cost) is carried to the next point's `actual_usd`, and is in this when no point follows (or when there is no point at all: replays whose job runs were archived). With every run's GET /runs/{id} `cost.all_in_usd`, the sum of those and `unattributed_usd` is this." },
|
|
1318
|
+
revisions: { type: "array", items: closed({
|
|
1319
|
+
workflow: { type: "string", description: "The learned workflow, by name." },
|
|
1320
|
+
digest: { type: "string", description: "The revision: the first 16 hex characters of its workflow.json's sha256." },
|
|
1321
|
+
compile_usd: COST_USD("What the compile turns that drafted it cost: each ran in the session of a run that looked back, and is that run's learning spend no more, but this revision's. A recompile's turn is its recompiled revision's. 0 when none on record drafted it."),
|
|
1322
|
+
check_usd: COST_USD("What its check cost: its replay runs (the first draft's check or the one recompile's, each revision its own)."),
|
|
1323
|
+
spend_usd: COST_USD("Its learning spend: `compile_usd` and `check_usd` together."),
|
|
1324
|
+
k: { type: "integer", minimum: 1, description: "The served runs its spend is spread over: its check's `compile_after`." },
|
|
1325
|
+
served: { ...COUNT, description: "How many of those it has served (`workflow` or `handed_back` at this digest), at most `k`." },
|
|
1326
|
+
attributed_usd: COST_USD("What they carry: spend over k each in whole micro-dollars (a micro-dollar more on the first ones, and the sub-micro-dollar rest on the k-th, so the split is exact), on their GET /runs/{id} `cost.learning_usd`."),
|
|
1327
|
+
unattributed_usd: COST_USD("The rest: on no run until it serves `k` runs; for a `stopped` revision, on none ever."),
|
|
1328
|
+
state: { enum: ["checking", "serving", "stopped"], description: "`checking`: its check is at work; `serving`: it is its workflow's champion; `stopped`: held or replaced, so nothing more will carry it." },
|
|
1329
|
+
}), description: "Each revision of the agent's learned workflows its promotion records name, in the order first recorded, and how its learning spend is passed on to the runs it serves." },
|
|
1330
|
+
unattributed_usd: COST_USD("What no run carries: `booked_usd` less every run's GET /runs/{id} `cost.all_in_usd`. A revision's spend its served runs have not carried yet (each revision's `unattributed_usd`), a compile whose drafts all failed its checks or that the spend cap stopped (it drafted no revision to serve), and the spend of a revision whose promotion records aged out of the kept history land here, never nowhere. Null while any run's cost or learning is unknown, or a run is `withheld`."),
|
|
1331
|
+
holds: { type: "array", items: closed({
|
|
1332
|
+
n: { type: ["integer", "null"], minimum: 1, description: "The first run that does a job started at or after the hold, by its place on the bill's index (as `points` number them), placed by the server over every run, `limit` aside. Null when none has started since." },
|
|
1333
|
+
at: DATE_TIME,
|
|
1334
|
+
workflow: { type: "string", description: "The learned workflow held, by name." },
|
|
1335
|
+
by: { enum: ["audit", "check", "dsl"], description: "What held it: `audit`, its audits disagreed past the hold bar; `check`, a new revision's check held it (its draft failed its checks, or its replays fell short); `dsl`, this release's workflow DSL refused the serving revision (a hold with neither `audit` nor `check`, its `reason` the DSL's)." },
|
|
1336
|
+
reason: { type: "string", description: "The hold record's reason, in the server's words." },
|
|
1337
|
+
}), description: "Each hold the agent's promotion records keep, oldest first, at the run it bore on." },
|
|
1338
|
+
}, "The owner's bill, booked dollars only (each request at the price it was billed, cached tokens at their cached price), over every run, `limit` aside: the cumulative cost run after run against the agent doing all of it, and where learning pays for itself."),
|
|
1288
1339
|
});
|
|
1289
1340
|
const EVAL_TEXT = (description, example) => ({ type: "string", minLength: 1, maxLength: EVAL_TEXT_MAX, description, example });
|
|
1290
1341
|
const EVAL_IN = {
|
|
@@ -1309,60 +1360,107 @@ const LEARNING_EVAL = closed({
|
|
|
1309
1360
|
/** PUT /runs/{run_id}/grade and GET /agents/{agent_id}/learning/promotions (learn/promote.ts, runner/promotion.ts). */
|
|
1310
1361
|
const GRADE = closedWith(GRADE_FIELDS, { expected: { type: "object", description: "The fields a right answer's JSON holds, when the grade gave them." } });
|
|
1311
1362
|
const REPLAY_SCORE = {
|
|
1312
|
-
n: { ...COUNT, description: "The
|
|
1313
|
-
agree: { ...COUNT, description: "How many of them the workflow answered alone with the agent's recorded answer." },
|
|
1314
|
-
agent_acc: { type: "number", minimum: 0, maximum: 1, description: "The agent's accuracy on them:
|
|
1315
|
-
wf_acc: { type: "number", minimum: 0, maximum: 1, description: "The workflow's accuracy on them
|
|
1316
|
-
delta: { type: "number", description:
|
|
1317
|
-
handed_back: { ...COUNT, description: "How many of them it handed back; it answered `n` - `handed_back` alone.
|
|
1363
|
+
n: { ...COUNT, description: "The inputs it was decided on (a replay stopped at a write is none)." },
|
|
1364
|
+
agree: { ...COUNT, description: "How many of them the workflow answered alone with the agent's own recorded answer." },
|
|
1365
|
+
agent_acc: { type: "number", minimum: 0, maximum: 1, description: "The agent's accuracy on them: 1, the agent's own recorded answers being the label." },
|
|
1366
|
+
wf_acc: { type: "number", minimum: 0, maximum: 1, description: "The workflow's accuracy on them: the share it answered alone as the agent did, plus the ones it handed back (a hand-back is the agent's answer), over `n`." },
|
|
1367
|
+
delta: { type: "number", description: "`wf_acc` - `agent_acc`." },
|
|
1368
|
+
handed_back: { ...COUNT, description: "How many of them it handed back; it answered `n` - `handed_back` alone." },
|
|
1318
1369
|
};
|
|
1319
1370
|
/** A replay's runs' outcomes, the one count of them: on its promotion record (`replay.outcomes`) and its read. */
|
|
1320
1371
|
const SKIPPED_TOOLS = { type: "array", items: closed({ tool: { type: "string", description: "The tool's catalog name." }, inputs: { ...COUNT, description: "How many skipped inputs it stopped." }, no_read_only_hint: { type: "boolean", description: "An MCP tool its server lists with no `readOnlyHint` (and not `destructiveHint`): replay treats it as a write only because nothing says it reads. The hold's `reason` names these: if they only read, mark them read-only in the MCP server and the next replay runs them." } }), description: "The tools that stopped its skipped inputs, most inputs first." };
|
|
1321
1372
|
const REPLAY_OUTCOMES = closed({
|
|
1322
|
-
answered: { ...COUNT, description: "Replay runs the workflow answered alone, as each run did
|
|
1373
|
+
answered: { ...COUNT, description: "Replay runs the workflow answered alone, as each run did." },
|
|
1323
1374
|
handed_back: { ...COUNT, description: "Replay runs it handed back on." },
|
|
1324
1375
|
failed: { ...COUNT, description: "Replay runs a step failed in, or still at work past the replay's deadline: no evidence either way, never scored." },
|
|
1325
1376
|
skipped_write: { ...COUNT, description: "Replay runs stopped at a write (an MCP tool its server does not mark read-only, or any tool not known to read) that the graded run's recording does not have with the same arguments: a replay never runs a write, so these are neither scored nor wrong; a replay whose every input was skipped holds the revision." },
|
|
1326
|
-
}, "How many of its replay runs ended each way: what each run did
|
|
1377
|
+
}, "How many of its replay runs ended each way: what each run did.");
|
|
1378
|
+
/** A compiled draft's one check (learn/promote.ts CheckRecord): its bar while it replays, its numbers once decided. */
|
|
1379
|
+
const PROMOTION_CHECK = closedWith({
|
|
1380
|
+
compile_after: { type: "integer", minimum: 1, description: "The agent definition's `learning.compile_after` when the check began: how many of the agent's newest completed runs it read inputs from." },
|
|
1381
|
+
agree_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on agreement: of the inputs it answered alone, the least share that must say what the agent's recorded answer said." },
|
|
1382
|
+
alone_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on answering alone: the least share of the inputs it ran on that it must answer with no escalate and no failed step." },
|
|
1383
|
+
attempt: { enum: [1, 2], description: "1: the compile's first check. 2: the check of its one recompile, after the first held it; held again, it stops (`stopped`)." },
|
|
1384
|
+
}, {
|
|
1385
|
+
n: { ...COUNT, description: "The inputs it ran on (a replay stopped at a write is none; one never created, or not ended, by the check's deadline counts, as failed). 0 with nothing to run on: never promoted, it stops (`stopped`) and `reason` says why." },
|
|
1386
|
+
agreed: { ...COUNT, description: "How many of them it answered alone with the agent's recorded answer." },
|
|
1387
|
+
alone: { ...COUNT, description: "How many of them it answered alone. Promoted when `alone`/`n` >= `alone_min` and `agreed`/`alone` >= `agree_min`." },
|
|
1388
|
+
of: { type: "array", items: { type: "string" }, description: "The agent's runs whose inputs it ran on, newest first." },
|
|
1389
|
+
cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." },
|
|
1390
|
+
outcomes: { ...REPLAY_OUTCOMES, description: "How each input it ran on came out, one per input: a replay run never created, or not ended, by the check's deadline is `failed`." },
|
|
1391
|
+
unstarted: { ...COUNT, minimum: 1, description: "How many of its replay runs were never created by the check's deadline (the server stopped after reserving them, say), each a `failed` input. Left out when none. Every one: its replay's read is `failed`." },
|
|
1392
|
+
skipped_tools: SKIPPED_TOOLS,
|
|
1393
|
+
disagreements: { type: "array", items: closedWith({ run: { type: "string" }, input: { type: "string", description: "The run's input, as text or JSON, cut at 1200 characters." }, agent: NULL_STRING }, { draft: { type: "string", description: "What it answered instead." }, escalated: { type: "string", description: "Why it handed the input back." }, failed: { const: true, description: "A step failed on it, or its run was still at work past the check's deadline, or never created by then." } }), description: "On a hold: each input it did not agree on, which the agent's next run reads as data in its one recompile." },
|
|
1394
|
+
stopped: { const: true, description: "The recompile's check held it too, or there was nothing to check it on (no input of the agent's it takes, or every input skipped at a write: `n` 0, `reason` starting \"nothing to check it on\", which asks no recompile): nothing compiles again until a hold or its owner acts; the agent keeps the runs." },
|
|
1395
|
+
});
|
|
1327
1396
|
const PROMOTION = closedWith({
|
|
1328
1397
|
workflow: { type: "string" },
|
|
1329
1398
|
digest: { type: "string", description: "The revision the record decides: the first 16 hex of its workflow.json's sha256." },
|
|
1330
1399
|
at: DATE_TIME,
|
|
1331
|
-
decided: { enum: ["promote", "hold", "replaying"
|
|
1332
|
-
source: { enum: ["check", "replay", "dry_run", "refit", "graded"], description: `\`check\`: decided by its one check, a replay of it on the inputs of the agent's last \`compile_after\` completed runs scored against the agent's own recorded answers (\`check\` holds the numbers); a revision's first claim starts it. \`replay\`: decided on a replay of it on the agent's last ${REPLAY_INPUTS} graded inputs it fits, or those its owner asked for (POST .../revisions/{digest}/replays). \`dry_run\`: fewer than ${REPLAY_MIN} graded inputs, promoted on its passing dry run. \`refit\`: a threshold refit wrote this revision, decided on the rows it was fit on. \`graded\`: the graded runs it served fell more than ${PROMOTE_BAR * 100} points under the agent's accuracy by hand.` },
|
|
1400
|
+
decided: { enum: ["promote", "hold", "replaying"], description: "`promote`: it serves first on the runs it fits. `hold`: it does not; the champion (the revision promoted last) takes them, else the agent, until a new revision. A hold with `audit` is its audits' (a serving revision: at least the definition's `learning.hold_disagree` of its newest `learning.hold_window` audit rows, GET .../learning/audits, disagreed); one with `check`, its check's; one with neither, this release's workflow DSL refused the serving revision (`reason` names the DSL's code and where; its runs handed back to the agent): the agent's next run recompiles it once. `replaying`: its check's replay runs are at work; the champion serves meanwhile, else the agent. One revision of a workflow is checked at a time, and a running check finishes." },
|
|
1333
1401
|
reason: { type: "string", description: "Why, in words, with the numbers." },
|
|
1334
1402
|
}, {
|
|
1335
|
-
check:
|
|
1336
|
-
compile_after: { type: "integer", minimum: 1, description: "The agent definition's `learning.compile_after` when the check began: how many of the agent's newest completed runs it read inputs from." },
|
|
1337
|
-
agree_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on agreement: of the inputs it answered alone, the least share that must say what the agent's recorded answer said." },
|
|
1338
|
-
alone_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on answering alone: the least share of the inputs it ran on that it must answer with no escalate and no failed step." },
|
|
1339
|
-
attempt: { enum: [1, 2], description: "1: the compile's first check. 2: the check of its one recompile, after the first held it; held again, it stops (`stopped`)." },
|
|
1340
|
-
}, {
|
|
1341
|
-
n: { ...COUNT, description: "The inputs it ran on (a replay stopped at a write is none; one never created, or not ended, by the check's deadline counts, as failed). 0 with nothing to run on: never promoted, it stops (`stopped`) and `reason` says why." },
|
|
1342
|
-
agreed: { ...COUNT, description: "How many of them it answered alone with the agent's recorded answer." },
|
|
1343
|
-
alone: { ...COUNT, description: "How many of them it answered alone. Promoted when `alone`/`n` >= `alone_min` and `agreed`/`alone` >= `agree_min`." },
|
|
1344
|
-
of: { type: "array", items: { type: "string" }, description: "The agent's runs whose inputs it ran on, newest first." },
|
|
1345
|
-
cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." },
|
|
1346
|
-
outcomes: REPLAY_OUTCOMES,
|
|
1347
|
-
skipped_tools: SKIPPED_TOOLS,
|
|
1348
|
-
disagreements: { type: "array", items: closedWith({ run: { type: "string" }, input: { type: "string", description: "The run's input, as text or JSON, cut at 1200 characters." }, agent: NULL_STRING }, { draft: { type: "string", description: "What it answered instead." }, escalated: { type: "string", description: "Why it handed the input back." }, failed: { const: true, description: "A step failed on it, or its run was still at work past the check's deadline, or never created by then." } }), description: "On a hold: each input it did not agree on, which the agent's next run reads as data in its one recompile." },
|
|
1349
|
-
stopped: { const: true, description: "The recompile's check held it too, or there was nothing to check it on (no input of the agent's it takes, or every input skipped at a write: `n` 0, `reason` starting \"nothing to check it on\", which asks no recompile): nothing compiles again until a hold or its owner acts; the agent keeps the runs." },
|
|
1350
|
-
}),
|
|
1351
|
-
replay: { ...closedWith(REPLAY_SCORE, { of: { type: "array", items: { type: "string" }, description: "The graded runs replayed." }, cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." }, skipped_tools: SKIPPED_TOOLS, outcomes: REPLAY_OUTCOMES }), description: "The numbers it was decided on. A replay runs each read live (through a cache seeded from the graded run's recorded calls) and answers each write from that recording, never sending one." },
|
|
1403
|
+
check: PROMOTION_CHECK,
|
|
1352
1404
|
runs: { type: "array", items: { type: "string" }, description: "Its replay runs (path `replay`)." },
|
|
1353
1405
|
inputs: { type: "array", items: { type: "string" }, description: "On a replaying record: the graded run each of `runs` replays, in the same order. Its runs are reserved before they are created; one not created a few minutes on is created by the next claim." },
|
|
1354
1406
|
replay_id: { type: "string", description: "The replay's id, on its replaying record and the one that decided it: GET .../revisions/{digest}/replays/{replay_id} reads it, whether a run's claim or its owner started it." },
|
|
1355
|
-
refit: { ...closed({ from: { type: "string", description: "The digest it was refit from." }, guards: { type: "array", items: closedWith({ node: { type: "string" }, was: { type: ["number", "null"], description: "The guard's threshold before; null for an escalate." }, threshold: { type: ["number", "null"], description: "Its threshold after; null when it was switched off (the revision has no guard on that step, or no escalate by that label)." } }, { fit: { type: "object" }, escalate: { const: true, description: "An escalate node the replay recorded instead of obeying (its `when` reads a judge's field), switched off: the revision drops it." } }) } }), description: "What a refit changed: each guarded step's threshold before and after (null after: switched off), its new fit (`both` guards), and each escalate it switched off." },
|
|
1356
|
-
checked: { ...COUNT, description: `The place among the agent's grades (each grade's order, one more than the grade before it) of the newest grade its last refit check read; it is checked again once ${REFIT_EVERY} more graded runs it served come after it.` },
|
|
1357
|
-
since: { ...COUNT, description: "On a replay's promote: the place among the agent's grades of the newest grade when this promotion began, which names it. Its checks count only the graded runs this promotion served, so a revision promoted again after a hold is never held again on the grades it was held on, nor on a run served before it and graded after." },
|
|
1358
|
-
held_on: { type: "array", items: { type: "string" }, description: `The runs it served that were graded wrong when its graded runs held it (newest first, at most ${REPLAY_INPUTS}), kept on that hold, on its next replay (those still graded that it fits, each among its inputs) and on that replay's hold. A replay promotes it only once it answered or handed back on each of them, and is within the bar on them alone (gains on other inputs never pay for repeating their wrong answers).` },
|
|
1359
1407
|
commit: { type: "string", description: "The learning commit whose workflow.json is this revision's text: what it serves from as the champion while a newer revision replays." },
|
|
1360
|
-
|
|
1408
|
+
audit: closedWith({
|
|
1409
|
+
window: { type: "integer", minimum: 1, description: "The definition's `learning.hold_window` when it was held." },
|
|
1410
|
+
disagree: { type: "integer", minimum: 1, description: "The definition's `learning.hold_disagree` when it was held." },
|
|
1411
|
+
rows: { ...COUNT, description: "The audit rows it was decided on: the newest `window` with a verdict." },
|
|
1412
|
+
disagreements: { type: "array", items: closedWith({
|
|
1413
|
+
run: { type: "string", description: "The run whose answer is the agent's: the shadow run, or the served run for a grade." },
|
|
1414
|
+
served: { type: "string", description: "The run the workflow served." },
|
|
1415
|
+
input: { type: "string", description: "The served run's input, as text or JSON, cut at 1200 characters." },
|
|
1416
|
+
agent: { ...NULL_STRING, description: "The agent's answer (the shadow run's), cut at 1200 characters; null for a grade's row." },
|
|
1417
|
+
draft: { ...NULL_STRING, description: "The served answer, cut at 1200 characters; null when it could not be read." },
|
|
1418
|
+
}, { graded: { const: true, description: "An owner's grade wrote this row: the served answer was graded wrong." } }), description: "Its disagreeing rows: the data its one recompile reads." },
|
|
1419
|
+
}, { stopped: { const: true, description: "A second audit hold within the definition's `learning.stop_window` served runs of the first: it stopped, no compile is asked, nothing serves again until a new revision lands." } }),
|
|
1420
|
+
});
|
|
1421
|
+
const AUDIT_LINE = closed({
|
|
1422
|
+
window: { type: "integer", minimum: 1, description: "The definition's `learning.hold_window`." },
|
|
1423
|
+
disagree: { type: "integer", minimum: 1, description: "The definition's `learning.hold_disagree`." },
|
|
1424
|
+
rows: { ...COUNT, description: "The serving revision's newest audit rows with a verdict, at most `window`." },
|
|
1425
|
+
disagreed: { ...COUNT, description: "How many of them disagreed: it is held once this reaches `disagree`." },
|
|
1361
1426
|
});
|
|
1362
1427
|
const SERVING = closed({
|
|
1363
1428
|
workflow: { type: "string" },
|
|
1364
1429
|
digest: { ...NULL_STRING, description: "The revision that serves first (the champion: the one promoted last, while its newest record still says promote); null when none does and the agent takes the runs." },
|
|
1365
1430
|
replaying: { ...NULL_STRING, description: "A newer revision whose replay is at work, when there is one: it serves only once its replay promotes it; the champion serves meanwhile." },
|
|
1431
|
+
state: { enum: ["serving", "checking", "held", "stopped"], description: "`serving`: a revision serves first. `checking`: its newest revision's check is at work (the agent takes the runs meanwhile, or the champion). `held`: none serves, its newest record holds it (a check's or an audit's hold, or this release's workflow DSL refused it: the agent's next run recompiles it once). `stopped`: none serves and nothing compiles again (a recompile's check held it too, or a second audit hold within `learning.stop_window`, or a check whose every input stopped at a write) until a new revision lands." },
|
|
1432
|
+
check: { anyOf: [closed({ n: COUNT, agreed: COUNT, alone: COUNT, attempt: { enum: [1, 2] } }), { type: "null" }], description: "The numbers of the workflow's newest decided check: its inputs, those it agreed on, those it answered alone, which check of its compile it was; null when none was decided." },
|
|
1433
|
+
audit: { anyOf: [AUDIT_LINE, { type: "null" }], description: "Its audit line: the serving (else the newest) revision's newest audit rows against the hold bar; null when no revision has a record." },
|
|
1434
|
+
audits_off: { ...NULL_STRING, description: "Why none of the agent's runs is audited, e.g. `audits off: send_email can write`: its definition can call a tool that is not read-only (an MCP tool its server lists without `readOnlyHint`, or a built-in other than web_fetch, web_search, pdf_pages and llm, its computer's tools among them), which a shadow run would call a second time. Null when every tool it can call only reads: its served runs are audited." },
|
|
1435
|
+
not_auditable: { ...COUNT, description: "Of the serving revision's newest `learning.stop_window` served runs, those a trigger started: never audited (a shadow run gets none of a trigger's context, and could answer where it answers). 0 when none serves." },
|
|
1436
|
+
champion: { anyOf: [closed({
|
|
1437
|
+
digest: { type: "string", description: "The champion's revision: `digest` above." },
|
|
1438
|
+
commit: { ...NULL_STRING, description: "The learning commit its text was read at: the newest its promotion records name that holds it, else the folder's main. Read by its recorded digest, never by paging the workflow's history. Null when no commit read holds it." },
|
|
1439
|
+
nodes: { anyOf: [{ type: "array", items: closed({
|
|
1440
|
+
path: { type: "string", description: "Where the node is in its parent: a chain's step by its index (`0`, `1`), any other child by its field (`2.body`); `root` for a root that is no chain." },
|
|
1441
|
+
kind: { type: "string", description: "Its node kind (`extract`, `decide`, `call`, `loop`, `escalate`, ...)." },
|
|
1442
|
+
label: { type: "string", description: "Its label; its kind when it has none." },
|
|
1443
|
+
tier: { type: ["string", "null"], enum: ["fast", "agent", null], description: "The tier its model step runs on: `fast`, or `agent` for the agent's own model. Null for a node that calls no model tier (a call, a loop, an escalate, a decision node's own provider)." },
|
|
1444
|
+
checks: { type: "array", items: closed({ on: { enum: ["when", "until"], description: "`when`: the node runs only when the predicate holds. `until`: a loop stops once it holds." }, predicate: { type: "object", description: "The predicate as the workflow holds it (the DSL's predicate: `field_equals`, `exists`, `not`, `and`, `or`, ...)." } }), description: "The checks it runs in code." },
|
|
1445
|
+
}) }, { type: "null" }], description: "Each node of its workflow.json, depth first, a chain's steps in order and the chain itself left out. Null when its text could not be read." },
|
|
1446
|
+
check: { anyOf: [PROMOTION_CHECK, { type: "null" }], description: "The check it was promoted on: its promote record's `check`. Null when it was promoted with none." },
|
|
1447
|
+
}), { type: "null" }], description: "The revision that serves first, as a person reads it: its nodes with their tiers and code checks, and the check it was promoted on. Kept while a newer revision is checked (`replaying`). Null when none serves (`digest` null)." },
|
|
1448
|
+
});
|
|
1449
|
+
const AUDIT_ROW = closedWith({
|
|
1450
|
+
run: { type: "string", description: "The served run." },
|
|
1451
|
+
shadow_run: { ...NULL_STRING, description: "Its shadow run (the same agent on the same input with learning off, GET /runs/{id}'s `audit_of` names the served run); null for a grade's row, or when none was started (`skipped`)." },
|
|
1452
|
+
workflow: { type: "string" },
|
|
1453
|
+
digest: { type: "string", description: "The revision that served it." },
|
|
1454
|
+
promoted_at: { type: ["string", "null"], format: "date-time", description: "The promotion of that revision the row counts for: its promote record's `at` (GET .../learning/promotions), the one serving when the shadow started or the grade was given. The hold rule counts only the rows of the revision's promotion now, so a revision its owner's replay promotes again after a hold starts on none. Null: none." },
|
|
1455
|
+
source: { enum: ["shadow", "grade"], description: "`shadow`: the shadow run's answer compared with the served one. `grade`: an owner's grade of a run the workflow answered alone (PUT /runs/{id}/grade)." },
|
|
1456
|
+
agreed: { type: ["boolean", "null"], description: "Whether the two answers say the same (a grade's: whether it was graded right); null when either answer is missing (a shadow that failed or `parked`, or none was started): no evidence, not counted." },
|
|
1457
|
+
served_cost: { type: ["number", "null"], minimum: 0, description: "What the served run cost; null when unknown." },
|
|
1458
|
+
shadow_cost: { type: ["number", "null"], minimum: 0, description: "What the shadow run cost (the agent's learning cost); null for a grade's row, or when unknown." },
|
|
1459
|
+
at: DATE_TIME,
|
|
1460
|
+
}, {
|
|
1461
|
+
turn: { type: "string", description: "The served run's answer the row is of: the id of its answer row in the run's timeline (GET /runs/{id}/timeline), its newest final answer when the audit began (or at the grade). A follow-up's later answer is never the one compared. Absent when the run had no answer." },
|
|
1462
|
+
skipped: { const: "no allowance", description: "No shadow was started: the served run's cap left less than a run's smallest cap ($0.01), or what it spent under it is not known. `agreed` is null: not counted." },
|
|
1463
|
+
parked: { const: true, description: "The shadow came to wait on a person (an approval its tool settings ask, a question, a raise of its cap: what the served run's cap left) and ended there at once, no one asked, so it has no answer. `agreed` is null: not counted." },
|
|
1366
1464
|
});
|
|
1367
1465
|
const BATCH_LESSONS = closed({ notes: { type: "array", items: { type: "string" } }, skills: { type: "array", items: { type: "string" } }, workflows: { type: "array", items: { type: "string" } } });
|
|
1368
1466
|
const BATCH_ROW = closedWith({ n: { type: "integer", minimum: 1, description: "The row's number, 1 the first: rows run in this order." }, state: { enum: ["pending", "running", "done", "failed"], description: "`done`: the run answered, was told the reference, and that turn completed and its learning settled; `failed`: its run failed, was cancelled or waited on a person, its review was not sent, or its review's turn did not complete (`error` says). A row is failed only once its run has stopped." }, reference: { type: "string", description: "The reference answer, as the person gave it." } }, {
|
|
@@ -1370,7 +1468,7 @@ const BATCH_ROW = closedWith({ n: { type: "integer", minimum: 1, description: "T
|
|
|
1370
1468
|
answer: { ...NULL_STRING, description: "The run's answer as compared (the `answer_field` of a JSON answer when the batch names one), cut at 2000 characters (compared whole: the review quotes it to 2000 characters and says when it was cut); null when it gave none." },
|
|
1371
1469
|
right: { type: "boolean", description: "Whether the answer equals the reference once trimmed, case-folded and whitespace-collapsed (two numbers by value). A display: the learning grade is the judge." },
|
|
1372
1470
|
reviewed: { type: "boolean", description: "The reference was sent to the run as a review, once." },
|
|
1373
|
-
path: { enum: RUN_PATHS.filter((path) => path !== "replay"), description: "The path the run's job took, read when it answered, before its review (GET /agents/{agent_id}/learning/cost's `path`): whoever wrote its answer." },
|
|
1471
|
+
path: { enum: RUN_PATHS.filter((path) => path !== "replay" && path !== "audit"), description: "The path the run's job took, read when it answered, before its review (GET /agents/{agent_id}/learning/cost's `path`): whoever wrote its answer." },
|
|
1374
1472
|
cost_usd: COST_USD("The job's own cost."), learning_usd: COST_USD("What learning cost for the run."), total_usd: COST_USD("Their sum; for a failed row, what its run cost."),
|
|
1375
1473
|
learned: { ...BATCH_LESSONS, description: "The notes, skills and workflow drafts the run's learning kept, by name." },
|
|
1376
1474
|
merged: { ...NULL_STRING, description: "The commit of the agent's learning folder its learning last merged (its job's round or its review's)." },
|
|
@@ -1402,7 +1500,7 @@ const LEARNING_EXTENSIONS = {
|
|
|
1402
1500
|
"/runs/{run_id}/grade": {
|
|
1403
1501
|
put: {
|
|
1404
1502
|
operationId: "gradeRun", tags: ["runs"], summary: "Grade an ended run's answer: right or wrong, and the fields a right answer holds",
|
|
1405
|
-
description: `A person's feedback or an eval's label on a run that ended, kept for its agent (one grade a run: a later one replaces it; the newest ${GRADES_KEPT} are kept). Promotion
|
|
1503
|
+
description: `A person's feedback or an eval's label on a run that ended, kept for its agent (one grade a run: a later one replaces it; the newest ${GRADES_KEPT} are kept). Promotion reads none: a revision's check is scored against the agent's own recorded answers. A replay run is never graded. The run's path never changes on a grade: a grade of a run its learned workflow answered alone, right or wrong, is kept and nothing more ($0); a run the agent finished, graded with a \`label\`, opens again on a look-back on it. That round asks the agent no turn of the job's, only its end-of-run turn, and its spend is the run's learning (\`feedback\`).`,
|
|
1406
1504
|
parameters: [ref("parameters/RunId")],
|
|
1407
1505
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["correct"], properties: { correct: { type: "boolean" }, expected: { type: "object", description: "The fields a right answer's JSON holds." }, source: { enum: [...GRADE_SOURCES], default: "feedback" }, label: { type: "string", maxLength: LABEL_MAX, description: "The grade's words (a teacher's label, a reviewer's note): what the run's look-back reads." } } } } } },
|
|
1408
1506
|
responses: { "200": json(GRADE, "The run's grade."), ...errors(400, 401, 404, 429, 500) },
|
|
@@ -1411,8 +1509,8 @@ const LEARNING_EXTENSIONS = {
|
|
|
1411
1509
|
},
|
|
1412
1510
|
"/agents/{agent_id}/learning/loop": {
|
|
1413
1511
|
get: {
|
|
1414
|
-
operationId: "getLearningLoop", tags: ["agents"], summary: "The self-learning loop's own record: each compile turn
|
|
1415
|
-
description: `What the console's Learning tab tells of the loop beside the cost series. \`compiles\`: the agent's compile turns, newest first (the newest ${LOOP_COMPILES_MAX}): the workflow a run's compile turn wrote, the notes it absorbed, each attempt and what the checks refused, its draft's digest and whether that revision was promoted; a follow-up's round compiles on its own, so a run can list one turn a round; a turn whose draft never passed is listed with its \`draft_errors\`, never silent.
|
|
1512
|
+
operationId: "getLearningLoop", tags: ["agents"], summary: "The self-learning loop's own record: each compile turn",
|
|
1513
|
+
description: `What the console's Learning tab tells of the loop beside the cost series. \`compiles\`: the agent's compile turns, newest first (the newest ${LOOP_COMPILES_MAX}): the workflow a run's compile turn wrote, the notes it absorbed, each attempt and what the checks refused, its draft's digest and whether that revision was promoted; a follow-up's round compiles on its own, so a run can list one turn a round; a turn whose draft never passed is listed with its \`draft_errors\`, never silent. Aggregates and the checks' own words only: no input or answer. Each text cut of the host's secrets and of its run's handed values; a run whose handed values can't be read here shows no error text (\`withheld\`).`,
|
|
1416
1514
|
parameters: [AGENT_ID],
|
|
1417
1515
|
responses: { "200": json(closed({
|
|
1418
1516
|
agent: { type: "string" },
|
|
@@ -1425,34 +1523,29 @@ const LEARNING_EXTENSIONS = {
|
|
|
1425
1523
|
from_notes: { type: "array", items: { type: "string" }, description: "The notes it absorbed, by file name (each marked \`compiled_into\` once it merged)." },
|
|
1426
1524
|
attempts: { type: "array", items: closed({ ok: { type: "boolean" }, errors: { type: "array", items: { type: "string" } } }), description: "Each attempt in order: whether its checks and dry run passed, and what they refused." },
|
|
1427
1525
|
digest: { ...NULL_STRING, description: "The kept draft's digest; null when none passed." },
|
|
1428
|
-
promoted: { type: ["boolean", "null"], description: "Whether that revision was promoted, as its records say now: true promoted
|
|
1526
|
+
promoted: { type: ["boolean", "null"], description: "Whether that revision was promoted, as its records say now: true promoted, false held, null undecided or none passed. It may no longer serve: the promotions read's \`serving\` says which revision does." },
|
|
1429
1527
|
draft_errors: { type: "array", items: { type: "string" }, description: "A draft that never passed: its last errors. A draft its check had nothing to run on (its promotion `check.stopped` with `n` 0): its record's reason, starting \"nothing to check it on\". Empty otherwise." },
|
|
1430
1528
|
withheld: { type: "boolean", description: "The run's handed values can't be read here: its error texts are left out (the counts stand)." },
|
|
1431
1529
|
}), description: "Newest first." },
|
|
1432
|
-
|
|
1433
|
-
workflow: { type: "string" },
|
|
1434
|
-
digest: { type: "string", description: "The revision the step ran in." },
|
|
1435
|
-
node: { type: "string", description: "The step's label." },
|
|
1436
|
-
signal: { enum: ["self", "jev", "both"], description: "\`self\`: the step's own confidence; \`jev\`: one Jev call over its input and output; \`both\`: their fitted logistic (min of the two before a fit)." },
|
|
1437
|
-
threshold: { type: ["number", "null"], minimum: 0, maximum: 1, description: "Under it the step hands the run back to the agent, as the runs it served first on read it; null when only replays ran it." },
|
|
1438
|
-
runs: { ...COUNT, description: "Runs this revision served first on that this step guarded, each once however many checks a map made of it (replays left out, and checks of another workflow's call in the same run)." },
|
|
1439
|
-
escalated: { ...COUNT, description: "How many of them it handed back (one of the run's checks of it did)." },
|
|
1440
|
-
right: { ...COUNT, description: "How many of them the workflow answered alone and were graded right." },
|
|
1441
|
-
wrong: { ...COUNT, description: "How many of them the workflow answered alone and were graded wrong." },
|
|
1442
|
-
grades_past: { ...COUNT, description: `How many of them the workflow answered alone whose grade, if one was given, is no longer kept (the agent keeps its newest ${GRADES_KEPT} grades): in neither \`right\` nor \`wrong\`, and not known to be ungraded.` },
|
|
1443
|
-
replays: { ...COUNT, description: "Replay runs of this revision that read this step: in none of the other counts, nor in \`points\` (a replay reads its guards at a record-only threshold, so its row says nothing of a hand-back)." },
|
|
1444
|
-
points: { type: "array", items: closed({ run_id: { type: "string" }, p: { type: ["number", "null"], minimum: 0, maximum: 1, description: "The least p the run's checks of this step read, to 4 places; null when a signal was missing on one (always handed back)." }, escalated: { type: "boolean" }, correct: { type: ["boolean", "null"], description: "The run's grade, on a run the workflow answered alone; null otherwise." } }), description: `The runs it served first on, oldest first: the newest ${LOOP_POINTS_MAX}.` },
|
|
1445
|
-
}) },
|
|
1446
|
-
}), "The loop's compile turns and guarded steps."), ...errors(401, 403, 404, 429, 500) },
|
|
1530
|
+
}), "The loop's compile turns."), ...errors(401, 403, 404, 429, 500) },
|
|
1447
1531
|
"x-agentrun-serve": "learningloop/1",
|
|
1448
1532
|
},
|
|
1449
1533
|
},
|
|
1450
1534
|
"/agents/{agent_id}/learning/promotions": {
|
|
1451
1535
|
get: {
|
|
1452
1536
|
operationId: "listLearningPromotions", tags: ["agents"], summary: "Each learned workflow revision's promotion: its replay's numbers and whether it serves",
|
|
1453
|
-
description: "Every promotion record of the agent's learned workflows, oldest first: a new revision's replay on the agent's
|
|
1537
|
+
description: "Every promotion record of the agent's learned workflows, oldest first: a new revision's one check, a replay of it on the inputs of the agent's last completed runs scored against the agent's own recorded answers (replaying, then promoted or held, with its numbers), a draft held with nothing to check it on, a compile whose drafts all failed their checks (a hold with nothing checked, its reason naming the failed checks: the compile's attempt; a recompile's stops), or a serving revision held by its audits (GET .../learning/audits; the hold's `audit` holds the rows). A revision serves only once its check promotes it; the champion (the revision promoted last) keeps serving while a newer one is checked or after it is held, and `serving` says which digest serves and which is checked, each workflow's state, its newest check's numbers and its audit line. One revision of a workflow is checked at a time and a running check finishes. A hold's disagreements (a check's, an audit's) quote inputs and answers, cut as the agent's other learning reads cut them. What the console's Learning tab marks on its cost chart.",
|
|
1454
1538
|
parameters: [AGENT_ID],
|
|
1455
|
-
responses: { "200": json(closed({ agent: { type: "string" }, promotions: { type: "array", items: PROMOTION }, serving: { type: "array", items: SERVING, description: "Each learned workflow with a record: the revision that serves
|
|
1539
|
+
responses: { "200": json(closed({ agent: { type: "string" }, promotions: { type: "array", items: PROMOTION }, serving: { type: "array", items: SERVING, description: "Each learned workflow with a record: the revision that serves, the one replaying, its state, its check's numbers and its audit line." } }), "The agent's promotion records, and what serves."), ...errors(401, 403, 404, 429, 500) },
|
|
1540
|
+
"x-agentrun-serve": "promotion/1",
|
|
1541
|
+
},
|
|
1542
|
+
},
|
|
1543
|
+
"/agents/{agent_id}/learning/audits": {
|
|
1544
|
+
get: {
|
|
1545
|
+
operationId: "listLearningAudits", tags: ["agents"], summary: "The audit ledger of the agent's serving learned workflows",
|
|
1546
|
+
description: "One row per finished audit, oldest first, as the agent's learning folder keeps them (audits.jsonl): a run a promoted learned workflow answered alone (path `workflow`; a run it handed back is never drawn) is audited at 1 in `learning.audit_every` (drawn from its id): its shadow run, the same agent on the same input with learning off, answers it again, and the row says whether the two answers say the same and what each run cost (the shadow's is the agent's learning cost; the shadow is no row of the run list, and GET /runs/{id} reads it with `audit_of`). A capped run's shadow starts at its end, capped at what its cap left, so the two never spend past it: with less than a run's smallest cap left, none starts (`skipped`). A shadow never waits on a person: one that would (an approval, a question, a raise of its cap) ends there at once with no answer (`parked`); neither is counted. Each row compares the served run's answer at the audit's start (`turn`), never a follow-up's. An owner's grade of a run the workflow answered alone is a row too. The hold rule reads them (`learning.hold_window`, `learning.hold_disagree`).",
|
|
1547
|
+
parameters: [AGENT_ID],
|
|
1548
|
+
responses: { "200": json(closed({ agent: { type: "string" }, audits: { type: "array", items: AUDIT_ROW } }), "The agent's audit rows."), ...errors(401, 403, 404, 429, 500) },
|
|
1456
1549
|
"x-agentrun-serve": "promotion/1",
|
|
1457
1550
|
},
|
|
1458
1551
|
},
|
|
@@ -1614,23 +1707,23 @@ const LEARNING_EXTENSIONS = {
|
|
|
1614
1707
|
},
|
|
1615
1708
|
"/agents/{agent_id}/learning/workflows/{name}/revisions/{digest}/replays": {
|
|
1616
1709
|
post: {
|
|
1617
|
-
operationId: "startLearnedWorkflowReplay", tags: ["agents"], summary: "
|
|
1618
|
-
description: `Starts the
|
|
1710
|
+
operationId: "startLearnedWorkflowReplay", tags: ["agents"], summary: "Re-check a learned workflow's revision on the agent's own runs: a held revision, or an edited one",
|
|
1711
|
+
description: `Starts the one check a run's claim starts for a new revision (GET /agents/{agent_id}/learning/promotions explains it): one replay run of the agent per input, each the workflow alone at workflow cost, its reads live and its writes answered only from the agent's own run's recording, never sent, scored against the agent's own recorded answers. \`inputs\`: \`held\` (the default), the runs the revision's last check ran on, or, with none, the agent's last \`compile_after\` completed runs; a number from 1 to ${COMPILE_AFTER_MAX}, that many of the agent's newest completed runs. Each is a completed run of the agent's own (path \`agent\` or \`handed_back\`), with no uploaded file, whose input the revision takes. Its record is a check's (\`replaying\` then promoted or held, with its numbers, as a claim-started one is), decided once every replay run ended: at a run's claim that lays the revision, or at its read (GET .../replays/{replay_id}). Its replay runs are handed no per-run MCP credentials. The revision is \`digest\`, the first 16 hex of its workflow.json's sha256: one a promotion record names (read at its commit), or the one on the learning folder's main. 404 for an unknown agent, workflow or revision. 409 \`replay_conflict\` when it is replaying already, another revision of the workflow replays (one at a time, and a running check finishes), it is promoted (it serves already), none of the inputs asked for fits it (nothing is reserved and no run starts), or the agent's runs take no learned workflow here. 409 \`agent_not_runnable\` for an archived agent, as a run's start is: nothing is reserved. 400 for any other \`inputs\`. Only the owner, signed in with their password, starts one: the console's password session alone, from this server's own origin with a JSON body; every token is 403 \`forbidden\`.`,
|
|
1619
1712
|
security: [{ ownerSession: [] }],
|
|
1620
1713
|
parameters: [AGENT_ID, { name: "name", in: "path", required: true, description: "The learned workflow's folder name, `workflows/<name>/`.", schema: { type: "string" } }, { name: "digest", in: "path", required: true, description: "The revision: the first 16 hex of its workflow.json's sha256.", schema: { type: "string" } }],
|
|
1621
|
-
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, properties: { inputs: { oneOf: [{ const: "held" }, { type: "integer", minimum: 1, maximum:
|
|
1714
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, properties: { inputs: { oneOf: [{ const: "held" }, { type: "integer", minimum: 1, maximum: COMPILE_AFTER_MAX }], default: "held", description: "`held`: the runs it was last checked on; a number: the agent's newest that many completed runs." } } } } } },
|
|
1622
1715
|
responses: { "202": { description: "The replay started: its runs are queued.", headers: { Location: ref("headers/Location") }, content: { "application/json": { schema: closed({ replay: { type: "string", description: "The replay's id." }, inputs: { ...COUNT, description: "How many graded inputs it replays: one replay run each." } }) } } }, ...errors(400, 401, 403, 404, 409, 422, 429, 500) }, ...MARK,
|
|
1623
1716
|
},
|
|
1624
1717
|
},
|
|
1625
1718
|
"/agents/{agent_id}/learning/workflows/{name}/revisions/{digest}/replays/{replay_id}": {
|
|
1626
1719
|
get: {
|
|
1627
1720
|
operationId: "getLearnedWorkflowReplay", tags: ["agents"], summary: "Read a replay's result: running, done or failed, its counts and its score (start one from the console's Learning tab)",
|
|
1628
|
-
description: "A replay a run's claim or the agent's owner started. This read decides it as a claim would, once every replay run ended or its deadline passed (promoted
|
|
1721
|
+
description: "A replay a run's claim or the agent's owner started. This read decides it as a claim would, once every replay run ended or its deadline passed (promoted when it clears the check's bar, else held), so a replay of a revision no run lays is decided too. It never starts a run: a replay whose launch was interrupted (the server stopped before creating its runs) reads `running` until its deadline. `status`: `running` while it replays, `done` once promoted or held (`decided`, with its `reason`), `failed` when none of its runs started by its deadline (held, nothing replayed; its `reason` says so and to start it again with POST). `outcomes` counts its replay runs so far (once decided, those it was decided on, as its promotion record keeps them): `answered` alone, `handed_back` (the agent's recorded answer), `failed` (no evidence either way), `skipped_write` (a write its recording does not have). `score` is the decided record's. Aggregates only, its words cut as the promotions list's are.",
|
|
1629
1722
|
parameters: [AGENT_ID, { name: "name", in: "path", required: true, description: "The learned workflow's folder name.", schema: { type: "string" } }, { name: "digest", in: "path", required: true, description: "The revision's digest.", schema: { type: "string" } }, { name: "replay_id", in: "path", required: true, description: "The replay's id: POST .../replays answered it, and its promotion records carry it (`replay_id`).", schema: { type: "string" } }],
|
|
1630
1723
|
responses: { "200": json(closedWith({
|
|
1631
1724
|
replay: { type: "string" }, workflow: { type: "string" }, digest: { type: "string" },
|
|
1632
1725
|
status: { enum: ["running", "done", "failed"] },
|
|
1633
|
-
inputs: { ...COUNT, description: "Its replay runs: one per
|
|
1726
|
+
inputs: { ...COUNT, description: "Its replay runs: one per input." },
|
|
1634
1727
|
outcomes: REPLAY_OUTCOMES,
|
|
1635
1728
|
score: closed(REPLAY_SCORE),
|
|
1636
1729
|
cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null while one's cost is unknown (one not created or not ended yet), never a part of it." },
|
|
@@ -1747,10 +1840,10 @@ const EXTENSIONS = {
|
|
|
1747
1840
|
"/health": {
|
|
1748
1841
|
get: {
|
|
1749
1842
|
operationId: "getHealth", tags: ["capabilities"], summary: "Whether this server can serve", security: [{}],
|
|
1750
|
-
description: "Readable without a credential: the store opens and the data directory's disk is above its floor. 503 with the same shape when either fails.",
|
|
1843
|
+
description: "Readable without a credential: the store opens and the data directory's disk is above its floor. 503 with the same shape when either fails. While the server is still starting (it listens before it has loaded and opened its store), 503 with `status` `warming` and `checks.store` `opening`, and a Retry-After; every other request then answers 503 `unavailable`, retryable.",
|
|
1751
1844
|
responses: {
|
|
1752
1845
|
"200": json(HEALTH, "Healthy."),
|
|
1753
|
-
"503": json(HEALTH, "Not healthy: which check failed."),
|
|
1846
|
+
"503": json(HEALTH, "Not healthy: which check failed; or warming, still starting."),
|
|
1754
1847
|
...errors(429, 500),
|
|
1755
1848
|
},
|
|
1756
1849
|
},
|
|
@@ -2357,7 +2450,7 @@ const EXTENSIONS = {
|
|
|
2357
2450
|
operationId: "listComposioEvents", tags: ["local"], summary: "List a saved Composio server's toolkit's events, for a composio trigger",
|
|
2358
2451
|
description: "Every page of Composio's trigger types for the server's toolkit, asked with its saved key: each event's slug (a composio trigger's `event`), name, description, the JSON schema of its config (a trigger's `config`, its `required` fields marked) and whether Composio polls for it rather than being sent it. 404 for a name that is no saved server, or one not saved with the Composio preset; 422 when Composio refuses the key; 424 `upstream_failed` when Composio fails.",
|
|
2359
2452
|
parameters: [MCP_NAME],
|
|
2360
|
-
responses: { "200": json(closed({ server: { type: "string" }, toolkit: { type: "string" }, events: { type: "array", items: closedWith({ slug: { type: "string" }, name: { type: "string" }, description: { type: "string" }, config: { type: "object", description: "The event's config, as a JSON schema (`properties`, `required`)." }, polled: { type: "boolean", description: "Composio polls for it (every few minutes) rather than being sent it." } }, { instructions: { type: "string" } }) } }), "The toolkit's events."), ...errors(401, 404, 422, 429, 500), ...MCP_FAILED },
|
|
2453
|
+
responses: { "200": json(closed({ server: { type: "string" }, toolkit: { type: "string" }, events: { type: "array", items: closedWith({ slug: { type: "string" }, name: { type: "string" }, description: { type: "string" }, config: { type: "object", description: "The event's config, as a JSON schema (`properties`, `required`)." }, polled: { type: "boolean", description: "Composio polls for it (every few minutes) rather than being sent it." }, sealed: { type: "array", items: { type: "string" }, description: "The fields of its config a save seals: each named like a credential (developer_api_key), taken as a password and answered as \"[sealed]\" once saved. Composio's schemas mark no field secret, so the name says it." } }, { instructions: { type: "string" } }) } }), "The toolkit's events."), ...errors(401, 404, 422, 429, 500), ...MCP_FAILED },
|
|
2361
2454
|
...COMPOSIO_TRIGGERS_MARK,
|
|
2362
2455
|
},
|
|
2363
2456
|
},
|
|
@@ -2903,15 +2996,25 @@ const MCP_RUN_AUTH = {
|
|
|
2903
2996
|
description: "The credential each per_run MCP server this run calls is called with, by server name: `{\"<server>\": {\"headers\": {...}}}`. A credential for this run alone, from whoever starts it: the server keeps it sealed for the run's life and redacts its values from what the run shows.",
|
|
2904
2997
|
"x-agentrun-serve": "mcpperrun/1",
|
|
2905
2998
|
};
|
|
2999
|
+
/** runmodelkey/1: the run's own model key (run-model-key.ts), such as a LiteLLM virtual key minted for it. */
|
|
3000
|
+
const RUN_MODEL_KEY = {
|
|
3001
|
+
type: "string", minLength: 1, maxLength: MAX_MODEL_KEY_CHARS, pattern: "^[^\\s\\x00-\\x1f\\x7f]+$",
|
|
3002
|
+
// Not x-agentrun-secret, as mcp_auth: a key for this run alone, handed by whoever may start it, never kept for others.
|
|
3003
|
+
description: `The run's own model key: a key for the model gateway at AGENT_MODEL_BASE_URL, such as a LiteLLM virtual key minted for this run, which every model request tied to the run carries in place of the server's own key (its turns, its subagents, its learned workflows' nodes, a workflow's model nodes, its end-of-run look-back). AgentRun never mints, lists or revokes it. Sealed into the run's launch bound to the gateway's origin, read at each claim (a reclaim after a crash among them), erased by the write that ends the run's turn; never in its saved body, its timeline, its view, a log or an Idempotency-Key's fingerprint (a retry with a new key answers the first request's run, its first key kept). The harness, its tools and its sandbox never see it. 422 at \`model_key\` when the run's model never goes to that gateway (no AGENT_MODEL_BASE_URL here, a native run, or a model routed elsewhere). Absent, the run spends on the server's key for its route; where the server holds none (no AGENT_MODEL_API_KEY, none saved in Settings), a start without it is 422 \`model_key_required\`, never a failure at its first model call.`,
|
|
3004
|
+
"x-agentrun-serve": "runmodelkey/1",
|
|
3005
|
+
};
|
|
2906
3006
|
const FIELD_EXTENSIONS = {
|
|
2907
3007
|
Limits: {
|
|
2908
3008
|
free_model_requests: { type: "integer", minimum: 1, description: "The most requests on free models a run makes: a free model's catalog price is all zeros, so a dollar cap cannot stop it. AGENTRUN_FREE_MODEL_REQUESTS, else 60. The request after that many is not sent, and the run ends `failed`, its error `spend_cap_reached`: \"Not sent: this run reached its 60-request limit for free models.\" (the number is this one). Every free model's request counts, the run's own, its subagents', its side calls and any cut by a crash, capped or not; a paid request, a paid tool call and a workflow decision never do. ChatGPT-plan requests don't count.", "x-agentrun-serve": "freerequests/1" },
|
|
2909
3009
|
},
|
|
2910
3010
|
MessageCreate: {
|
|
3011
|
+
model_key: { ...RUN_MODEL_KEY, description: `${RUN_MODEL_KEY.description} On a message it replaces the run's key from the run's next model request on, a turn still going included, and it is the first key of a run that started on the server's (mint one per turn); a message without one keeps the key the run holds, which is none once its last turn ended: then, where the server holds no key for the run's model, the message is 422 \`model_key_required\` and nothing is written.` },
|
|
2911
3012
|
mcp_auth: { ...MCP_RUN_AUTH, description: `${MCP_RUN_AUTH.description} Replaces the run's handed credentials in the message's own write (a follow-up that opens an ended run again hands its turn's), so the turn the message starts calls with them. A run handed none calls a per_run server's tools refused, nothing sent.` },
|
|
2912
3013
|
},
|
|
2913
3014
|
Cost: {
|
|
2914
3015
|
...SO_FAR,
|
|
3016
|
+
learning_usd: { type: ["number", "null"], minimum: 0, description: "On the run read (GET /v2/runs/{run_id}) alone, where `usd` is the run's own spend, the job's: what learning spent for it, on the agent's own model route. Its look-back turn (a compile turn asked in it left out), its grades, its audit shadow's cost (the agent on its input with learning off), and its share of its workflow revision's learning spend: the compile turn that drafted that revision and its check's replay runs, spread over the first `compile_after` runs the revision serves (GET /agents/{agent_id}/learning/cost `bill.revisions`). A compile turn is never in the `usd` or `learning_usd` of the run whose session asked it: it is its revision's (a recompile's, its recompiled revision's), or, when every draft failed its checks, on no run (`bill.unattributed_usd`). A look-back that compiles nothing is this run's alone. 0 for a replay or shadow run, whose spend is on the runs it serves. As booked (float noise rounded off at 1e-12, as `usd` is); null while the run or its shadow is at work, or a part is unknown: never $0 for unknown.", "x-agentrun-serve": "allin/1" },
|
|
3017
|
+
all_in_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone: `usd` and `learning_usd` together, what the run cost its owner all in. 0 for a replay or shadow run. Over every run of an agent, these and the cost route's `bill.unattributed_usd` add up to its `bill.booked_usd`. Null when either is, or `usd` is only a bound (`upper_bound`).", "x-agentrun-serve": "allin/1" },
|
|
2915
3018
|
plan: {
|
|
2916
3019
|
type: "object", additionalProperties: false, required: ["requests", "tokens"],
|
|
2917
3020
|
properties: {
|
|
@@ -2923,6 +3026,7 @@ const FIELD_EXTENSIONS = {
|
|
|
2923
3026
|
},
|
|
2924
3027
|
},
|
|
2925
3028
|
RunCreate: {
|
|
3029
|
+
model_key: RUN_MODEL_KEY,
|
|
2926
3030
|
mcp_auth: { ...MCP_RUN_AUTH, description: `${MCP_RUN_AUTH.description} Each names a saved MCP server whose \`auth.type\` is per_run (422 at \`mcp_auth.<server>\` otherwise, no run made). Sealed into the run's launch for its life, read at each claim, and erased by the write that ends it; never in its saved body, its timeline, its view or an Idempotency-Key's fingerprint (a retry with a new credential answers the first request's run).` },
|
|
2927
3031
|
labels: { ...RUN_LABELS, description: `The caller's own labels for the run: at most ${MAX_LABELS} keys, each 1 to 63 letters, digits, \`.\`, \`_\`, \`-\` or \`/\` starting with a letter or a digit; each value text of 1 to ${MAX_LABEL_VALUE} characters with no control character. Kept on the run as given, served on every read of it (\`labels\` on Run and RunSummary) and matched by GET /runs' \`label\`; set once, at the start. The server reads nothing else from them: put no secret in one. Another shape is 422 under \`labels\` or \`labels.<key>\`. Absent: none.` },
|
|
2928
3032
|
workflow_first: {
|
|
@@ -2968,7 +3072,7 @@ const FIELD_EXTENSIONS = {
|
|
|
2968
3072
|
bytes: { type: "integer", minimum: 0, description: "Its size now." },
|
|
2969
3073
|
finished: { type: "boolean", description: "false while it is still being written: it plays up to its last whole fragment. true once its recording stopped, and for every file once the run has ended and the file has stopped changing (a few seconds after the end)." },
|
|
2970
3074
|
}, "One video of a computer's screen during the run (H.264 in fragmented MP4)."),
|
|
2971
|
-
description: "On the run read (and an archive's or unarchive's answer) alone, never in a list: the videos of the run's screen, where its agent's computer says `record: true` (a desktop or a
|
|
3075
|
+
description: "On the run read (and an archive's or unarchive's answer) alone, never in a list: the videos of the run's screen, where its agent's computer says `record: true` (a desktop, a phone or a browser, whose every session is a computer of its own), each computer's files in the order they were recorded; empty when nothing was recorded, and for a run whose words are withheld. Read from the files on the machine whose runner recorded them. The video shows everything on the screen: see the agent's `computer.record`.",
|
|
2972
3076
|
"x-agentrun-serve": "runvideo/1",
|
|
2973
3077
|
},
|
|
2974
3078
|
input: {
|
|
@@ -3004,6 +3108,12 @@ const FIELD_EXTENSIONS = {
|
|
|
3004
3108
|
"x-agentrun-serve": "imported/1",
|
|
3005
3109
|
},
|
|
3006
3110
|
trigger: RUN_TRIGGER,
|
|
3111
|
+
audit_of: { ...NULL_STRING, description: "On the run read: a shadow run's served run. A run a promoted learned workflow answered alone (path `workflow`; a run it handed back is never drawn) may be audited (the agent definition's `learning.audit_every`): its shadow, the same agent on the same input with learning off, started at the served run's end and capped at what the served run's cap left, is no row of any run list and sends no webhook, and its cost is in the served run's `cost.learning_usd` and `cost.all_in_usd` (null while the shadow is queued or running: never $0), never in its `cost.usd`, and in the agent's learning cost (GET /agents/{agent_id}/learning/audits). Null for any other run.", "x-agentrun-serve": "promotion/1" },
|
|
3112
|
+
path: {
|
|
3113
|
+
oneOf: [{ enum: [...RUN_PATHS] }, { type: "null" }],
|
|
3114
|
+
description: "On the run read (GET /v2/runs/{run_id}): the path the run took, as its end recorded it. `agent`: no learned workflow ran (every run of an agent that does not learn); `workflow`: a learned workflow served it first and its answer stands, `result.final_answer` that answer as the workflow gave it; `handed_back`: a learned workflow served it first and handed back (an escalate node said it could not, a step failed) or the agent answered after it, `result.final_answer` the agent's; `replay`: a check's run of a new revision on one of the agent's graded inputs; `audit`: an audit's shadow run (`audit_of`), the agent on a served run's input with learning off. A host's run list holds no `audit` run, and its webhooks never name one. Null while the run has not ended, for a workflow revision's run, and for a run that learns whose end recorded no path.",
|
|
3115
|
+
"x-agentrun-serve": "allin/1",
|
|
3116
|
+
},
|
|
3007
3117
|
},
|
|
3008
3118
|
InputIssue: {
|
|
3009
3119
|
code: { type: "string", description: "A workflow definition's issue: the DSL's validation code (`STATE_PATH_UNPRODUCED`, say), with `field` the path to it under `definition.workflow`.", "x-agentrun-serve": "validate/1" },
|
|
@@ -3067,7 +3177,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3067
3177
|
learned_nodes: {
|
|
3068
3178
|
type: "array",
|
|
3069
3179
|
items: { type: "object", additionalProperties: false, required: ["label", "kind", "status", "duration_ms"], properties: { label: { type: "string" }, kind: { type: "string", description: "The node's kind, as the workflow DSL names it (`extract`, `agent`, `call`, ...)." }, status: { type: "string", description: "How the node ended: `ok`, `failed` or `escalated`. Why a node failed is never shown: its text may hold part of a secret." }, duration_ms: { type: "number" }, model: { type: "string", description: "A model node's (agent, decide, extract, report): the model it ran on, as the run's model route names it. Absent on a call node." }, tier: { type: "string", description: "The tier the model node named (`fast`, `strong`); absent for none, which runs on the run's own model." } } },
|
|
3070
|
-
description: "On a learned workflow call's `tool_result` row alone (`tool_name` learned_workflow): each of the workflow's nodes that ran, in the order they ended, at most 64. Absent on every other row.",
|
|
3180
|
+
description: "On a learned workflow call's `tool_result` row alone (`tool_name` learned_workflow): each of the workflow's nodes that ran, in the order they ended, at most 64. A learned workflow's nodes write no rows of their own (no `decision` row: a workflow revision's run alone has those; a decision node, `judge` or `pick` say, is an item here), so this list is the whole of them on the timeline. A served run (GET /runs/{id} `path` `workflow` or `handed_back`) reads in this order: its `user_message`, the learned_workflow `tool_use` and this `tool_result` with its items, then, served alone (`workflow`), the `final_answer` row that is the workflow's answer (`result.final_answer`) and the `usage` row; after a hand-back (`handed_back`), a `phase` row, the agent's own rows, its `final_answer` and the `usage` row. Each model node runs on the run's own model route (its tier's model when it names one), on the run's own key and cap. Absent on every other row.",
|
|
3071
3181
|
"x-agentrun-serve": "learnednodes/1",
|
|
3072
3182
|
},
|
|
3073
3183
|
computer_calls: {
|
|
@@ -3136,13 +3246,13 @@ const FIELD_EXTENSIONS = {
|
|
|
3136
3246
|
model: { type: "string", description: "`provider/model-id`, the model an agentic revision runs on; absent, this host's default. A workflow revision keeps none.", "x-agentrun-serve": "model/1" },
|
|
3137
3247
|
model_tiers: { type: "object", additionalProperties: false, minProperties: 1, properties: { fast: { type: "string" }, strong: { type: "string" } }, description: "The model of each of an agentic revision's tiers it names, each `provider/model-id`: what a `subagent` call that names that tier runs on (a call names a tier, never a model; one that names none runs on the revision's own model). A tier it leaves out runs on this host's model for the tier (AGENT_MODEL_FAST, AGENT_MODEL_STRONG, else the default). A workflow revision keeps none.", "x-agentrun-serve": "subagent/1" },
|
|
3138
3248
|
thinking: { enum: [...THINKING_LEVELS], description: "An agentic revision's thinking level; absent, the model's. A workflow revision keeps none.", "x-agentrun-serve": "model/1" },
|
|
3139
|
-
harness: {
|
|
3249
|
+
harness: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The harness that runs the revision: one of capabilities' `harnesses` ids (the built-in pi, claude-agent, codex and opencode, and any an owner's harness module adds). Absent on a request, pi; every answer names it. One this server does not run saves with a warning, and its runs are 409 agent_not_runnable naming it (capabilities.harnesses).", "x-agentrun-serve": "harness/1" },
|
|
3140
3250
|
place: {
|
|
3141
3251
|
oneOf: [
|
|
3142
3252
|
{ type: "object", additionalProperties: false, required: ["mode"], properties: { mode: { const: "runner" } } },
|
|
3143
3253
|
{ type: "object", additionalProperties: false, required: ["mode", "box"], properties: { mode: { const: "sandbox" }, box: { enum: [...BOX_IDS] } } },
|
|
3144
3254
|
],
|
|
3145
|
-
description: "Where the revision's runs execute: `runner` (no box and no shell) or `sandbox` (the agent's file and shell tools run in the box; its loop, its log and every key stay on the server). Absent on a create of an agentic revision, the place this server gives a new agent (capabilities.places.default_place): the Docker box where this server has docker, written on the revision so an answer shows it, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools (a list it names, an empty one included, is kept as named); where docker is unavailable,
|
|
3255
|
+
description: "Where the revision's runs execute: `runner` (no box and no shell) or `sandbox` (the agent's file and shell tools run in the box; its loop, its log and every key stay on the server). Absent on a create of an agentic revision, the place this server gives a new agent (capabilities.places.default_place): the Docker box where this server has docker, written on the revision so an answer shows it, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools (a list it names, an empty one included, is kept as named, and gets the box only when one of its tools runs only there: `bash` or a background tool); where docker is unavailable, where the definition's tools need no shell, or where it names a tool a box refuses (browser), none, so its runs start on the runner with no container. A revision saved with no place runs where this server's capabilities.places.default_place says at each run (the Docker box where docker is available now, else the runner) when one of its tools needs a shell; a workflow, one whose tools need no shell, and one that names a tool a box refuses, on the runner. A revision keeps the place it names, runner included. An edit that names none keeps the agent's. A box this server does not have saves with a warning, and its runs are 409 agent_not_runnable naming it (capabilities.places.boxes). Only an agentic revision in a sandbox place may name `bash` or a background tool (`bash_background`, `bash_output`, `bash_input`, `bash_signal`, `bash_list`); a workflow revision's place is runner or none (a sandbox place is 422).",
|
|
3146
3256
|
"x-agentrun-serve": "place/1",
|
|
3147
3257
|
},
|
|
3148
3258
|
computer: {
|
|
@@ -3155,7 +3265,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3155
3265
|
persistent: { type: "boolean", description: "Whether the agent keeps its own computer between runs: true makes one at its first run, detaches it (not deletes it) at each run's end, and attaches it again at the next, with what was on it; false or absent, a fresh computer for each run. Only where the provider keeps one for the kind and image (GET /computers: the provider's `persistent`), else 422 not_allowed; never one that mounts the run's folder. One run at a time: a run that finds the computer held by another run still going is refused at its start, naming that run. Archiving the agent, turning this off, or a setting on another provider or image deletes the computer (GET /agents/{agent_id}'s `own_computer` shows it)." },
|
|
3156
3266
|
surface: { enum: ["code", "tools"], description: "How the agent drives a desktop or a phone. `code`: by `codemode` scripts alone, whose `tools.computer_observe`, `tools.computer_act` and `tools.computer_screenshot` are each a gated, recorded call of its own; the model is offered `codemode` and the hand-over (`computer_request_handoff`), not the step tools (a harness with its own code mode, Codex, is still handed them). `tools`: the step tools and the hand-over, listed; a `codemode` script calls them too. Absent, as `tools`. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
|
|
3157
3267
|
exec: { type: "boolean", description: "`false`: the agent gets no shell and starts no program on its desktop or phone. Its computer's `exec` and `processes` groups are taken out of what its tools and scripts see (no `computer.shell`, no `computer.processes`; a script that reaches for one is refused in words), no folder is mounted in the computer, and the run gets no `bash` or background tool, wherever its folder is. The run's own computer channel (`POST /runs/{run_id}/computer/call`, the owner's) keeps every group. `true` or absent: as the computer offers. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
|
|
3158
|
-
record: { type: "boolean", description: "`true`: each run records a video of its desktop's or
|
|
3268
|
+
record: { type: "boolean", description: "`true`: each run records a video of its desktop's, phone's or browser's screen (a browser's from each session's page, one file per session; H.264, fragmented MP4, at most 10 frames a second and 1280 pixels on the long side, no audio) into its run folder's `recordings/`, beside `work/`, where the agent can neither read nor change it. The video shows everything on the screen, including whatever a person types while they take over and any secret that appears on screen; pixels can't be redacted the way the run's logs are. It records while the run holds the computer, with or without a viewer, pauses while the run is parked (a resumed run goes on in a new file) and stops at the computer's release, the run's end, or its cap (500 MB across the run's files, or 2 hours from its start or the run's resume), which the run's timeline says. A server without ffmpeg refuses it (422 not_allowed). `false` or absent: nothing is recorded. A sandbox doesn't take it (422 not_allowed)." },
|
|
3159
3269
|
},
|
|
3160
3270
|
description: "The computer the revision's runs are given (Settings → Computers): its kind, the provider that serves it, the image it starts from, a sandbox's GPUs, whether the agent keeps it between runs, and, for a desktop or a phone, how the agent drives it, whether it may run programs on it and whether its runs record its screen. `place` is its v2 view where it can say it: `{kind: none}` is `place {mode: runner}`, `{kind: sandbox, provider: X}` is `place {mode: sandbox, box: X}`; a desktop, phone or browser computer leaves the run's folder on the runner, so its place reads runner. Writing either sets both, and both given must agree (422). Absent on a create, the server's default (as `place`); an edit that names neither keeps the agent's.",
|
|
3161
3271
|
"x-agentrun-serve": "computer/1",
|
|
@@ -3166,7 +3276,13 @@ const FIELD_EXTENSIONS = {
|
|
|
3166
3276
|
compile_after: { type: "integer", minimum: 1, maximum: 200, default: 20, description: "The job compiles into a learned workflow once the agent has this many completed runs of its own." },
|
|
3167
3277
|
agree_min: { type: "number", minimum: 0, maximum: 1, default: 0.8, description: "The draft's one check replays it on the inputs of those runs: promoted only when, of the inputs it answered alone, at least this share say what the agent's own recorded answer said." },
|
|
3168
3278
|
alone_min: { type: "number", minimum: 0, maximum: 1, default: 0.7, description: "...and only when it answered at least this share of them alone (no escalate, no failed step). Under either bar it is recompiled once with the inputs it did not agree on, checked the same way, then promoted or stopped: nothing compiles again." },
|
|
3169
|
-
|
|
3279
|
+
audit_every: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_every, description: "Once a learned workflow serves, 1 in this many of the runs it answers alone (path `workflow`; a run it hands back is never drawn) is audited: drawn from the run's id, the same agent runs the same input again with learning off (a shadow run, hidden from the run list, its cost the agent's learning cost), and the two answers are compared (one row of GET .../learning/audits)." },
|
|
3280
|
+
audit_every_later: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_every_later, description: "1 in this many once the workflow's revision served `audit_later_after` runs." },
|
|
3281
|
+
audit_later_after: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_later_after, description: "The served runs after which `audit_every_later` applies." },
|
|
3282
|
+
hold_window: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.hold_window, description: "The audit rows of the serving revision the hold rule reads: its newest this many (an owner's grade on a served run is one too)." },
|
|
3283
|
+
hold_disagree: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.hold_disagree, description: "When at least this many of those rows disagree, the workflow stops serving (a hold, source `audit`) and is recompiled once with them as data, then checked again: promoted serves again, otherwise it stops. At most `hold_window`." },
|
|
3284
|
+
stop_window: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.stop_window, description: "A second hold within this many served runs of the first stops the workflow for good, asking no compile." },
|
|
3285
|
+
} }], default: false, description: "Whether an agentic revision's runs learn, and what: `true`, notes, skills and learned workflows; an object, the same with the loop's numbers set on it (`compile_after`, `agree_min`, `alone_min`, `audit_every`, `audit_every_later`, `audit_later_after`, `hold_window`, `hold_disagree`, `stop_window`, each optional: one left out is its default; `true` is every default); `\"notes\"`, notes and skills alone (a run is never given a learned workflow nor asked to draft one); `false`, nothing. A run that learns starts from what its agent has learned, its notes in its instructions under `# Learned` (each whole within the server's learning budget, else the index and the notes changed last, whole) and in `.learning/` in its working directory, and once it answers or fails is asked one more turn to add notes there, which are checked, graded and merged. Kept when a definition says so, true, false, `\"notes\"` or an object (its numbers in one order); a number out of range or an unknown key is a 422 `wrong_type`; absent, off, and an answer shows none. An edit that leaves it out keeps the agent's. A workflow revision keeps none. On a server whose learning is off (`capabilities.features.learning`), no run learns, whatever this says.", "x-agentrun-serve": "learning/1" },
|
|
3170
3286
|
checkout: { enum: ["pull_request", "none"], description: "What the server checks out in each run's folder before its first turn, an agentic definition's alone. `pull_request`: the pull request the run's GitHub event names (a GitHub trigger's firing: its repository, number, head and base), at its head, detached, in `repo/`, with its base and their merge base fetched beside it (refs `pr/head`, `pr/base`, `pr/merge-base`). The fetch is the server's own, one command on the run's folder, with an installation token of the server's GitHub App narrowed to that repository and `contents: read`, which the agent never holds: it is never in the folder, the checkout's git config, its remote's URL, the agent's environment or the log. With no App, or one not installed there, the fetch is anonymous, which a public repository answers. The run's system prompt says what was checked out, or why nothing was (no pull request named, the fetch failed), so it can read the change another way, such as the GitHub MCP. The checkout is removed when the run's claim ends. An edit that leaves it out keeps the agent's; `none` clears it. A template sets it from its manifest's `checkout`.", "x-agentrun-serve": "checkout/1" },
|
|
3171
3287
|
},
|
|
3172
3288
|
AgentCreate: {
|
|
@@ -3258,7 +3374,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3258
3374
|
harnesses: {
|
|
3259
3375
|
type: "array",
|
|
3260
3376
|
description: "Each harness a revision may name, and whether this server runs it; when not, why. A harness whose one run needs more memory than this server has for runs is unavailable, its reason naming the numbers, and its runs are 409 agent_not_runnable.",
|
|
3261
|
-
items: { type: "object", additionalProperties: false, required: ["id", "available", "steer", "default_model", "models", "free_models", "run_memory_mib", "max_concurrent_runs"], properties: { id: {
|
|
3377
|
+
items: { type: "object", additionalProperties: false, required: ["id", "label", "promises", "available", "steer", "default_model", "models", "free_models", "run_memory_mib", "max_concurrent_runs"], properties: { id: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The harness's id: a built-in one (pi, claude-agent, codex, opencode), or one an owner's harness module adds (`agentrun-serve --harness-module`), listed after them." }, label: { type: "string", description: "Its name in a sentence (`Pi`, `Claude`, `Codex`, `OpenCode`).", "x-agentrun-serve": "harness-table/1" }, promises: HARNESS_PROMISES, available: { type: "boolean" }, free_models: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "context_window"], properties: { id: { type: "string", description: "The model, as it is in `models`." }, context_window: { type: "integer", minimum: 1, description: "Its context window, in tokens." } } }, description: "The models in `models` that run at $0: those whose catalog price is all zeros (input, output and cache), with each one's context window. Today OpenRouter's free models on pi, on OpenRouter's key (`openrouter/inclusionai/ling-3.2-flash:free`, `openrouter/nvidia/nemotron-3-ultra-550b-a55b:free`). Never a router that picks a model per request (`openrouter/auto`, `openrouter/free`): its price is the routed model's. A free model's provider may still limit its requests per minute and per day. Empty for a harness with none." }, models: { type: "array", items: { type: "string" }, description: "The current models a person may pick for this harness, each in the exact form a definition's `model` takes on it here (`anthropic/claude-sonnet-5-5` on a provider's own key; `openrouter/anthropic/claude-sonnet-5.5` when OpenRouter's is the only key; behind a gateway, the host's own model ids that are `provider/model-id`, for the harnesses that go through it; the save takes no other form). Only those this harness runs here: a model its catalog does not know is not listed. Empty when the harness does not run here. Any other model a definition names is still saved if the harness runs it." }, run_memory_mib: { type: "integer", minimum: 1, description: "The memory a run of this harness reserves while its process lives, in MiB, measured. A start is admitted while the runs going and it fit in this server's memory less its own; over that, 429 rate_limited with retry-after, as over `limits.max_concurrent_runs`." }, max_concurrent_runs: { type: "integer", minimum: 0, description: "The most runs of this harness alone at once here: by memory and by the cap on the count, whichever is fewer. 0 when one never fits. `limits.max_concurrent_runs` is pi's, the smallest run." }, default_model: { type: ["string", "null"], description: "The model this server runs for the harness when a definition names none (provider/model-id), or null when it runs none: the harness does not run here, or no default model here runs on it." }, steer: { type: "boolean", description: "Whether a message sent while the run works lands mid-turn (`steer`); when false, it waits for the turn's end and the answer's mode is `follow_up`." }, reason: { type: "string", description: "Why it does not run here, in words a person acts on; on one that runs here but has no default model for want of a key (pi with no key), why it has none. Where the ChatGPT sign-in would run it (`needs` lists `chatgpt`), it says so: \"or sign in with ChatGPT (Settings → Model keys) to run it on your ChatGPT plan\", or, signed in no longer, \"your ChatGPT sign-in expired: sign in again (Settings → Model keys)\"." }, needs: { type: "array", items: { enum: ["key", "chatgpt"] }, minItems: 1, uniqueItems: true, description: "Present on a harness that runs nothing here for want of a model key: what would give it a model, any one of them. `key`: a model key (Settings → Model keys). `chatgpt`: the ChatGPT sign-in (codex and pi, on a server that signs in with ChatGPT, not signed in or signed in no longer, and whose AGENT_MODEL names no key's model the harness runs: that model stays its default signed in or not). Absent where it runs, and where no key would make it run.", "x-agentrun-serve": "harness-needs/1" }, installs: { const: "on_first_use", description: "claude-agent and codex only, while that harness's CLI is not installed in this server's data: it installs on first use. The first run on it, or the first agent saved on it, installs the version AgentRun pins (claude-agent: the Claude Agent SDK; codex: Codex) from npm into `<data>/harnesses/<harness>`, by the lock AgentRun ships, once (every run that needs it waits for that one install); a run shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. When npm fails the run fails, and its error names the command that installs it by hand. Absent once it is installed.", "x-agentrun-serve": "firstuse/1" } } },
|
|
3262
3378
|
// harness/2: each entry took on its memory and count (run_memory_mib, max_concurrent_runs). A client that validates
|
|
3263
3379
|
// against harness/1 refuses them, so it is a mark of its own. harness/3: each entry also lists its `models`
|
|
3264
3380
|
// (required), which a harness/2 shape disallows. harness/4: an entry may say what it `needs`. harness/5: each entry
|
|
@@ -3272,7 +3388,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3272
3388
|
type: "object", additionalProperties: false, required: ["name", "summary", "nodes", "calls", "available", "harnesses", "permission", "default_permission", "permissions"],
|
|
3273
3389
|
properties: {
|
|
3274
3390
|
name: { type: "string" }, summary: { type: "string" }, blurb: { type: "string", description: "One short line for people (the editor's Tools grid); the model never sees it. Absent for an MCP server's tool.", "x-agentrun-serve": "tool-blurb/1" }, nodes: { type: "boolean" }, calls: { type: "boolean" }, call_only: { type: "boolean", description: "Only a workflow's call node runs it (pdf_pages, llm): no agentic revision or model node names it." }, meta: { type: "boolean", description: "A host tool over the run's own tools (tools_search, tools_call, codemode): no revision, model node or call node names it, so it is no grant; Settings → Tools sets it (allow or deny: a deny is not offered)." }, sandbox_only: { type: "boolean", description: "Only an agent whose place is a sandbox names it (bash, and the background tools bash_background, bash_output, bash_input, bash_signal and bash_list): it runs in the box, and a runner has no shell, except in Mode 2, where bash alone runs on Archil's serverless exec." }, available: { type: "boolean" }, reason: { type: "string", description: "Why the tool is unavailable here, present whenever `available` is false: a provider pick's own words (`web_search is turned off in settings`, `parallel picked, no PARALLEL_API_KEY`), or `Needs` and the variables it is missing; for a sandbox-only tool (bash, the background tools) that no box this server has can run, `no box is set up on this server: …` with each box's own reason (`places.boxes`); in Mode 2 bash is available with no box." }, missing: { type: "array", items: { type: "string" } },
|
|
3275
|
-
harnesses: { type: "array", items: {
|
|
3391
|
+
harnesses: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES] }, description: "The harnesses that run the tool here, ids of capabilities' `harnesses`: a host tool, every one; another tool, pi and any harness an owner's harness module adds without adapter facts (it runs pi's tools). A revision naming it on another harness saves with a warning and its runs are 409 agent_not_runnable.", "x-agentrun-serve": "tool-harness/1" },
|
|
3276
3392
|
providers: { type: "array", items: { type: "string" }, description: "A tool with a provider choice: the providers offered for it, its default first.", "x-agentrun-serve": "providers/1" },
|
|
3277
3393
|
provider: { type: "string", description: "A tool with a provider choice: the server's, its default where it sets none.", "x-agentrun-serve": "providers/1" },
|
|
3278
3394
|
default_provider: { type: "string", description: "A tool with a provider choice: the built-in default.", "x-agentrun-serve": "providers/1" },
|
|
@@ -3323,7 +3439,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3323
3439
|
{ type: "object", additionalProperties: false, required: ["mode"], properties: { mode: { const: "runner" } } },
|
|
3324
3440
|
{ type: "object", additionalProperties: false, required: ["mode", "box"], properties: { mode: { const: "sandbox" }, box: { enum: [...BOX_IDS] } } },
|
|
3325
3441
|
],
|
|
3326
|
-
description: "The place a NEW agentic agent that names none is saved with, written on its revision at its create: the Docker box (`{\"mode\": \"sandbox\", \"box\": \"docker\"}`) where this server has docker, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools; else the runner, with `default_reason`. It is also where an agentic revision saved with no place runs, resolved at each run: a workflow, and a revision that names a tool a box refuses, run on the runner. (It replaces `places.default`, which said `runner`.)",
|
|
3442
|
+
description: "The place a NEW agentic agent that names none and has a shell is saved with, written on its revision at its create: the Docker box (`{\"mode\": \"sandbox\", \"box\": \"docker\"}`) where this server has docker, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools; else the runner, with `default_reason`. One whose named tools need no shell is saved with no place and runs on the runner. It is also where an agentic revision saved with no place and a shell tool runs, resolved at each run: a workflow, a revision whose tools need no shell, and a revision that names a tool a box refuses, run on the runner. (It replaces `places.default`, which said `runner`.)",
|
|
3327
3443
|
"x-agentrun-serve": "place/4",
|
|
3328
3444
|
},
|
|
3329
3445
|
default_reason: { type: "string", description: "Why a new agent is not given a box here, when `default_place` is the runner, in docker's own words: `new agents run on the runner, because the docker box is unavailable here: <docker's reason>`, such as `Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart AgentRun`, or, with AGENTRUN_BOXES set to a list without docker, empty or `none`, the setting that turns it on.", "x-agentrun-serve": "place/3" },
|
|
@@ -3413,7 +3529,7 @@ const BLOCKED_DETAILS = {
|
|
|
3413
3529
|
properties: {
|
|
3414
3530
|
unbound: { type: "array", items: { type: "string" }, description: "The tools the revision names that this server does not bind, or does not bind on its harness." },
|
|
3415
3531
|
missing: { type: "object", additionalProperties: { type: "array", items: { type: "string" } }, description: "Each bound tool this host cannot run yet, with the variables it is missing." },
|
|
3416
|
-
harness: {
|
|
3532
|
+
harness: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The revision's harness, when this server does not run it (capabilities.harnesses)." },
|
|
3417
3533
|
denied: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to deny here." },
|
|
3418
3534
|
asks: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to ask here (a catalog tool's default among them). A call node cannot wait for an approval: set the tool to allow for the agent." },
|
|
3419
3535
|
box: { enum: [...BOX_IDS], description: "The box of the revision's place, when this server does not have it (capabilities.places.boxes)." },
|