@evolvingmachines/evolve 0.0.65 → 0.0.67
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/dist/{chunk-DK2MGUPB.js → chunk-RFLMRPGK.js} +5 -5
- package/dist/cli/index.cjs +39 -39
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +30 -30
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{types-B_qmzlMk.d.cts → types-84M4J_Vm.d.cts} +11 -44
- package/dist/{types-B_qmzlMk.d.ts → types-84M4J_Vm.d.ts} +11 -44
- package/package.json +4 -4
- package/skills/create-adapter/SKILL.md +71 -26
- package/skills/create-task/SKILL.md +124 -66
- package/skills/evolve/SKILL.md +37 -20
- package/skills/evolve-evals/SKILL.md +142 -69
- package/skills/evolve-evals/references/cli-reference/agent.md +76 -0
- package/skills/evolve-evals/references/cli-reference/analysis.md +78 -0
- package/skills/evolve-evals/references/cli-reference/analyze.md +95 -0
- package/skills/evolve-evals/references/cli-reference/auth.md +96 -0
- package/skills/evolve-evals/references/cli-reference/check.md +156 -0
- package/skills/evolve-evals/references/cli-reference/dataset.md +154 -0
- package/skills/evolve-evals/references/cli-reference/filesystem.md +168 -0
- package/skills/evolve-evals/references/cli-reference/index.md +149 -0
- package/skills/evolve-evals/references/cli-reference/job.md +198 -0
- package/skills/evolve-evals/references/cli-reference/run.md +187 -0
- package/skills/evolve-evals/references/cli-reference/secrets.md +77 -0
- package/skills/evolve-evals/references/cli-reference/session.md +56 -0
- package/skills/evolve-evals/references/cli-reference/skill.md +52 -0
- package/skills/evolve-evals/references/cli-reference/skills.md +85 -0
- package/skills/evolve-evals/references/cli-reference/trial.md +115 -0
- package/skills/evolve-evals/references/cli-reference/upload.md +72 -0
- package/skills/evolve-evals/references/core-concepts/agents.md +96 -0
- package/skills/evolve-evals/references/core-concepts/analyze.md +143 -0
- package/skills/evolve-evals/references/core-concepts/check.md +116 -0
- package/skills/evolve-evals/references/core-concepts/compatibility.md +39 -0
- package/skills/evolve-evals/references/core-concepts/compose.md +103 -0
- package/skills/evolve-evals/references/core-concepts/datasets.md +234 -0
- package/skills/evolve-evals/references/core-concepts/index.md +52 -0
- package/skills/evolve-evals/references/core-concepts/jobs.md +223 -0
- package/skills/evolve-evals/references/core-concepts/models.md +73 -0
- package/skills/evolve-evals/references/core-concepts/multi-step.md +93 -0
- package/skills/evolve-evals/references/core-concepts/rewardkit.md +341 -0
- package/skills/evolve-evals/references/core-concepts/sandboxes.md +73 -0
- package/skills/evolve-evals/references/core-concepts/secrets.md +86 -0
- package/skills/evolve-evals/references/core-concepts/sharing.md +81 -0
- package/skills/evolve-evals/references/core-concepts/skills.md +100 -0
- package/skills/evolve-evals/references/core-concepts/task-config.md +169 -0
- package/skills/evolve-evals/references/core-concepts/task-environment.md +127 -0
- package/skills/evolve-evals/references/core-concepts/task-reference.md +191 -0
- package/skills/evolve-evals/references/core-concepts/task-verifiers.md +209 -0
- package/skills/evolve-evals/references/core-concepts/tasks.md +90 -0
- package/skills/evolve-evals/references/core-concepts/teams.md +128 -0
- package/skills/evolve-evals/references/core-concepts/trial-outputs.md +225 -0
- package/skills/evolve-evals/references/core-concepts/trials.md +129 -0
- package/skills/evolve-evals/references/core-concepts/upload-sdk-session.md +240 -0
- package/skills/evolve-evals/references/core-concepts/upload.md +166 -0
- package/skills/evolve-evals/references/dashboard/checks.md +54 -0
- package/skills/evolve-evals/references/dashboard/datasets.md +65 -0
- package/skills/evolve-evals/references/dashboard/jobs.md +106 -0
- package/skills/evolve-evals/references/dashboard/traces.md +54 -0
- package/skills/evolve-evals/references/dashboard/trial-viewer.md +77 -0
- package/skills/evolve-evals/references/getting-started/first-task.md +228 -0
- package/skills/evolve-evals/references/getting-started/installation.md +79 -0
- package/skills/evolve-evals/references/getting-started/quick-start.md +100 -0
- package/skills/evolve-evals/references/index.md +58 -0
- package/skills/evolve-evals/references/sdk/http.md +110 -0
- package/skills/evolve-evals/references/sdk/python.md +108 -0
- package/skills/evolve-evals/references/sdk/typescript.md +104 -0
- package/skills/evolve-evals/references/sdk-reference/agents.md +75 -0
- package/skills/evolve-evals/references/sdk-reference/analyses.md +124 -0
- package/skills/evolve-evals/references/sdk-reference/auth.md +171 -0
- package/skills/evolve-evals/references/sdk-reference/checks.md +145 -0
- package/skills/evolve-evals/references/sdk-reference/datasets.md +170 -0
- package/skills/evolve-evals/references/sdk-reference/error-codes.md +231 -0
- package/skills/evolve-evals/references/sdk-reference/errors.md +98 -0
- package/skills/evolve-evals/references/sdk-reference/filesystem.md +166 -0
- package/skills/evolve-evals/references/sdk-reference/index.md +161 -0
- package/skills/evolve-evals/references/sdk-reference/jobs.md +250 -0
- package/skills/evolve-evals/references/sdk-reference/meta.md +54 -0
- package/skills/evolve-evals/references/sdk-reference/methods/agents.md +154 -0
- package/skills/evolve-evals/references/sdk-reference/methods/analyses.md +211 -0
- package/skills/evolve-evals/references/sdk-reference/methods/auth.md +257 -0
- package/skills/evolve-evals/references/sdk-reference/methods/checks.md +460 -0
- package/skills/evolve-evals/references/sdk-reference/methods/datasets.md +687 -0
- package/skills/evolve-evals/references/sdk-reference/methods/filesystem.md +527 -0
- package/skills/evolve-evals/references/sdk-reference/methods/jobs.md +1021 -0
- package/skills/evolve-evals/references/sdk-reference/methods/meta.md +209 -0
- package/skills/evolve-evals/references/sdk-reference/methods/secrets.md +157 -0
- package/skills/evolve-evals/references/sdk-reference/methods/skills.md +125 -0
- package/skills/evolve-evals/references/sdk-reference/methods/trials.md +371 -0
- package/skills/evolve-evals/references/sdk-reference/secrets.md +104 -0
- package/skills/evolve-evals/references/sdk-reference/skills.md +66 -0
- package/skills/evolve-evals/references/sdk-reference/trials.md +164 -0
- package/skills/evolve-evals/references/sdk-reference/types.md +1249 -0
- package/skills/publish/SKILL.md +103 -79
- package/skills/rewardkit/SKILL.md +78 -23
- package/spec/openapi.yaml +19 -74
- package/skills/evolve-evals/references/cli-reference/agent.mdx +0 -79
- package/skills/evolve-evals/references/cli-reference/analysis.mdx +0 -160
- package/skills/evolve-evals/references/cli-reference/analyze.mdx +0 -84
- package/skills/evolve-evals/references/cli-reference/auth.mdx +0 -133
- package/skills/evolve-evals/references/cli-reference/check.mdx +0 -263
- package/skills/evolve-evals/references/cli-reference/dataset.mdx +0 -151
- package/skills/evolve-evals/references/cli-reference/index.mdx +0 -108
- package/skills/evolve-evals/references/cli-reference/job.mdx +0 -278
- package/skills/evolve-evals/references/cli-reference/run.mdx +0 -204
- package/skills/evolve-evals/references/cli-reference/secrets.mdx +0 -95
- package/skills/evolve-evals/references/cli-reference/skill.mdx +0 -61
- package/skills/evolve-evals/references/cli-reference/skills.mdx +0 -81
- package/skills/evolve-evals/references/cli-reference/trial.mdx +0 -181
- package/skills/evolve-evals/references/cli-reference/upload.mdx +0 -36
- package/skills/evolve-evals/references/core-concepts/agents.mdx +0 -106
- package/skills/evolve-evals/references/core-concepts/analyze.mdx +0 -86
- package/skills/evolve-evals/references/core-concepts/check.mdx +0 -64
- package/skills/evolve-evals/references/core-concepts/datasets.mdx +0 -138
- package/skills/evolve-evals/references/core-concepts/index.mdx +0 -42
- package/skills/evolve-evals/references/core-concepts/jobs.mdx +0 -151
- package/skills/evolve-evals/references/core-concepts/models.mdx +0 -68
- package/skills/evolve-evals/references/core-concepts/sandboxes.mdx +0 -52
- package/skills/evolve-evals/references/core-concepts/secrets.mdx +0 -41
- package/skills/evolve-evals/references/core-concepts/sharing.mdx +0 -35
- package/skills/evolve-evals/references/core-concepts/skills.mdx +0 -42
- package/skills/evolve-evals/references/core-concepts/tasks.mdx +0 -216
- package/skills/evolve-evals/references/core-concepts/teams.mdx +0 -36
- package/skills/evolve-evals/references/core-concepts/trial-outputs.mdx +0 -117
- package/skills/evolve-evals/references/core-concepts/trials.mdx +0 -103
- package/skills/evolve-evals/references/core-concepts/upload.mdx +0 -93
- package/skills/evolve-evals/references/dashboard/checks.mdx +0 -21
- package/skills/evolve-evals/references/dashboard/datasets.mdx +0 -24
- package/skills/evolve-evals/references/dashboard/jobs.mdx +0 -65
- package/skills/evolve-evals/references/dashboard/traces.mdx +0 -17
- package/skills/evolve-evals/references/dashboard/trial-viewer.mdx +0 -30
- package/skills/evolve-evals/references/getting-started/installation.mdx +0 -56
- package/skills/evolve-evals/references/getting-started/quick-start.mdx +0 -94
- package/skills/evolve-evals/references/index.mdx +0 -48
- package/skills/evolve-evals/references/sdk/python.mdx +0 -161
- package/skills/evolve-evals/references/sdk/typescript.mdx +0 -163
- package/skills/evolve-evals/references/sdk-reference/agents.mdx +0 -108
- package/skills/evolve-evals/references/sdk-reference/analyses.mdx +0 -222
- package/skills/evolve-evals/references/sdk-reference/auth.mdx +0 -116
- package/skills/evolve-evals/references/sdk-reference/checks.mdx +0 -300
- package/skills/evolve-evals/references/sdk-reference/datasets.mdx +0 -346
- package/skills/evolve-evals/references/sdk-reference/errors.mdx +0 -210
- package/skills/evolve-evals/references/sdk-reference/index.mdx +0 -60
- package/skills/evolve-evals/references/sdk-reference/jobs.mdx +0 -822
- package/skills/evolve-evals/references/sdk-reference/meta.mdx +0 -52
- package/skills/evolve-evals/references/sdk-reference/skills.mdx +0 -69
- package/skills/evolve-evals/references/sdk-reference/trials.mdx +0 -302
- package/skills/evolve-evals/references/sdk-reference/types.mdx +0 -274
- package/skills/evolve-evals/references/snippets/global-options.mdx +0 -13
- package/skills/evolve-evals/references/snippets/list-flags.mdx +0 -23
|
@@ -0,0 +1,1249 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Returned objects"
|
|
3
|
+
description: "Read jobs, trials, pages, costs, and results without guessing their shape."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
The SDK returns structured data. TypeScript uses objects. Python uses dataclasses for most entities and dictionaries for stats, analyses, checks, and rubric records.
|
|
7
|
+
|
|
8
|
+
## Field access by language
|
|
9
|
+
|
|
10
|
+
| Value | TypeScript | Python |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Job id | `job.id` | `job.id` |
|
|
13
|
+
| Trial reward | `trial.reward` | `trial.reward` |
|
|
14
|
+
| Job cost | `job.stats.cost_usd` | `job.stats.get("cost_usd")` |
|
|
15
|
+
| Analysis checks | `analysis.checks` | `analysis["checks"]` |
|
|
16
|
+
| Check results | `check.results` | `check["results"]` |
|
|
17
|
+
| Filesystem state | `status.state` | `status.state` |
|
|
18
|
+
| Page cursor | `page.nextCursor` | `page.next_cursor` |
|
|
19
|
+
| Trial tally | `job.trials.byStatus` | `job.trials.by_status` |
|
|
20
|
+
| Compare matrix | `comparison.taskMatrix` | `comparison.task_matrix` |
|
|
21
|
+
|
|
22
|
+
Most domain field names are snake_case in both languages. One deliberate Python exception is a check row's task tally: `row.tasks["byStatus"]`.
|
|
23
|
+
|
|
24
|
+
## Job or check row?
|
|
25
|
+
|
|
26
|
+
`jobs.list()` defaults to jobs. With `kind="all"`, discriminate before reading fields:
|
|
27
|
+
|
|
28
|
+
```ts TypeScript
|
|
29
|
+
import { jobs } from "@evolvingmachines/evolve";
|
|
30
|
+
for await (const row of jobs().list({
|
|
31
|
+
kind: "all"
|
|
32
|
+
})) {
|
|
33
|
+
if (row.kind === "job") {
|
|
34
|
+
console.log(row.job_name, row.trials.byStatus);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.log(row.name, row.tasks.byStatus);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```python Python
|
|
43
|
+
from evolve import jobs
|
|
44
|
+
|
|
45
|
+
async for row in jobs().list(kind="all"):
|
|
46
|
+
if row.kind == "job":
|
|
47
|
+
print(row.job_name, row.trials.by_status)
|
|
48
|
+
else:
|
|
49
|
+
print(row.name, row.tasks["byStatus"])
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
A check row has task-check counts. It does not have job arms, attempts, trial counts, or trial spend caps.
|
|
53
|
+
|
|
54
|
+
## Status vocabulary
|
|
55
|
+
|
|
56
|
+
| Entity | States | Terminal |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| Job | `QUEUED`, `RUNNING`, `CANCELLING`, `COMPLETED`, `CANCELLED`, `FAILED` | Last three |
|
|
59
|
+
| Trial | `QUEUED`, `RUNNING`, `SCORING`, `SCORED`, `SCORING_ERROR`, `INFRASTRUCTURE_ERROR`, `BUDGET`, `INDETERMINATE`, `CANCELLED` | All except first three |
|
|
60
|
+
| Analysis / task check | `queued`, `running`, `completed`, `failed` | Last two |
|
|
61
|
+
| Check group | `queued`, `running`, `completed` | `completed` |
|
|
62
|
+
| Import | `QUEUED`, `RUNNING`, `COMPLETED`, `FAILED` | Last two |
|
|
63
|
+
| Dataset version | `DRAFT`, `RECEIVING`, `IMPORTING`, `BUILDING`, `READY`, `FAILED`, `ARCHIVED` | Consult [meta](/sdk-reference/meta) for the published terminal set |
|
|
64
|
+
|
|
65
|
+
`FAILED` remains part of the job vocabulary. Do not infer all trial outcomes from the job's status: a completed job can contain scoring, infrastructure, or budget failures.
|
|
66
|
+
|
|
67
|
+
## Null is information
|
|
68
|
+
|
|
69
|
+
| Value | Meaning |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `reward: 0` | A real primary reward of zero |
|
|
72
|
+
| `reward: null` | No primary reward is available; inspect status and the full rewards map |
|
|
73
|
+
| `analysis: null` | No attached analysis result |
|
|
74
|
+
| `usage: null` | No usage reading is available |
|
|
75
|
+
| `finished_at: null` | Not finished, or no finish timestamp was recorded |
|
|
76
|
+
| `capture: null` | No settled capture summary is available |
|
|
77
|
+
|
|
78
|
+
Do not replace missing cost or reward with zero in a report.
|
|
79
|
+
|
|
80
|
+
## Cost and statistics
|
|
81
|
+
|
|
82
|
+
`usage` groups `spent_usd`, input/cached/cache-write/output token counts, `as_of`, and `provisional`. A provisional reading can increase.
|
|
83
|
+
|
|
84
|
+
| `spend_source` | Meaning |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `measured` | Final gateway reading |
|
|
87
|
+
| `measured_provisional` | Measured lower bound awaiting confirmation |
|
|
88
|
+
| `assumed_cap` | Spend was not measured; stored zero is a placeholder, not proof of no spend |
|
|
89
|
+
|
|
90
|
+
Job `stats.cost_usd` includes trial model spend and judge spend. `judge_cost_usd` identifies the judge share. Analysis cost is separate in `stats.analysis.cost_usd`; GPU compute estimates are separate too.
|
|
91
|
+
|
|
92
|
+
Job completion/error/cancellation counters overlap. Use the per-status trial tally when you need disjoint counts.
|
|
93
|
+
|
|
94
|
+
`passAtK(job)` / `pass_at_k(job)` reads sorted points from the server's `stats.evals` groups. It does not recompute them locally. A single-attempt job, incomplete group, or non-binary rewards may have no pass@k points.
|
|
95
|
+
|
|
96
|
+
## Name types safely
|
|
97
|
+
|
|
98
|
+
TypeScript exports useful types such as `JobCreate`, `Job`, `Trial`, and `HostedClientConfig`. Some nested input/result types are inferred through methods instead of exported by name:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { checks, type JobCreate } from "@evolvingmachines/evolve";
|
|
102
|
+
|
|
103
|
+
type CheckInput = Parameters<ReturnType<typeof checks>["create"]>[0];
|
|
104
|
+
type JobRetryPolicy = NonNullable<JobCreate["retry"]>;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The root-exported `RetryConfig` is for the separate Swarm API. Use the job's retry shape for managed evals.
|
|
108
|
+
|
|
109
|
+
Python exports hosted types such as `DatasetSelector`, `AgentArm`, and `JobRetryConfigInput`. Dataclass fields use attributes; TypedDict values use dictionary keys. The schemas below name each field. A `?` marks a field that may be absent; `null` means it may be present without a value. Python uses `None` for null and normal dictionaries for nested TypedDict records.
|
|
110
|
+
|
|
111
|
+
## Job fields
|
|
112
|
+
|
|
113
|
+
`Job` is returned by submission, detail reads, and job actions. A returned object describes the accepted state; use `watch` to wait for execution.
|
|
114
|
+
|
|
115
|
+
| Field | Read it for |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `trials.total`, `trials.byStatus` | Disjoint counts by trial status; Python uses `by_status` |
|
|
118
|
+
| `counts` | Selected agent and task counts |
|
|
119
|
+
| `stats` | Rewards, costs, errors, and analysis totals |
|
|
120
|
+
| `build_exclusions` | Tasks excluded because their build failed |
|
|
121
|
+
| `source_jobs` | Parent jobs and `resume`, `retry`, or `regrade` provenance |
|
|
122
|
+
| `upload` | Imported-result provenance; null for native execution |
|
|
123
|
+
| `viewer` | Caller’s access: `creator`, `member`, `shared`, `link`, or null |
|
|
124
|
+
|
|
125
|
+
The compact TypeScript schemas below describe data shapes. Some nested names are inferred types rather than root exports. Python fields keep the same spelling unless the language table above says otherwise.
|
|
126
|
+
|
|
127
|
+
### Job: every top-level field
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
interface Job {
|
|
131
|
+
kind: "job";
|
|
132
|
+
id: string;
|
|
133
|
+
job_name: string;
|
|
134
|
+
status: JobStatus;
|
|
135
|
+
datasets: DatasetRef[];
|
|
136
|
+
agents: AgentArm[];
|
|
137
|
+
n_attempts: number;
|
|
138
|
+
n_concurrent_trials: number;
|
|
139
|
+
max_trial_spend_usd: number;
|
|
140
|
+
worst_case_spend_usd: number;
|
|
141
|
+
retry: RetryConfig;
|
|
142
|
+
analyze: AnalyzeConfig | null;
|
|
143
|
+
timeout_multiplier: number;
|
|
144
|
+
agent_timeout_multiplier: number | null;
|
|
145
|
+
verifier_timeout_multiplier: number | null;
|
|
146
|
+
agent_setup_timeout_multiplier: number | null;
|
|
147
|
+
environment_build_timeout_multiplier: number | null;
|
|
148
|
+
sandbox_provider: EvalSandboxProvider | null;
|
|
149
|
+
org: string | null;
|
|
150
|
+
visibility: JobVisibility;
|
|
151
|
+
system_log: boolean;
|
|
152
|
+
counts: { agents: number; tasks: number };
|
|
153
|
+
build_exclusions: JobBuildExclusion[];
|
|
154
|
+
n_total_trials: number;
|
|
155
|
+
trials: TrialStatusTally;
|
|
156
|
+
stats: JobStats;
|
|
157
|
+
failure: JobFailure | null;
|
|
158
|
+
source_jobs: SourceJob[];
|
|
159
|
+
is_regrade: boolean;
|
|
160
|
+
viewer: JobViewer | null;
|
|
161
|
+
upload: UploadProvenance | null;
|
|
162
|
+
idempotent_replay: boolean;
|
|
163
|
+
started_at: string;
|
|
164
|
+
updated_at: string;
|
|
165
|
+
finished_at: string | null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
interface TrialStatusTally {
|
|
169
|
+
total: number;
|
|
170
|
+
byStatus: TrialCounts;
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Resolved datasets, agent arms, retry and analysis policy
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
interface DatasetRef {
|
|
178
|
+
name: string;
|
|
179
|
+
version: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface AgentArm {
|
|
183
|
+
name: string;
|
|
184
|
+
model_name: string;
|
|
185
|
+
version: string | null;
|
|
186
|
+
reasoning_effort: string | null;
|
|
187
|
+
kwargs: Record<string, unknown> | null;
|
|
188
|
+
preset: string | null;
|
|
189
|
+
skills: string[];
|
|
190
|
+
skill_locks: SkillLock[] | null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface SkillLock {
|
|
194
|
+
name: string;
|
|
195
|
+
source: string;
|
|
196
|
+
digest: string;
|
|
197
|
+
git_url: string | null;
|
|
198
|
+
git_commit_id: string | null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
interface RetryConfig {
|
|
202
|
+
max_retries: number;
|
|
203
|
+
include_exceptions: string[] | null;
|
|
204
|
+
exclude_exceptions: string[];
|
|
205
|
+
wait_multiplier: number;
|
|
206
|
+
min_wait_sec: number;
|
|
207
|
+
max_wait_sec: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface AnalyzeConfig {
|
|
211
|
+
model_name: string;
|
|
212
|
+
rubric: Rubric;
|
|
213
|
+
prompt: string | null;
|
|
214
|
+
reasoning_effort: string;
|
|
215
|
+
sandbox_provider: EvalSandboxProvider;
|
|
216
|
+
n_concurrent: number | null;
|
|
217
|
+
passing: boolean;
|
|
218
|
+
failing: boolean;
|
|
219
|
+
n_trials: number | null;
|
|
220
|
+
trial_ids: string[] | null;
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Statistics and reward groups
|
|
225
|
+
|
|
226
|
+
Python stats are dictionaries. `n_completed_trials`, `n_errored_trials`, and `n_cancelled_trials` can overlap; they are not a partition of trials. `evals` groups rewards by agent, model, and dataset. Its current mean metric counts unrewarded trials as zero. [Task rollups](#task-rollups) and [comparisons](#comparison-results) use scored trials, with different handling of null rewards explained below.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
interface JobStats {
|
|
230
|
+
n_completed_trials?: number;
|
|
231
|
+
n_errored_trials?: number;
|
|
232
|
+
n_running_trials?: number;
|
|
233
|
+
n_pending_trials?: number;
|
|
234
|
+
n_cancelled_trials?: number;
|
|
235
|
+
n_retries?: number;
|
|
236
|
+
evals?: Record<string, AgentDatasetStats>;
|
|
237
|
+
n_input_tokens?: number | null;
|
|
238
|
+
n_cache_tokens?: number | null;
|
|
239
|
+
n_output_tokens?: number | null;
|
|
240
|
+
cost_usd?: number | null;
|
|
241
|
+
gpu_cost_usd?: number | null;
|
|
242
|
+
judge_cost_usd?: number | null;
|
|
243
|
+
n_unmeasured_trials?: number;
|
|
244
|
+
n_unmeasured_judge_trials?: number;
|
|
245
|
+
analysis?: JobAnalysisStats | null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
interface AgentDatasetStats {
|
|
249
|
+
n_trials?: number;
|
|
250
|
+
n_errors?: number;
|
|
251
|
+
metrics?: Record<string, unknown>[];
|
|
252
|
+
pass_at_k?: Record<string, number>;
|
|
253
|
+
reward_stats?: Record<string, Record<string, string[]>>;
|
|
254
|
+
exception_stats?: Record<string, string[]>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface JobAnalysisStats {
|
|
258
|
+
n_completed: number;
|
|
259
|
+
n_failed: number;
|
|
260
|
+
n_pending: number;
|
|
261
|
+
cost_usd: number | null;
|
|
262
|
+
checks: Record<
|
|
263
|
+
string,
|
|
264
|
+
{ n_pass: number; n_fail: number; n_not_applicable: number; n_unknown: number }
|
|
265
|
+
>;
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Failure, build exclusions, and source jobs
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
interface JobFailure {
|
|
273
|
+
code: string;
|
|
274
|
+
message: string;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
interface JobBuildExclusion {
|
|
278
|
+
dataset: DatasetRef;
|
|
279
|
+
n_tasks_ran: number;
|
|
280
|
+
n_tasks_selected: number;
|
|
281
|
+
n_tasks_failed_to_build: number;
|
|
282
|
+
failed_task_names: string[];
|
|
283
|
+
note: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
interface SourceJob {
|
|
287
|
+
action: "regrade" | "resume" | "retry";
|
|
288
|
+
type: "hub";
|
|
289
|
+
job_id: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
interface UploadProvenance {
|
|
293
|
+
original_job_id: string | null;
|
|
294
|
+
original_job_name: string | null;
|
|
295
|
+
uploaded_at: string;
|
|
296
|
+
reported_totals: {
|
|
297
|
+
cost_usd: number | null;
|
|
298
|
+
n_input_tokens: number | null;
|
|
299
|
+
n_cache_tokens: number | null;
|
|
300
|
+
n_output_tokens: number | null;
|
|
301
|
+
n_trials_reporting: number;
|
|
302
|
+
} | null;
|
|
303
|
+
task_links: JobTaskLink[] | null;
|
|
304
|
+
datasets: UploadDataset[] | null;
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Check rows in a mixed jobs list
|
|
309
|
+
|
|
310
|
+
A check row is a summary, not a full `Check`. In Python, `row.tasks` is a dictionary and its key remains `byStatus`.
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
interface CheckRow {
|
|
314
|
+
kind: "check";
|
|
315
|
+
id: string;
|
|
316
|
+
name: string;
|
|
317
|
+
status: CheckStatus;
|
|
318
|
+
source: CheckSource;
|
|
319
|
+
model_name: string;
|
|
320
|
+
reasoning_effort: string;
|
|
321
|
+
sandbox_provider: EvalSandboxProvider;
|
|
322
|
+
org: string;
|
|
323
|
+
visibility: JobVisibility;
|
|
324
|
+
tasks: CheckTaskTally;
|
|
325
|
+
cost_usd: number | null;
|
|
326
|
+
created_at: string;
|
|
327
|
+
finished_at: string | null;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
interface CheckTaskTally {
|
|
331
|
+
total: number;
|
|
332
|
+
byStatus: Record<AnalysisStatus | "stopped", number>;
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Imported dataset provenance
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
interface UploadDataset {
|
|
340
|
+
name: string;
|
|
341
|
+
version: string | null;
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Trial fields
|
|
346
|
+
|
|
347
|
+
A `Trial` holds one attempt’s outcome and evidence. `reward` is the primary scalar; `verifier_result.rewards` preserves the complete reward map.
|
|
348
|
+
|
|
349
|
+
### Trial: every top-level field
|
|
350
|
+
|
|
351
|
+
```ts
|
|
352
|
+
interface Trial {
|
|
353
|
+
id: string;
|
|
354
|
+
job_id: string;
|
|
355
|
+
task_name: string;
|
|
356
|
+
source: string;
|
|
357
|
+
agent_info: AgentInfo;
|
|
358
|
+
attempt: number;
|
|
359
|
+
status: TrialStatus;
|
|
360
|
+
reward: number | null;
|
|
361
|
+
verifier_result: VerifierResult | null;
|
|
362
|
+
exception_info: ExceptionInfo | null;
|
|
363
|
+
agent_result: AgentResult | null;
|
|
364
|
+
judge_result?: JudgeResult | null;
|
|
365
|
+
analysis?: TrialAnalysis | null;
|
|
366
|
+
environment_setup: TimingInfo | null;
|
|
367
|
+
agent_setup: TimingInfo | null;
|
|
368
|
+
agent_execution: TimingInfo | null;
|
|
369
|
+
verifier: TimingInfo | null;
|
|
370
|
+
queue_wait: TimingInfo | null;
|
|
371
|
+
harness_bundle: TimingInfo | null;
|
|
372
|
+
image_prepare: TimingInfo | null;
|
|
373
|
+
shared_verify_setup: TimingInfo | null;
|
|
374
|
+
harness_bundle_cache_hit: boolean | null;
|
|
375
|
+
step_results: StepResult[] | null;
|
|
376
|
+
spend_source: SpendSource | null;
|
|
377
|
+
judge_spend_source?: SpendSource | null;
|
|
378
|
+
live_spent_usd: number | null;
|
|
379
|
+
live_spend_at: string | null;
|
|
380
|
+
usage?: UsageReading | null;
|
|
381
|
+
max_trial_spend_usd: number | null;
|
|
382
|
+
sandbox_provider: EvalSandboxProvider | null;
|
|
383
|
+
sandbox_provider_degrade?: {
|
|
384
|
+
from: EvalSandboxProvider;
|
|
385
|
+
to: EvalSandboxProvider;
|
|
386
|
+
reason: string;
|
|
387
|
+
} | null;
|
|
388
|
+
gpu_cost?: TrialGpuCost | null;
|
|
389
|
+
sandbox_id: string | null;
|
|
390
|
+
verifier_sandbox_id: string | null;
|
|
391
|
+
verifier_environment_mode: VerifierEnvironmentMode | null;
|
|
392
|
+
attempt_phase: AttemptPhase | null;
|
|
393
|
+
n_retries: number;
|
|
394
|
+
retries: TrialRetry[];
|
|
395
|
+
session_ref: string | null;
|
|
396
|
+
upload: TrialUploadProvenance | null;
|
|
397
|
+
started_at: string | null;
|
|
398
|
+
finished_at: string | null;
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Agent, scores, usage, and timing
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
interface AgentInfo {
|
|
406
|
+
name: string;
|
|
407
|
+
version: string | null;
|
|
408
|
+
model_info: ModelInfo;
|
|
409
|
+
reasoning_effort?: string | null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
interface ModelInfo {
|
|
413
|
+
name: string;
|
|
414
|
+
provider?: string | null;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
interface VerifierResult {
|
|
418
|
+
rewards?: Record<string, number> | null;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
interface ExceptionInfo {
|
|
422
|
+
exception_type: string;
|
|
423
|
+
exception_message: string;
|
|
424
|
+
exception_traceback?: string;
|
|
425
|
+
occurred_at: string;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
interface AgentResult {
|
|
429
|
+
n_input_tokens?: number | null;
|
|
430
|
+
n_cache_tokens?: number | null;
|
|
431
|
+
n_output_tokens?: number | null;
|
|
432
|
+
cost_usd?: number | null;
|
|
433
|
+
rollout_details?: Record<string, unknown>[] | null;
|
|
434
|
+
metadata?: Record<string, unknown> | null;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface JudgeResult {
|
|
438
|
+
n_input_tokens?: number | null;
|
|
439
|
+
n_cache_tokens?: number | null;
|
|
440
|
+
n_output_tokens?: number | null;
|
|
441
|
+
cost_usd?: number | null;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface UsageReading {
|
|
445
|
+
provisional: boolean;
|
|
446
|
+
spent_usd: number | null;
|
|
447
|
+
input_tokens: number | null;
|
|
448
|
+
cached_input_tokens: number | null;
|
|
449
|
+
cache_write_tokens: number | null;
|
|
450
|
+
output_tokens: number | null;
|
|
451
|
+
as_of: string | null;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
interface TimingInfo {
|
|
455
|
+
started_at: string | null;
|
|
456
|
+
finished_at: string | null;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
interface TrialGpuCost {
|
|
460
|
+
estimate_usd: number | null;
|
|
461
|
+
unpriced_reason: string | null;
|
|
462
|
+
provider: EvalSandboxProvider;
|
|
463
|
+
gpu_type: string | null;
|
|
464
|
+
declared_gpu_types: string[] | null;
|
|
465
|
+
resolved_gpu_types: string[] | null;
|
|
466
|
+
attached_gpu_type: string | null;
|
|
467
|
+
gpu_count: number;
|
|
468
|
+
duration_sec: number | null;
|
|
469
|
+
rate_usd_per_gpu_sec: number | null;
|
|
470
|
+
rate_card: { version: number; source: string | null; source_date: string | null };
|
|
471
|
+
measured_from: string | null;
|
|
472
|
+
measured_to: string | null;
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Steps, retries, and imported provenance
|
|
477
|
+
|
|
478
|
+
Each timing record has `started_at` and `finished_at`; overlapping phases must not be added as independent durations. Python `step_results`, `sandbox_provider_degrade`, and `gpu_cost` hold dictionaries.
|
|
479
|
+
|
|
480
|
+
```ts
|
|
481
|
+
interface StepResult {
|
|
482
|
+
step_name?: string;
|
|
483
|
+
agent_result?: AgentResult | null;
|
|
484
|
+
verifier_result?: VerifierResult | null;
|
|
485
|
+
exception_info?: ExceptionInfo | null;
|
|
486
|
+
agent_execution?: TimingInfo | null;
|
|
487
|
+
verifier?: TimingInfo | null;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
interface TrialRetry {
|
|
491
|
+
attempt_number: number;
|
|
492
|
+
exception_info: ExceptionInfo;
|
|
493
|
+
cost_usd: number | null;
|
|
494
|
+
started_at: string | null;
|
|
495
|
+
settled_at: string | null;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
interface TrialUploadProvenance {
|
|
499
|
+
original_trial_id: string | null;
|
|
500
|
+
original_trial_name: string;
|
|
501
|
+
original_task_name: string;
|
|
502
|
+
reported_agent_result: {
|
|
503
|
+
n_input_tokens: number | null;
|
|
504
|
+
n_cache_tokens: number | null;
|
|
505
|
+
n_output_tokens: number | null;
|
|
506
|
+
cost_usd: number | null;
|
|
507
|
+
} | null;
|
|
508
|
+
link: TrialTaskLink | null;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
interface TrialTaskLink {
|
|
512
|
+
linked_by: TaskLinkedBy;
|
|
513
|
+
link_reason: TaskLinkReason | null;
|
|
514
|
+
dataset: string | null;
|
|
515
|
+
version: string | null;
|
|
516
|
+
task_digest: string | null;
|
|
517
|
+
candidates: string[];
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Stop result
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
interface StopResponse {
|
|
525
|
+
stopped: Trial[];
|
|
526
|
+
stopped_analyses: TrialAnalysis[];
|
|
527
|
+
already_terminal: string[];
|
|
528
|
+
not_found: string[];
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
Attempt phases are `prepare`, `build`, `boot`, `install`, `agent`, `verify`, and `persist`. Verifier mode is `shared` or `separate`. Sandbox provider is `e2b`, `daytona`, or `modal`.
|
|
533
|
+
|
|
534
|
+
## Task rollups
|
|
535
|
+
|
|
536
|
+
`jobs().tasks(id)` gives one `JobTaskRollup` per distinct `(task_name, source)` pair. It is the short route from a job summary to the tasks needing inspection.
|
|
537
|
+
|
|
538
|
+
| Field | Type | Meaning |
|
|
539
|
+
| --- | --- | --- |
|
|
540
|
+
| `task_name` | `string` | Task name |
|
|
541
|
+
| `source` | `string` | Dataset source |
|
|
542
|
+
| `trials` | `TrialStatusTally` | `total` plus per-status counts |
|
|
543
|
+
| `mean_reward` | `number \| null` | Reward sum divided by all scored trials; null if none |
|
|
544
|
+
| `cost_usd` | `number \| null` | Measured spend across settled trials |
|
|
545
|
+
| `check` | `TaskCheck \| null` | Latest readable quality check from a dataset version this job uses |
|
|
546
|
+
|
|
547
|
+
Python returns a `JobTaskRollup` dataclass; `check` is a dictionary or `None`. A scored trial with a null reward contributes zero to this rollup’s mean.
|
|
548
|
+
|
|
549
|
+
### Task rollup schema
|
|
550
|
+
|
|
551
|
+
```ts
|
|
552
|
+
interface JobTaskRollup {
|
|
553
|
+
task_name: string;
|
|
554
|
+
source: string;
|
|
555
|
+
trials: TrialStatusTally;
|
|
556
|
+
mean_reward: number | null;
|
|
557
|
+
cost_usd: number | null;
|
|
558
|
+
check: TaskCheck | null;
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
## Comparison results
|
|
563
|
+
|
|
564
|
+
`jobs().compare(ids)` returns aggregates in your id order. Each task row has one cell per requested job; disagreement rows come first.
|
|
565
|
+
|
|
566
|
+
```text
|
|
567
|
+
CompareResponse
|
|
568
|
+
├── jobs[] Per-job aggregates
|
|
569
|
+
└── taskMatrix[] Python: task_matrix
|
|
570
|
+
├── task_name
|
|
571
|
+
├── disagreement
|
|
572
|
+
└── cells[] Same order as requested job ids
|
|
573
|
+
├── status Trial status, MIXED, or MISSING
|
|
574
|
+
├── mean_reward Scored trials only; null if none
|
|
575
|
+
└── coverage scored / total
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
`MIXED` means attempts have different statuses. `MISSING` means the job has no attempts for that task. Comparison means use non-null rewards on scored trials. `coverage.scored` counts every scored trial, including ones with a null reward; those trials are excluded from the comparison mean.
|
|
579
|
+
|
|
580
|
+
The comparison matrix groups by task name alone, including matching names from different datasets or versions. The per-job task summary groups by both task name and source.
|
|
581
|
+
|
|
582
|
+
### All comparison fields
|
|
583
|
+
|
|
584
|
+
```ts
|
|
585
|
+
interface CompareResponse {
|
|
586
|
+
jobs: CompareJobAggregate[];
|
|
587
|
+
taskMatrix: CompareTaskRow[];
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
interface CompareJobAggregate {
|
|
591
|
+
id: string;
|
|
592
|
+
datasets: DatasetRef[];
|
|
593
|
+
status: JobStatus;
|
|
594
|
+
mean_reward: number | null;
|
|
595
|
+
coverage: CompareCoverage;
|
|
596
|
+
cost_usd: number;
|
|
597
|
+
agents: AgentArm[];
|
|
598
|
+
started_at: string;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
interface CompareTaskRow {
|
|
602
|
+
task_name: string;
|
|
603
|
+
disagreement: boolean;
|
|
604
|
+
cells: CompareCell[];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
interface CompareCell {
|
|
608
|
+
job_id: string;
|
|
609
|
+
status: TrialStatus | "MIXED" | "MISSING";
|
|
610
|
+
mean_reward: number | null;
|
|
611
|
+
coverage: CompareCoverage;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
interface CompareCoverage {
|
|
615
|
+
scored: number;
|
|
616
|
+
total: number;
|
|
617
|
+
}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
## Job events
|
|
621
|
+
|
|
622
|
+
Every event has `seq: number`, `type`, and `data`. Switch on `type`: different event types can have the same payload. Python’s `JobEvent.data` is a dictionary.
|
|
623
|
+
|
|
624
|
+
| Event type | Payload | When it matters |
|
|
625
|
+
| --- | --- | --- |
|
|
626
|
+
| `job.created` | `JobCreatedData` | Resolved creation inputs |
|
|
627
|
+
| `job.running` | `{ job_id: string }` | Execution began |
|
|
628
|
+
| `job.cancelling` | `JobCancellingData` | Cancellation accepted; work may still be active |
|
|
629
|
+
| `job.cancelled` | `JobCancelledData` | Cancellation settled |
|
|
630
|
+
| `job.completed` | `{ job_id: string }` | Job settled; inspect trial outcomes |
|
|
631
|
+
| `job.failed` | `{ job_id: string }` | Reserved terminal event; no current server path emits it |
|
|
632
|
+
| `trial.running` | `TrialRunningData` | Attempt began |
|
|
633
|
+
| `trial.scoring` | `TrialScoringData` | Verification began |
|
|
634
|
+
| `trial.spend` | `TrialSpendData` | Provisional spend sample |
|
|
635
|
+
| `trial.settled` | `TrialSettledData` | Attempt settled; an automatic retry can follow |
|
|
636
|
+
| `trial.retrying` | `TrialRetryingData` | Attempt requeued with delay and retry count |
|
|
637
|
+
| `trial.retry_circuit_broken` | `TrialRetryCircuitBrokenData` | Repeated infrastructure failure stopped further retry |
|
|
638
|
+
|
|
639
|
+
### Job lifecycle payloads
|
|
640
|
+
|
|
641
|
+
A `job.created` event includes only the four agent fields shown below. Imported or older jobs can have null spend or provider metadata. These are the received fields; the current SDK declaration instead uses the full `AgentArm` type and non-null spend and provider types.
|
|
642
|
+
|
|
643
|
+
```ts
|
|
644
|
+
interface JobCreatedData {
|
|
645
|
+
datasets: DatasetRef[];
|
|
646
|
+
task_count: number;
|
|
647
|
+
agents: {
|
|
648
|
+
name: string | null;
|
|
649
|
+
model_name: string | null;
|
|
650
|
+
version: string | null;
|
|
651
|
+
reasoning_effort: string | null;
|
|
652
|
+
}[];
|
|
653
|
+
n_attempts: number;
|
|
654
|
+
n_concurrent_trials: number;
|
|
655
|
+
max_trial_spend_usd: number | null;
|
|
656
|
+
sandbox_provider: EvalSandboxProvider | null;
|
|
657
|
+
trial_count: number;
|
|
658
|
+
retry: RetryConfig;
|
|
659
|
+
timeout_multiplier: number;
|
|
660
|
+
agent_timeout_multiplier: number | null;
|
|
661
|
+
verifier_timeout_multiplier: number | null;
|
|
662
|
+
agent_setup_timeout_multiplier: number | null;
|
|
663
|
+
environment_build_timeout_multiplier: number | null;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
interface JobCancellingData {
|
|
667
|
+
job_id: string;
|
|
668
|
+
cancelled_trials: number;
|
|
669
|
+
active_trials: number;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
interface JobCancelledData {
|
|
673
|
+
job_id: string;
|
|
674
|
+
cancelled_trials: number;
|
|
675
|
+
}
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### Trial progress and outcome payloads
|
|
679
|
+
|
|
680
|
+
`live_spent_usd` is a lagging lower bound. On settled events, missing `reward` means no score; zero is a score. An exception message can be absent on cancellation or older recorded events.
|
|
681
|
+
|
|
682
|
+
```ts
|
|
683
|
+
interface TrialRunningData {
|
|
684
|
+
trial_id: string;
|
|
685
|
+
task_name: string;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
interface TrialScoringData {
|
|
689
|
+
trial_id: string;
|
|
690
|
+
captured_bytes?: number;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
interface TrialSpendData {
|
|
694
|
+
trial_id: string;
|
|
695
|
+
task_name: string;
|
|
696
|
+
live_spent_usd: number;
|
|
697
|
+
n_input_tokens?: number;
|
|
698
|
+
n_cache_tokens?: number;
|
|
699
|
+
n_output_tokens?: number;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
interface TrialSettledData {
|
|
703
|
+
trial_id: string;
|
|
704
|
+
task_name: string;
|
|
705
|
+
status: TrialStatus;
|
|
706
|
+
reward?: number | null;
|
|
707
|
+
exception_type?: string;
|
|
708
|
+
exception_message?: string;
|
|
709
|
+
attempt_phase?: AttemptPhase | null;
|
|
710
|
+
}
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
### Automatic retry payloads
|
|
714
|
+
|
|
715
|
+
The circuit breaker compares typed failure classes. Its event follows `trial.settled` instead of `trial.retrying`; the attempt stays terminal.
|
|
716
|
+
|
|
717
|
+
```ts
|
|
718
|
+
interface TrialRetryingData {
|
|
719
|
+
trial_id: string;
|
|
720
|
+
task_name: string;
|
|
721
|
+
retry: number;
|
|
722
|
+
max_retries: number;
|
|
723
|
+
delay_sec: number;
|
|
724
|
+
exception_type: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
type InfraFailureSignature =
|
|
728
|
+
| "sandbox_death"
|
|
729
|
+
| "provider_create_failure"
|
|
730
|
+
| "stream_disconnect"
|
|
731
|
+
| "exec_chdir_failure";
|
|
732
|
+
|
|
733
|
+
interface TrialRetryCircuitBrokenData {
|
|
734
|
+
trial_id: string;
|
|
735
|
+
task_name: string;
|
|
736
|
+
signature: InfraFailureSignature;
|
|
737
|
+
consecutive: number;
|
|
738
|
+
failure_phase: string;
|
|
739
|
+
max_retries: number;
|
|
740
|
+
retries_unused: number;
|
|
741
|
+
exception_message: string | null;
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
## Analysis and check results
|
|
746
|
+
|
|
747
|
+
Analysis reads a trial’s trajectory. A task check reviews the task itself. Their criterion results share the same four outcomes: `pass`, `fail`, `not_applicable`, and `unknown`.
|
|
748
|
+
|
|
749
|
+
Python returns results and defaults as dictionaries. `checks` maps criterion names to `{ outcome, explanation, evidence }`; evidence is a list of `{ where, quote }` records. Evolve derives no verdict from a result; compute what you need from the criteria.
|
|
750
|
+
|
|
751
|
+
### Analysis result and criterion evidence
|
|
752
|
+
|
|
753
|
+
```ts
|
|
754
|
+
interface TrialAnalysis {
|
|
755
|
+
id: string;
|
|
756
|
+
trial_id: string;
|
|
757
|
+
job_id: string;
|
|
758
|
+
task_name: string;
|
|
759
|
+
status: AnalysisStatus;
|
|
760
|
+
model_name: string;
|
|
761
|
+
reasoning_effort: string | null;
|
|
762
|
+
rubric: Rubric;
|
|
763
|
+
prompt: string | null;
|
|
764
|
+
summary: string | null;
|
|
765
|
+
checks: Record<string, AnalysisCheck> | null;
|
|
766
|
+
estimated_cost_usd: number | null;
|
|
767
|
+
usage?: UsageReading | null;
|
|
768
|
+
attempts?: number;
|
|
769
|
+
failure: AnalysisFailure | null;
|
|
770
|
+
created_at: string;
|
|
771
|
+
finished_at: string | null;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
interface AnalysisCheck {
|
|
775
|
+
outcome: "pass" | "fail" | "not_applicable" | "unknown";
|
|
776
|
+
explanation: string;
|
|
777
|
+
evidence: AnalysisEvidence[];
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
interface AnalysisEvidence {
|
|
781
|
+
where: string;
|
|
782
|
+
quote: string;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
interface AnalysisFailure {
|
|
786
|
+
phase: string;
|
|
787
|
+
message: string;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
interface AnalyzeDefaults {
|
|
791
|
+
model_name: string;
|
|
792
|
+
rubric: Rubric;
|
|
793
|
+
prompt: string;
|
|
794
|
+
reasoning_effort: string;
|
|
795
|
+
sandbox_provider: EvalSandboxProvider;
|
|
796
|
+
}
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
### Check group and each task result
|
|
800
|
+
|
|
801
|
+
A completed group may contain failed task checks; inspect every result.
|
|
802
|
+
|
|
803
|
+
```ts
|
|
804
|
+
interface Check {
|
|
805
|
+
id: string;
|
|
806
|
+
name: string;
|
|
807
|
+
status: CheckStatus;
|
|
808
|
+
source: CheckSource;
|
|
809
|
+
model_name: string;
|
|
810
|
+
reasoning_effort: string;
|
|
811
|
+
rubric: Rubric;
|
|
812
|
+
prompt: string | null;
|
|
813
|
+
sandbox_provider: EvalSandboxProvider;
|
|
814
|
+
n_concurrent: number | null;
|
|
815
|
+
include_task_names: string[];
|
|
816
|
+
exclude_task_names: string[];
|
|
817
|
+
n_tasks: number | null;
|
|
818
|
+
visibility: JobVisibility;
|
|
819
|
+
results: TaskCheck[];
|
|
820
|
+
cost_usd: number | null;
|
|
821
|
+
created_at: string;
|
|
822
|
+
finished_at: string | null;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
interface CheckSource {
|
|
826
|
+
type: "archive" | "dataset";
|
|
827
|
+
sha256: string;
|
|
828
|
+
bytes: number | null;
|
|
829
|
+
dataset: string | null;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
interface TaskCheck {
|
|
833
|
+
id: string;
|
|
834
|
+
check_id: string;
|
|
835
|
+
task_name: string;
|
|
836
|
+
status: AnalysisStatus;
|
|
837
|
+
checks: Record<string, AnalysisCheck> | null;
|
|
838
|
+
cost_usd: number | null;
|
|
839
|
+
attempts: number;
|
|
840
|
+
failure: AnalysisFailure | null;
|
|
841
|
+
created_at: string;
|
|
842
|
+
finished_at: string | null;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
interface CheckDefaults {
|
|
846
|
+
model_name: string;
|
|
847
|
+
rubric: Rubric;
|
|
848
|
+
prompt: string;
|
|
849
|
+
reasoning_effort: string;
|
|
850
|
+
sandbox_provider: EvalSandboxProvider;
|
|
851
|
+
}
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
### Analyzer and checker transcripts
|
|
855
|
+
|
|
856
|
+
`events` contains parsed activity after `since`; `total` counts every stored activity row. `gateway_calls` is separate and returned in full. Optional `stored_at` aligns one server timestamp per returned event; it is absent when events came from the stored transcript file. Python does not expose these transcript methods.
|
|
857
|
+
|
|
858
|
+
```ts
|
|
859
|
+
interface AnalysisTranscript {
|
|
860
|
+
id: string;
|
|
861
|
+
analyzed_trial_id: string | null;
|
|
862
|
+
job_id: string | null;
|
|
863
|
+
task_name: string | null;
|
|
864
|
+
model_name: string | null;
|
|
865
|
+
sandbox_provider: string | null;
|
|
866
|
+
sandbox_id: string | null;
|
|
867
|
+
is_ended: boolean;
|
|
868
|
+
total: number;
|
|
869
|
+
events: TraceEvent[];
|
|
870
|
+
gateway_calls: TraceEvent[];
|
|
871
|
+
stored_at?: string[];
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
interface TaskCheckTranscript {
|
|
875
|
+
id: string;
|
|
876
|
+
check_id: string | null;
|
|
877
|
+
dataset: string | null;
|
|
878
|
+
task_name: string | null;
|
|
879
|
+
model_name: string | null;
|
|
880
|
+
sandbox_provider: string | null;
|
|
881
|
+
sandbox_id: string | null;
|
|
882
|
+
is_ended: boolean;
|
|
883
|
+
total: number;
|
|
884
|
+
events: TraceEvent[];
|
|
885
|
+
gateway_calls: TraceEvent[];
|
|
886
|
+
stored_at?: string[];
|
|
887
|
+
}
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
### Rubric
|
|
891
|
+
|
|
892
|
+
```ts
|
|
893
|
+
interface Rubric {
|
|
894
|
+
criteria: RubricCriterion[];
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
interface RubricCriterion {
|
|
898
|
+
name: string;
|
|
899
|
+
description: string;
|
|
900
|
+
guidance: string;
|
|
901
|
+
}
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
## Filesystem results
|
|
905
|
+
|
|
906
|
+
Filesystem pages keep `next_cursor` in both SDKs. Python uses dataclasses for their records, and dictionaries for event `data`.
|
|
907
|
+
|
|
908
|
+
### State, live box, and retained capture
|
|
909
|
+
|
|
910
|
+
`captured` state does not guarantee every file’s bytes were retained. Inspect capture `status`, `left_out`, and each entry’s `captured` field.
|
|
911
|
+
|
|
912
|
+
```ts
|
|
913
|
+
interface FilesystemStatus {
|
|
914
|
+
state: FilesystemState;
|
|
915
|
+
box: FilesystemBox | null;
|
|
916
|
+
watcher: "native" | "poll" | null;
|
|
917
|
+
root: string;
|
|
918
|
+
work_dir: string;
|
|
919
|
+
capture: FilesystemCapture | null;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
interface FilesystemBox {
|
|
923
|
+
provider: EvalSandboxProvider;
|
|
924
|
+
id: string;
|
|
925
|
+
role: "agent" | "verifier" | "analyzer" | "checker";
|
|
926
|
+
since: string;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
interface FilesystemCapture {
|
|
930
|
+
id: string;
|
|
931
|
+
at: string | null;
|
|
932
|
+
phase: "after_verifier" | "after_seal" | "after_run";
|
|
933
|
+
entries: number;
|
|
934
|
+
changed_files: number;
|
|
935
|
+
changed_bytes: number;
|
|
936
|
+
status: "ready" | "incomplete" | "failed";
|
|
937
|
+
left_out: string[];
|
|
938
|
+
failure_reason: string | null;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
interface TaskPackageFilesystemStatus extends FilesystemStatus {
|
|
942
|
+
state: "none";
|
|
943
|
+
source: "package";
|
|
944
|
+
package_retained: boolean;
|
|
945
|
+
}
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
### Directory, search, and changed-file pages
|
|
949
|
+
|
|
950
|
+
On a captured entry, `captured: false` means no bytes were retained. `left_out` describes an omitted or failed capture; otherwise it may be an untouched image file. On a live entry, `captured` is null. Package entries have retained bytes.
|
|
951
|
+
|
|
952
|
+
```ts
|
|
953
|
+
interface FilesystemEntry {
|
|
954
|
+
name: string;
|
|
955
|
+
type: "dir" | "file" | "symlink" | "other";
|
|
956
|
+
size: number;
|
|
957
|
+
mtime: string;
|
|
958
|
+
mode: string;
|
|
959
|
+
owner: string;
|
|
960
|
+
changed: "created" | "modified" | null;
|
|
961
|
+
phase: "setup" | "agent" | "verifier" | null;
|
|
962
|
+
captured: boolean | null;
|
|
963
|
+
left_out?: string;
|
|
964
|
+
target?: string;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
interface FilesystemListing {
|
|
968
|
+
path: string;
|
|
969
|
+
source: "live" | "capture" | "package";
|
|
970
|
+
entries: FilesystemEntry[];
|
|
971
|
+
next_cursor: string | null;
|
|
972
|
+
ms: number;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
interface FilesystemSearchHit {
|
|
976
|
+
path: string;
|
|
977
|
+
line: number;
|
|
978
|
+
snippet: string;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
interface FilesystemSearchResult {
|
|
982
|
+
hits: FilesystemSearchHit[];
|
|
983
|
+
truncated: boolean;
|
|
984
|
+
scope: "path" | "box";
|
|
985
|
+
source: "live" | "capture";
|
|
986
|
+
image_files_excluded?: boolean;
|
|
987
|
+
ms: number;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
interface FilesystemChange {
|
|
991
|
+
path: string;
|
|
992
|
+
type: "dir" | "file" | "symlink" | "other";
|
|
993
|
+
changed: "created" | "modified" | "removed";
|
|
994
|
+
phase: "setup" | "agent" | "verifier";
|
|
995
|
+
size: number;
|
|
996
|
+
mtime: string;
|
|
997
|
+
left_out?: string;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
interface FilesystemChanges {
|
|
1001
|
+
source: "live" | "capture";
|
|
1002
|
+
total: number;
|
|
1003
|
+
changed_bytes: number;
|
|
1004
|
+
items: FilesystemChange[];
|
|
1005
|
+
next_cursor: string | null;
|
|
1006
|
+
}
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
### Watch registration and filesystem events
|
|
1010
|
+
|
|
1011
|
+
```ts
|
|
1012
|
+
interface FilesystemWatchResult {
|
|
1013
|
+
watcher: "native" | "poll";
|
|
1014
|
+
paths: string[];
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
type FilesystemStreamEvent =
|
|
1018
|
+
| { event: "state"; id?: string; data: { state: FilesystemState; box: FilesystemBox | null } }
|
|
1019
|
+
| {
|
|
1020
|
+
event: "fs";
|
|
1021
|
+
id: string;
|
|
1022
|
+
data: { seq: number; t: string; path: string; type: "create" | "write" | "remove" | "rename"; source: "watch" | "poll" };
|
|
1023
|
+
}
|
|
1024
|
+
| { event: "ping"; id?: string; data: Record<string, never> };
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
### Sandbox log pages, log events, and processes
|
|
1028
|
+
|
|
1029
|
+
```ts
|
|
1030
|
+
interface SandboxLogLine {
|
|
1031
|
+
seq: number;
|
|
1032
|
+
t: string | null;
|
|
1033
|
+
fd: "out" | "err";
|
|
1034
|
+
line: string;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
interface SandboxLogLines {
|
|
1038
|
+
stream: SandboxLogStream;
|
|
1039
|
+
lines: SandboxLogLine[];
|
|
1040
|
+
next_cursor: string | null;
|
|
1041
|
+
reason?: string;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
type SandboxLogEvent =
|
|
1045
|
+
| { event: "line"; id: string; data: SandboxLogLine & { stream: SandboxLogStream } }
|
|
1046
|
+
| { event: "state"; id?: string; data: { state: FilesystemState; box: FilesystemBox | null } }
|
|
1047
|
+
| { event: "ping"; id?: string; data: Record<string, never> };
|
|
1048
|
+
|
|
1049
|
+
interface SandboxProcs {
|
|
1050
|
+
text: string;
|
|
1051
|
+
ms: number;
|
|
1052
|
+
}
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
## Sharing and deletion
|
|
1056
|
+
|
|
1057
|
+
Jobs and checks use the same `JobShares` result. A link is unlisted; `PRIVATE` does not mean that email grants are absent. Read `emails` to inspect them.
|
|
1058
|
+
|
|
1059
|
+
### Share state and deletion receipt
|
|
1060
|
+
|
|
1061
|
+
```ts
|
|
1062
|
+
type JobVisibility = "PRIVATE" | "LINK";
|
|
1063
|
+
|
|
1064
|
+
interface JobShares {
|
|
1065
|
+
visibility: JobVisibility;
|
|
1066
|
+
link: JobShareLink;
|
|
1067
|
+
emails: JobShareEmail[];
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
interface JobShareLink {
|
|
1071
|
+
enabled: boolean;
|
|
1072
|
+
url?: string;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
interface JobShareEmail {
|
|
1076
|
+
email: string;
|
|
1077
|
+
shared_by: string;
|
|
1078
|
+
created_at: string;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
interface JobDeleteResult {
|
|
1082
|
+
job_id: string;
|
|
1083
|
+
trials_deleted: number;
|
|
1084
|
+
analyses_deleted: number;
|
|
1085
|
+
}
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
## Job imports
|
|
1089
|
+
|
|
1090
|
+
`jobs().upload()` returns an import record. `COMPLETED` supplies `job_id` while the imported job exists; `FAILED` supplies a typed `failure`. The imported job records earlier work and does not start an agent.
|
|
1091
|
+
|
|
1092
|
+
`receiving` reports an upload still in transit. Worker `progress` is separate: fetching, extracting, validating, or ingesting. Inspect skipped trials and task links before treating an upload as a complete benchmark.
|
|
1093
|
+
|
|
1094
|
+
### Import record and progress
|
|
1095
|
+
|
|
1096
|
+
The `hub` source variant is reserved in the type; current upload methods accept a local directory/archive or a public HTTPS archive URL.
|
|
1097
|
+
|
|
1098
|
+
```ts
|
|
1099
|
+
interface JobImport {
|
|
1100
|
+
id: string;
|
|
1101
|
+
status: DatasetImportStatus;
|
|
1102
|
+
receiving: boolean;
|
|
1103
|
+
source: JobImportSource | null;
|
|
1104
|
+
dataset: string | null;
|
|
1105
|
+
job_id: string | null;
|
|
1106
|
+
n_trials_uploaded: number | null;
|
|
1107
|
+
n_trials_skipped: number | null;
|
|
1108
|
+
skipped_trials: JobImportSkippedTrial[] | null;
|
|
1109
|
+
task_links: JobTaskLink[] | null;
|
|
1110
|
+
failure: JobImportFailure | null;
|
|
1111
|
+
progress: JobImportProgress | null;
|
|
1112
|
+
created_at?: string;
|
|
1113
|
+
updated_at?: string;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
type JobImportSource =
|
|
1117
|
+
| { type: "archive"; sha256: string }
|
|
1118
|
+
| { type: "archive_url"; url: string }
|
|
1119
|
+
| { type: "hub"; job_id: string };
|
|
1120
|
+
|
|
1121
|
+
interface JobImportProgress {
|
|
1122
|
+
phase: JobImportPhaseName;
|
|
1123
|
+
started_at: string;
|
|
1124
|
+
phases: JobImportPhaseProgress[];
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
interface JobImportPhaseProgress {
|
|
1128
|
+
name: JobImportPhaseName;
|
|
1129
|
+
started_at: string;
|
|
1130
|
+
completed_at?: string;
|
|
1131
|
+
}
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
### Import failures, skipped trials, and task links
|
|
1135
|
+
|
|
1136
|
+
```ts
|
|
1137
|
+
interface JobImportFailure {
|
|
1138
|
+
code: string;
|
|
1139
|
+
message: string;
|
|
1140
|
+
details?: Record<string, unknown>;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
interface JobImportSkippedTrial {
|
|
1144
|
+
trial: string;
|
|
1145
|
+
code: "trial_too_large";
|
|
1146
|
+
message: string;
|
|
1147
|
+
details?: { file: string; bytes: number; max_bytes: number };
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
interface JobTaskLink {
|
|
1151
|
+
task_name: string;
|
|
1152
|
+
n_trials: number;
|
|
1153
|
+
n_linked: number;
|
|
1154
|
+
n_unlinked: number;
|
|
1155
|
+
linked_by: TaskLinkedBy;
|
|
1156
|
+
datasets: string[];
|
|
1157
|
+
link_reasons: Partial<Record<TaskLinkReason, number>>;
|
|
1158
|
+
candidates: string[];
|
|
1159
|
+
}
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
`TaskLinkedBy` is `dataset_flag`, `job_dataset_record`, `task_hash`, or `none`. When no task is linked, `TaskLinkReason` is `hash_mismatch`, `task_not_in_dataset`, `no_dataset_named`, `dataset_ambiguous`, `no_hash_match`, or `no_task_digest`.
|
|
1163
|
+
|
|
1164
|
+
## passAtK
|
|
1165
|
+
|
|
1166
|
+
Python: `pass_at_k`. Read already-computed pass@k points from a job; this helper does not recompute scores. Groups without eligible points are omitted.
|
|
1167
|
+
|
|
1168
|
+
```ts TypeScript
|
|
1169
|
+
import { passAtK } from "@evolvingmachines/evolve";
|
|
1170
|
+
for (const group of passAtK(job)) {
|
|
1171
|
+
console.log(group.evals_key, group.points);
|
|
1172
|
+
}
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
```python Python
|
|
1176
|
+
from evolve import pass_at_k
|
|
1177
|
+
|
|
1178
|
+
for group in pass_at_k(job):
|
|
1179
|
+
print(group.evals_key, group.points)
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
### Helper result
|
|
1183
|
+
|
|
1184
|
+
```ts
|
|
1185
|
+
interface PassAtKGroup {
|
|
1186
|
+
evals_key: string;
|
|
1187
|
+
points: PassAtKPoint[];
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
interface PassAtKPoint {
|
|
1191
|
+
k: number;
|
|
1192
|
+
value: number;
|
|
1193
|
+
}
|
|
1194
|
+
```
|
|
1195
|
+
|
|
1196
|
+
## gatewayUsageOf
|
|
1197
|
+
|
|
1198
|
+
Python: `gateway_usage_of`. Return the platform meter’s usage update from a trace event, or null / `None`. A harness’s own usage line has no gateway source and does not qualify.
|
|
1199
|
+
|
|
1200
|
+
```ts TypeScript
|
|
1201
|
+
import { gatewayUsageOf } from "@evolvingmachines/evolve";
|
|
1202
|
+
const reading = gatewayUsageOf(event);
|
|
1203
|
+
if (reading)
|
|
1204
|
+
console.log(reading.usage.costUsd);
|
|
1205
|
+
```
|
|
1206
|
+
|
|
1207
|
+
```python Python
|
|
1208
|
+
from evolve import gateway_usage_of
|
|
1209
|
+
|
|
1210
|
+
reading = gateway_usage_of(event)
|
|
1211
|
+
if reading is not None:
|
|
1212
|
+
print(reading["usage"]["costUsd"])
|
|
1213
|
+
```
|
|
1214
|
+
|
|
1215
|
+
Gateway payload keys stay camelCase inside Python dictionaries. `promptTokens` includes cached and cache-written input. Missing readings are not zero-cost calls.
|
|
1216
|
+
|
|
1217
|
+
### Trace event and gateway usage
|
|
1218
|
+
|
|
1219
|
+
```ts
|
|
1220
|
+
interface TraceEvent {
|
|
1221
|
+
seq: number;
|
|
1222
|
+
type: string;
|
|
1223
|
+
data: Record<string, unknown>;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
interface GatewayUsage {
|
|
1227
|
+
sessionUpdate: "usage";
|
|
1228
|
+
scope: "call";
|
|
1229
|
+
source: "gateway";
|
|
1230
|
+
callId: string;
|
|
1231
|
+
status: string | null;
|
|
1232
|
+
startedAt: string | null;
|
|
1233
|
+
endedAt: string | null;
|
|
1234
|
+
receivedAt: string;
|
|
1235
|
+
usage: {
|
|
1236
|
+
promptTokens: number;
|
|
1237
|
+
completionTokens: number;
|
|
1238
|
+
cachedTokens: number;
|
|
1239
|
+
costUsd: number;
|
|
1240
|
+
extra: { cache_write_tokens: number; reasoning_tokens?: number };
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
interface GatewayUsageEvent {
|
|
1245
|
+
timestamp: string | null;
|
|
1246
|
+
model: string | null;
|
|
1247
|
+
update: GatewayUsage;
|
|
1248
|
+
}
|
|
1249
|
+
```
|