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
step-1-uppercase: uppercase the inputpause-3s: sleep 3 seconds (durable — survives worker restart)step-2-reverse: reverse the stringpause-3s-again: sleep 3 secondsstep-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
| workflow | demo-workflow in worker site-workflow |
| binding | WORKFLOW (pages function binding) |
| trigger | POST /api/workflow-start |
| status | GET /api/workflow-status?id=<instance_id> |