rhocfsandbox.com

demo: cloudflare workflows

a multi-step workflow with sleeps between steps. each step is durably checkpointed. if the underlying worker restarts mid-run, the workflow resumes from the last completed step without re-executing prior work. good for long-running async jobs: onboarding flows, video processing, scheduled retries, saga patterns.

start a workflow…

# the workflow steps

  1. step-1-uppercase: uppercase the input
  2. pause-3s: sleep 3 seconds (durable — survives worker restart)
  3. step-2-reverse: reverse the string
  4. pause-3s-again: sleep 3 seconds
  5. step-3-length: measure length

total: ~6-8 seconds. compare that to a plain worker which would time out after 30s cpu, or block a request for the full duration.

# config

workflowdemo-workflow in worker site-workflow
bindingWORKFLOW (pages function binding)
triggerPOST /api/workflow-start
statusGET /api/workflow-status?id=<instance_id>