Skip to main content
Examples use a configured client. See client setup for credentials and returned objects for result fields. Optional values are omitted unless shown. Python examples run inside an async function. Collection handles support two forms: await reads one page; for await / async for visits all pages. A page has items, nextCursor, and hasMore in TypeScript; items, next_cursor, and has_more in Python.

start

Submit tasks and agent/model arms. Returns the accepted Job; execution continues in the cloud.
Required: nonempty datasets and agents; each selector needs name, and each arm needs name plus model_name. Python accepts dictionaries or the matching dataclasses. TypeScript takes one input object, then optional { idempotencyKey }. Python takes keyword arguments, including idempotency_key. Run settings explains defaults, timeout multipliers, retry policy, secrets, and accepted environment overrides. An omitted SDK option leaves the decision to the server; the returned job records the resolved settings. agent_env is a pass-through input that the managed platform currently refuses. verifier_env accepts only REWARDKIT_JUDGE and REWARDKIT_MODEL.

get

Read one job by id. Returns Job, including resolved configuration, trial counts, statistics, and provenance.

list

List jobs, check summaries, or both. Returns a page or an iterable of matching rows.
Read row.kind before using a mixed row. A check row has task-check counts, not trial counts. See row fields.

trials

List a job’s attempts. Returns a page or an iterable of Trial.
Optional status is a list of trial statuses. dataset matches the trial’s source exactly. limit defaults to 50 (maximum 200); cursor continues a page. A list row may truncate an exception message; trials().get(id) reads its full detail.

tasks

Read one row per task and dataset source: trial tally, mean reward, measured cost, and latest task quality check. Returns a page or iterable of JobTaskRollup.
Optional limit defaults to 50 (maximum 200); cursor continues a page. See task rollup fields.

watch

Follow job events, or wait for the final Job. Use one form per handle.
Iteration returns JobEvent, with seq, type, and data. The stream replays from the beginning and resumes on reconnect. Event payloads document every event type. A trial.settled event can be followed by trial.retrying; it does not mean the job is finished.

cancel

Request cancellation. Returns Job. Repeating it on a terminal job leaves the job unchanged.

resume

Create a new job for a terminal source’s failed and stopped work. Returns Job; the source remains unchanged.
Optional filter_error_types: string[] selects failures by exception_info.exception_type. Omitted, the default set includes stopped trials. The new job records source_jobs[].action: "resume". Imported jobs cannot resume.

retry

Create a new job for selected settled trials, including scored trials. Returns Job.
Do not combine trial_ids with failed_only. The new job records action: "retry". Imported jobs cannot retry.

regrade

Run verifiers again against eligible recorded inputs. Returns a new Job with is_regrade: true; it does not rerun the agent.
The source job must be terminal. Optional statuses: TrialStatus[] and task_name: string narrow selection. Shared-verifier, older unretained, and imported inputs may be ineligible. Regrade requirements explain the boundary.

analyze

Queue analysis of a terminal job’s traces. Returns the Job immediately, with its analysis wave pending.
All options are optional. analyses().defaults() reads the current model, effort, provider, rubric, and prompt defaults. Cancelled trials are excluded. trial_ids is accepted here, but refused inside start({ analyze }). The analysis guide covers custom rubric and prompt semantics.

watchAnalysis

Python: watch_analysis. Wait for a manually queued analysis wave to settle. Returns the final Job.
Optional onStats(job) / on_stats(job) runs when the analysis tally changes. Polling starts at 2 seconds, doubles while unchanged to 30 seconds, and resets on a change. TypeScript accepts signal; Python accepts timeout_s. Call after analyze(). A job with no analysis tally can wait indefinitely. On a running job with embedded analysis, a temporarily empty queue can end this watch before the remaining trials settle.

compare

Compare 2–10 jobs you can read. Returns per-job aggregates and a task matrix, with disagreements first.
Read comparison.jobs and comparison.taskMatrix / comparison.task_matrix. Means use scored trials with non-null rewards; coverage.scored counts all scored trials. See all comparison fields.

grep

Search every trial’s parsed trace in one job. Returns one page of matching trial groups.
Required q is a case-insensitive POSIX regular expression. Optional type matches an event type exactly. limit defaults to 50 (maximum 200); cursor continues the trial groups. Each group has trial_id, nullable task_name, exact match_count, and up to five sampled events. Use trials().trace(trialId, { grep: q }) / trace(trial_id, grep=q) to read all matching events for one trial.

download

Download a terminal job’s results as a .tar.gz in the job-directory format.
In-memory and saved downloads verify length and any server digest. For a raw TypeScript stream, the caller owns verification. to saves an archive; it does not extract it.

upload

Import an existing job directory or archive. Returns JobImport, not Job.
Supply one source. URL imports have no client upload progress. onRegistered fires only on the resumable upload path, before transfer; the single-request path returns the id when accepted. Follow the import with watchImport / watch_import, then read job_id. For a local agent session, use Upload an SDK run.

getImport

Python: get_import. Read one import owned by the caller. Returns JobImport, including status, progress, skipped trials, failure, and eventual job_id.

watchImport

Python: watch_import. Wait for an import to reach COMPLETED or FAILED. Returns JobImport in either case.
Optional callbacks: onStatus(record) / on_status(record) on status changes; onProgress(progress, record) / on_progress(progress, record) on progress changes. Polling defaults to 2 seconds. TypeScript accepts signal; Python accepts timeout_s. Transient 429/503 replies delay the watch. A returned FAILED import carries failure; success supplies job_id while the imported job still exists.

listImports

Python: list_imports. Recover previous import ids. Returns a page or iterable of the caller’s JobImport records, newest first.
Optional status uses QUEUED, RUNNING, COMPLETED, or FAILED; limit defaults to 50 (maximum 200); cursor continues results.

share

Grant read access to a job you created. Returns the whole JobShares state.
Provide link: true / link=True, emails: string[] / emails=[...], or both. A link is unlisted. Email sharing sends an invitation to each new address; recipients can read, not operate, the job. Up to 50 email shares per job. See share-state fields.

unshare

Revoke a link or email grants. Returns JobShares. Creator-only and idempotent.
Accepts the same link and emails fields as share. A revoked link stops working; sharing again creates a new link.

shares

Read current visibility, link state, and email grants. Returns JobShares. Creator-only.

delete

Permanently remove a terminal job you created and its stored trial and analysis results. Returns JobDeleteResult.
The receipt has job_id, trials_deleted, and analyses_deleted. Active analyses or a live derived regrade prevent deletion. Regrade job ids are not deleted through this method. Deleting an imported job releases its duplicate-import lock.