WorkflowRun

cancel()

run.cancel() → Promise<WorkflowRun>

Stops the run. What already happened stays happened — a message sent is sent, a deploy is online.

stops the chainundoes nothingstatus: cancelled
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

await run.cancel();
console.log(run.data.status);   // "cancelled"
run.cancel()
print(run.data["status"])   # "cancelled"

What it stops

The chain. No further step starts. A step already in flight finishes rather than being torn in half.

Cancelling is not undoing

Every effect a completed step had is permanent: documents written, mail delivered, a site published, a DNS record changed. Cancel stops what has not happened yet.

It works on a waiting run too

An approval that will never come is a run that waits for ever. Cancelling is how it is closed, and the record shows it was cancelled rather than refused.

The record is kept

Every step that ran, with its output, its credits and its warnings. A cancelled run is still the account of what was done.

A cancelled run cannot be resumed

retry() is for a failed run. To do the work again, start a new run.