Wait for several runs
wait_for_runsWait for several runs at once, named by ids (up to 100) or by the batch_id from create_runs, until every one has finished (succeeded, failed, cancelled, interrupted or timed_out) and its billing has settled, as wait_for_run does, or until the wait ends (at most 60 seconds). With mode "any" it returns as soon as one of them has finished and settled. Returns every run in order (status, model, output, error, cost, cost_final) and a summary: total, finished, by_status (counts), total_cost_micros, cost_final, pending_run_ids (the runs that have not finished or settled, in order), not_found_run_ids (ids that are not runs of this organization) and, when the runs use more than one model, by_model (each model's runs, finished, by_status, total_cost_micros, cost_final and run_ids, to compare them). If timed_out is true, call it again with ids set to summary.pending_run_ids. With timeout_seconds 1 it is a quick read of the set. COST: total_cost_micros is PROVISIONAL and usually higher than the final total until the summary's cost_final is true; quote it only then. A zero-data-retention run's output is returned by the first read after it finished, and then deleted.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "wait_for_runs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | No | The runs' ids, as returned by create_run or create_runs. Give ids or batch_id. | |
| mode | No | all (default): wait until every run has finished and settled; any: until one has. | |
| batch_id | No | The batch_id from create_runs: wait for all of its runs. | |
| timeout_seconds | No | How long to wait, 1 to 60 (default 30). |