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
+41
-3
@@ -601,6 +601,13 @@ export const deployments = sqliteTable("deployments", {
|
||||
engineInfo: text("engine_info", { mode: "json" }).$type<EngineInfo>(),
|
||||
/** Temporary deployment created by a benchmark sweep (removed when its variant is done). */
|
||||
sweepId: text("sweep_id"),
|
||||
/** Created through the API: the token and its name at the time. */
|
||||
requestedByTokenId: text("requested_by_token_id"),
|
||||
requestedBy: text("requested_by"),
|
||||
/** Agents can't edit, stop, delete or benchmark it, nor start anything that would crowd it out of VRAM. */
|
||||
protected: integer("protected", { mode: "boolean" }).notNull().default(false),
|
||||
/** An agent asked to start it; it starts once someone approves (approval mode "approve"). */
|
||||
startRequestedAt: ts("start_requested_at"),
|
||||
createdAt: createdAt(),
|
||||
updatedAt: updatedAt(),
|
||||
});
|
||||
@@ -637,7 +644,7 @@ export const apiKeys = sqliteTable("api_keys", {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/** What a token may do. Nothing can delete, change settings or manage runtimes/tokens. */
|
||||
export const TOKEN_SCOPES = ["models:read", "downloads:create"] as const;
|
||||
export const TOKEN_SCOPES = ["models:read", "downloads:create", "deployments:read", "deployments:write", "benchmarks:read", "benchmarks:run"] as const;
|
||||
export type TokenScope = (typeof TOKEN_SCOPES)[number];
|
||||
|
||||
export const apiTokens = sqliteTable(
|
||||
@@ -657,11 +664,31 @@ export const apiTokens = sqliteTable(
|
||||
(t) => [uniqueIndex("api_tokens_name_uq").on(t.name)],
|
||||
);
|
||||
|
||||
/** What tokens did: every request that creates or changes something, and refusals by a guardrail. */
|
||||
export const agentActivity = sqliteTable(
|
||||
"agent_activity",
|
||||
{
|
||||
id: id(),
|
||||
tokenId: text("token_id").notNull(),
|
||||
tokenName: text("token_name").notNull(),
|
||||
/** e.g. "deployment.create", "deployment.start", "benchmark.run", "sweep.create", "download.request". */
|
||||
action: text("action").notNull(),
|
||||
targetType: text("target_type"),
|
||||
targetId: text("target_id"),
|
||||
/** ok, pending_approval or refused (then `code` is the error code). */
|
||||
outcome: text("outcome", { enum: ["ok", "pending_approval", "refused"] }).notNull(),
|
||||
code: text("code"),
|
||||
message: text("message"),
|
||||
createdAt: createdAt(),
|
||||
},
|
||||
(t) => [index("agent_activity_token_idx").on(t.tokenId, t.createdAt)],
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Benchmarks (BetterBench runs against a running deployment)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export const BENCHMARK_STATES = ["queued", "running", "completed", "failed", "cancelled"] as const;
|
||||
export const BENCHMARK_STATES = ["pending_approval", "queued", "running", "completed", "failed", "cancelled"] as const;
|
||||
export type BenchmarkState = (typeof BENCHMARK_STATES)[number];
|
||||
|
||||
export const BENCHMARK_PHASES = ["decode", "prefill", "concurrency"] as const;
|
||||
@@ -920,6 +947,11 @@ export const benchmarkRuns = sqliteTable(
|
||||
resources: text("resources", { mode: "json" }).$type<ResourceStats>(),
|
||||
/** Run of a sweep variant. */
|
||||
sweepId: text("sweep_id"),
|
||||
/** Requested through the API: the token and its name at the time. */
|
||||
requestedByTokenId: text("requested_by_token_id"),
|
||||
requestedBy: text("requested_by"),
|
||||
/** Agent runs: cancelled after this many seconds of running. */
|
||||
timeLimitS: integer("time_limit_s"),
|
||||
/** Hardware, runtime and model facts (A, and B of an A/B), recorded at the start. */
|
||||
meta: text("meta", { mode: "json" }).$type<RunMeta>(),
|
||||
metaB: text("meta_b", { mode: "json" }).$type<RunMeta>(),
|
||||
@@ -983,7 +1015,7 @@ export const benchmarkPublications = sqliteTable(
|
||||
// Benchmark sweeps: one base deployment, one or two settings varied, a run per variant
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export const SWEEP_STATES = ["queued", "running", "completed", "failed", "cancelled"] as const;
|
||||
export const SWEEP_STATES = ["pending_approval", "queued", "running", "completed", "failed", "cancelled"] as const;
|
||||
export type SweepState = (typeof SWEEP_STATES)[number];
|
||||
|
||||
/** A setting a sweep varies; values are strings as entered (parsed per key). */
|
||||
@@ -1016,5 +1048,11 @@ export const benchmarkSweeps = sqliteTable("benchmark_sweeps", {
|
||||
startedAt: ts("started_at"),
|
||||
finishedAt: ts("finished_at"),
|
||||
error: text("error"),
|
||||
/** Requested through the API: the token and its name at the time. */
|
||||
requestedByTokenId: text("requested_by_token_id"),
|
||||
requestedBy: text("requested_by"),
|
||||
/** Agent sweeps: the sweep is stopped after this many seconds, each of its runs after runTimeLimitS. */
|
||||
timeLimitS: integer("time_limit_s"),
|
||||
runTimeLimitS: integer("run_time_limit_s"),
|
||||
createdAt: createdAt(),
|
||||
});
|
||||
Reference in new issue
Block a user