pub fn close_run(
agent: &Agent,
api_base: &str,
token: &str,
ctx: &RunContext,
exit_code: Option<i32>,
remaining_csv: Option<String>,
uploaded_uris: &[String],
) -> Result<(), String>Expand description
POST to /runs/{run_id}/finish to mark the run complete.
Dispatches to the correct schema variant based on whether S3 uploads occurred:
-
uploaded_urisnon-empty →RunFinishS3(data_source="s3",data_uris=[...]). TheBatchUploaderalready flushed the final remaining samples to S3 on shutdown before this function is called, souploaded_uriscontains every batch.remaining_csvis ignored in this path. -
uploaded_urisempty →RunFinishInline(data_source="inline",data_csv=...). Used for short runs or when all S3 uploads failed.remaining_csvis the raw CSV of all collected samples (never base64-encoded).