Cloudflare Workflows step.sleep and a Sume job: poll without steps
Cloudflare Workflows step.sleep does not count toward the step limit, so a Sume job poll loop can wait cheaply. Limits, a loop shape and the retention catch.

Yes: in Cloudflare Workflows, step.sleep does not count toward the step limit, so a loop that sleeps between Sume status checks costs steps only for the checks themselves. The limits page lists a sleep maximum of 365 days, 10,000 steps by default on Paid (configurable to 25,000) and 1,024 on Free. Use a webhook as the primary signal and the sleeping loop as the backup.
Limits that shape the design
These come from the Workflows limits reference and the Workflows changelog.
| Limit | Free | Paid |
|---|---|---|
| Steps per instance | 1,024 | 10,000 default, 25,000 configurable |
| Max step.sleep | 365 days | 365 days |
| Concurrent instances | See limits page | 50,000, waiting excluded |
| Instance creation rate | See limits page | 300 per second |
| Step result size | 1 MiB | 1 MiB |
| State retention | 3 days | 30 days, default 7 for new instances |
A loop that does not burn steps
Create the Sume job inside one step.do, returning only the job id, which is tiny against the 1 MiB result limit. Then loop: step.sleep for the number of seconds Sume gave in next_poll_after_seconds, then step.do to read GET /v1/jobs/:id/status. Each status read is one step, so a job that needs a few checks stays far below the cap.
Make the create step idempotent. Workflows retry failed steps, and a retried create without a key can make a second paid job. Send an Idempotency-Key derived from the instance id so a replay returns the original.
- Store the job id, not the result URL contents.
- Fetch
/resultafter the state is terminal, and write large output to storage rather than returning it from a step. - Stop at a sensible total wait and mark the run for review instead of looping for days.
The retention catch
A long sleep is only useful if the instance still exists when it wakes. Retention is 3 days on Free and 30 days on Paid, with a 7 day default on new Paid instances since September 10. Keep the Sume job id somewhere durable, because job results can be fetched by id later while the Workflows state may be gone.
Webhook first, sleep second
Sume pushes job.completed, job.failed and job.canceled with up to 10 attempts. A Worker route can write the terminal state to storage on receipt. The sleeping poll then only fires if the push never arrived. Dedupe on job_id so both paths are safe to run.
Sources
Related posts
More in Developers
- Codex 0.160 queued messages resume after reconnect: Sume safety
Codex 0.160 resumes unsent queued messages after a reconnect without duplicate sends. That covers messages, not tool effects, so keep Sume idempotency_key.
- Compare AI image models on the same prompt: a 20-line API script
MAI-Image-2.6 and Muse Image both claim No. 2 on Arena. Skip the leaderboard: run one prompt through several Sume image models and compare the URLs and cost.
- Run one prompt on five image models via Sume: 200 vs 202 in Python
A Python script fires one prompt at Seedream, FLUX.2, Qwen, Ideogram and Recraft ids on Sume and handles both the 200 image reply and the 202 job envelope.
- Why concurrency_limit differs from the Sume plan table
In Sume generation_limits, concurrency_limit is the effective cap and limit_source says plan or admin_override. Size work from it, not plan_concurrency_limit.
Written by Sume