Skip to main content
Stop workflows to prevent runaway executions and free up resources. Workflows can be cancelled via timeout or manual cancellation.

Timeout-based cancellation

Set run_timeout_seconds to automatically cancel workflows that run too long:
How timeouts work:
  • Only applies to running workflows (actively executing)
  • Does not apply to waiting workflows (paused on wait_for, wait_for_event, etc.)
  • Orchestrator and/or worker automatically cancels execution when timeout is reached
  • Workflow stops immediately
Example with waits:
Run timeout vs total duration:
  • run_timeout_seconds=60 → Workflow can run for 60 seconds of active execution
  • If workflow waits for 24 hours, that time does not count toward timeout
  • Total workflow duration can exceed run_timeout_seconds if it includes waits

Manual cancellation

Cancel workflows manually using the SDK or API
Or via the handle:
Or via API:

What can be cancelled

  • ✅ Running, queued or waiting workflows can be cancelled
  • ❌ Completed or failed workflows cannot be cancelled

How does it work?

When a workflow is cancelled:
  1. Orchestrator issues cancel signal to the worker
  2. Worker stops execution immediately
  3. Workflow status changes to “cancelled”
  4. No more steps execute
Current step behavior:
  • If a step is running when cancel is issued, it may complete before stopping
  • Steps are not interrupted mid-execution
  • Cancellation takes effect between steps