RL runs
16 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.
Two to four runs side by side#
/v1/rl/comparescope sandboxes:readidsrequiredquery · stringcurl -s -X GET https://api.kosa8.com/v1/rl/compare \ -H "Authorization: Bearer $KOSA8_API_KEY"
Alert rules on RL runs#
/v1/rl/alertsscope sandboxes:readKinds: infra_rate and oom_rate (threshold a share 0-1 of the last window rollouts, default 100), cost (threshold USD at list rate) and idle (threshold minutes without a rollout). The minute tick checks running runs and sends rl.alert to the organization's webhooks that subscribe to it, at most once an hour per rule. At most 50 rules an organization.
Parametersrun_idquery · stringcurl -s -X GET https://api.kosa8.com/v1/rl/alerts \ -H "Authorization: Bearer $KOSA8_API_KEY"
Add an alert rule#
/v1/rl/alertsscope sandboxes:writeKinds: infra_rate and oom_rate (threshold a share 0-1 of the last window rollouts, default 100), cost (threshold USD at list rate) and idle (threshold minutes without a rollout). The minute tick checks running runs and sends rl.alert to the organization's webhooks that subscribe to it, at most once an hour per rule. At most 50 rules an organization.
JSON bodyrun_idstring | nullkindrequired"infra_rate" | "oom_rate" | "cost" | "idle"thresholdrequirednumberwindowintegercurl -s -X POST https://api.kosa8.com/v1/rl/alerts \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Change, pause or resume an alert rule#
/v1/rl/alerts/{id}scope sandboxes:writeidrequiredpath · stringthresholdnumberwindowintegerenabledbooleancurl -s -X PATCH https://api.kosa8.com/v1/rl/alerts/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Delete an alert rule#
/v1/rl/alerts/{id}scope sandboxes:writeidrequiredpath · stringcurl -s -X DELETE https://api.kosa8.com/v1/rl/alerts/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
Start an RL run#
/v1/rl/runsscope sandboxes:writeLabel the run's sandboxes kosa8.run=<id> (run_id on POST /v1/sandboxes/batch and /fork does it) so the run's page counts their sandbox-hours and cost, and drain can find them.
JSON bodynamerequiredstringprojectstringconfigobjectcurl -s -X POST https://api.kosa8.com/v1/rl/runs \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
The organization's runs, newest first, with a short summary#
/v1/rl/runsscope sandboxes:readprojectquery · stringstatusquery · "running" | "finished" | "failed"namequery · stringlimitquery · integercursorquery · stringcurl -s -X GET https://api.kosa8.com/v1/rl/runs \ -H "Authorization: Bearer $KOSA8_API_KEY"
A run with its summary and recommended actions#
/v1/rl/runs/{id}scope sandboxes:readCost is at list rates for sandboxes labelled kosa8.run=<id> (cost_basis: list_rate); on a plan the usage is included up to the plan's sandbox-hours. Recommendations appear only when the run's numbers support them.
Parametersidrequiredpath · stringcurl -s -X GET https://api.kosa8.com/v1/rl/runs/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
Rename a run or set its status#
/v1/rl/runs/{id}scope sandboxes:writeFinishing a run does not delete its sandboxes: drain them with POST /v1/sandboxes/drain {run_id}.
Parametersidrequiredpath · stringstatus"running" | "finished" | "failed"namestringcurl -s -X PATCH https://api.kosa8.com/v1/rl/runs/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Record rollouts#
/v1/rl/runs/{id}/rolloutsscope sandboxes:writeAt most 500 a call and 4 MiB a body; all or none are stored. The sealed grader records its own (source grade) when given run_id.
Parametersidrequiredpath · stringrolloutsrequiredarray of objectcurl -s -X POST https://api.kosa8.com/v1/rl/runs/$SBX/rollouts \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
A run's rollouts, newest first, filtered#
/v1/rl/runs/{id}/rolloutsscope sandboxes:readidrequiredpath · stringstepquery · integerfailure_classquery · "ok" | "exit_nonzero" | "timeout" | "oom" | "infra" | "quota" | "client"min_rewardquery · numbermax_rewardquery · numbersandbox_idquery · stringidquery · stringgroupquery · stringreviewquery · "reviewed" | "unreviewed"labelquery · stringoutcomequery · "ok" | "failed" | "infra" | "model"variancequery · "high"limitquery · integercursorquery · stringcurl -s -X GET https://api.kosa8.com/v1/rl/runs/$SBX/rollouts \ -H "Authorization: Bearer $KOSA8_API_KEY"
A run's rollouts as JSONL or CSV, oldest first: every one, or those the filters match#
/v1/rl/runs/{id}/exportscope sandboxes:readidrequiredpath · stringformatquery · "jsonl" | "csv"stepquery · integerfailure_classquery · "ok" | "exit_nonzero" | "timeout" | "oom" | "infra" | "quota" | "client"min_rewardquery · numbermax_rewardquery · numbergroupquery · stringreviewquery · "reviewed" | "unreviewed"labelquery · stringoutcomequery · "ok" | "failed" | "infra" | "model"variancequery · "high"curl -s -X GET https://api.kosa8.com/v1/rl/runs/$SBX/export \ -H "Authorization: Bearer $KOSA8_API_KEY"
Aggregates over the rollouts the filters match: success, infra vs model failures, a reward histogram, labels#
/v1/rl/runs/{id}/statsscope sandboxes:readidrequiredpath · stringstepquery · integerfailure_classquery · "ok" | "exit_nonzero" | "timeout" | "oom" | "infra" | "quota" | "client"min_rewardquery · numbermax_rewardquery · numbergroupquery · stringreviewquery · "reviewed" | "unreviewed"labelquery · stringoutcomequery · "ok" | "failed" | "infra" | "model"variancequery · "high"curl -s -X GET https://api.kosa8.com/v1/rl/runs/$SBX/stats \ -H "Authorization: Bearer $KOSA8_API_KEY"
What the run's sandboxes did: execs, file and network events, newest first#
/v1/rl/runs/{id}/timelinescope sandboxes:readFrom the audit log, so never output or file contents. Not on a public run card.
Parametersidrequiredpath · stringrollout_idquery · stringsandbox_idquery · stringkindquery · "exec" | "file" | "network" | "lifecycle"qquery · stringlimitquery · integerbefore_seqquery · integercurl -s -X GET https://api.kosa8.com/v1/rl/runs/$SBX/timeline \ -H "Authorization: Bearer $KOSA8_API_KEY"
Label, score and comment on a rollout (replaces its annotation)#
/v1/rl/runs/{id}/rollouts/{rollout_id}/annotationscope sandboxes:writeidrequiredpath · stringrollout_idrequiredpath · stringlabelstring | nullscorenumber | nullcommentstring | nullcurl -s -X PUT https://api.kosa8.com/v1/rl/runs/$SBX/rollouts/$ROLLOUT_ID/annotation \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Remove a rollout's annotation#
/v1/rl/runs/{id}/rollouts/{rollout_id}/annotationscope sandboxes:writeidrequiredpath · stringrollout_idrequiredpath · stringcurl -s -X DELETE https://api.kosa8.com/v1/rl/runs/$SBX/rollouts/$ROLLOUT_ID/annotation \ -H "Authorization: Bearer $KOSA8_API_KEY"