Release 0.13.0: agent API for deployments and benchmarks
Release / release (push) Successful in 3m0s
Release / release (push) Successful in 3m0s
Scopes deployments:read/write and benchmarks:read/run; /api/v1 endpoints for runtimes, deployments (create with dry run, edit, start, stop, delete own ones), benchmark runs, A/B, sweeps and comparisons; ?wait= on all status endpoints. Guardrails: approval, agent deployments at once, one GPU job at a time, time limits, sweep variants, runtime and argument allowlists, host port range, memory/CPU caps, protected deployments with a VRAM check. Requested-by filters, approval bars, per-token activity log, scope editing, docs/agent/SKILL-tuning.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e007a35143
commit
716bd8f2f0
62 files changed
+6091
-219
No files matched your search
@@ -6,6 +6,7 @@ import { access, mkdir, readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { asc, eq } from "drizzle-orm";
|
||||
import { overTime } from "@/lib/agent-tuning";
|
||||
import { engineLabel, metaNotes, modelLabel, withLoadLinks } from "@/lib/benchmark-meta";
|
||||
import { REPORT_FILE, RESULTS_FILE, runDir } from "@/lib/benchmark-paths";
|
||||
import { effectiveHardware, runSetup } from "@/lib/benchmark-snapshot";
|
||||
@@ -366,12 +367,21 @@ export async function tickBenchmarks(): Promise<void> {
|
||||
if (starting) return;
|
||||
if (current) {
|
||||
const cur = current;
|
||||
const [run] = await db().select({ cancel: benchmarkRuns.cancelRequestedAt }).from(benchmarkRuns).where(eq(benchmarkRuns.id, cur.runId));
|
||||
const [run] = await db()
|
||||
.select({ cancel: benchmarkRuns.cancelRequestedAt, startedAt: benchmarkRuns.startedAt, timeLimitS: benchmarkRuns.timeLimitS })
|
||||
.from(benchmarkRuns)
|
||||
.where(eq(benchmarkRuns.id, cur.runId));
|
||||
if (!run || run.cancel) {
|
||||
cur.cancelled = true;
|
||||
stop(cur);
|
||||
return;
|
||||
}
|
||||
// Agent runs have a time limit (Settings → API tokens).
|
||||
if (overTime(run.startedAt, run.timeLimitS)) {
|
||||
cur.lost = `Stopped: the run exceeded the time limit for agent runs (${Math.round((run.timeLimitS ?? 0) / 60)} min).`;
|
||||
stop(cur);
|
||||
return;
|
||||
}
|
||||
for (const depId of cur.deploymentIds) {
|
||||
const [d] = await db().select({ state: deployments.state }).from(deployments).where(eq(deployments.id, depId));
|
||||
if (!d || d.state !== "running") {
|
||||
|
||||
+10
-3
@@ -7,6 +7,7 @@ import { deploymentSnapshot } from "@/lib/benchmark-snapshot";
|
||||
import { db } from "@/lib/db/client";
|
||||
import { benchmarkRuns, benchmarkSweeps, deployments, modelFiles, runtimes, type SweepVariant } from "@/lib/db/schema";
|
||||
import { estimateMemoryMb } from "@/lib/deploy-command";
|
||||
import { overTime } from "@/lib/agent-tuning";
|
||||
import { applyOverrides } from "@/lib/sweep";
|
||||
import { log } from "./log";
|
||||
|
||||
@@ -47,17 +48,19 @@ async function advance(sweep: Sweep): Promise<void> {
|
||||
await save(sweep.id, { variants });
|
||||
};
|
||||
|
||||
if (sweep.cancelRequestedAt) {
|
||||
const timedOut = overTime(sweep.startedAt, sweep.timeLimitS);
|
||||
if (sweep.cancelRequestedAt || timedOut) {
|
||||
for (const v of variants) {
|
||||
if (v.state === "benchmarking" && v.runId) await db().update(benchmarkRuns).set({ cancelRequestedAt: new Date() }).where(eq(benchmarkRuns.id, v.runId));
|
||||
if (v.state === "deploying" || v.state === "benchmarking") await removeDeployment(v.deploymentId);
|
||||
}
|
||||
await save(sweep.id, {
|
||||
state: "cancelled",
|
||||
state: timedOut ? "failed" : "cancelled",
|
||||
...(timedOut ? { error: `Stopped: the sweep exceeded the time limit for agent sweeps (${Math.round((sweep.timeLimitS ?? 0) / 60)} min).` } : {}),
|
||||
finishedAt: new Date(),
|
||||
variants: variants.map((v) => (v.state === "pending" || v.state === "deploying" || v.state === "benchmarking" ? { ...v, state: "skipped" as const } : v)),
|
||||
});
|
||||
log.info(`sweep ${sweep.id}: cancelled`);
|
||||
log.info(`sweep ${sweep.id}: ${timedOut ? "stopped at its time limit" : "cancelled"}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,6 +117,10 @@ async function advance(sweep: Sweep): Promise<void> {
|
||||
settings: sweep.settings,
|
||||
snapshot: snap.snapshot,
|
||||
sweepId: sweep.id,
|
||||
// Runs of an agent's sweep carry its token and the per-run time limit.
|
||||
requestedByTokenId: sweep.requestedByTokenId,
|
||||
requestedBy: sweep.requestedBy,
|
||||
timeLimitS: sweep.runTimeLimitS,
|
||||
})
|
||||
.returning({ id: benchmarkRuns.id });
|
||||
await put(i, { state: "benchmarking", runId: run.id });
|
||||
|
||||
Reference in new issue
Block a user