| Name | Type | Description |
|---|---|---|
thread_id | str | None | Default: NoneThe ID of the thread containing runs to cancel. |
run_ids | Sequence[str] | None | Default: NoneList of run IDs to cancel. |
status | BulkCancelRunsStatus | None | Default: None |
action | CancelAction | Default: 'interrupt' |
headers | Mapping[str, str] | None | Default: None |
params | QueryParamTypes | None | Default: None |
Cancel one or more runs.
Can cancel runs by thread ID and run IDs, or by status filter.
client = get_sync_client(url="http://localhost:2024")
# Cancel all pending runs
client.runs.cancel_many(status="pending")
# Cancel specific runs on a thread
client.runs.cancel_many(
thread_id="my_thread_id",
run_ids=["run_1", "run_2"],
action="rollback",
)Filter runs by status to cancel. Must be one of
"pending", "running", or "all".
Action to take when cancelling the run. Possible values
are "interrupt" or "rollback". Default is "interrupt".
Optional custom headers to include with the request.
Optional query parameters to include with the request.