Limits
Limits that apply to authoring, deploying, and running Workflows are detailed below.
Many limits are inherited from those applied to Workers scripts and as documented in the Workers limits documentation.
| Feature | Workers Free | Workers Paid |
|---|---|---|
| Workflow class definitions per script | 3MB max script size per Worker size limits | 10MB max script size per Worker size limits |
| Total scripts per account | 100 | 500 (shared with Worker script limits |
| Compute time per step 1 | 10 ms | 30 seconds (default) / configurable to 5 minutes of active CPU time |
| Duration (wall clock) per step 1 | Unlimited | Unlimited - for example, waiting on network I/O calls or querying a database |
| Maximum persisted state per step | 1MiB (2^20 bytes) | 1MiB (2^20 bytes) |
| Maximum event payload size | 1MiB (2^20 bytes) | 1MiB (2^20 bytes) |
| Maximum state that can be persisted per Workflow instance | 100MB | 1GB |
Maximum step.sleep duration | 365 days (1 year) | 365 days (1 year) |
| Maximum steps per Workflow 2 | 1024 | 1024 |
| Maximum Workflow executions | 100,000 per day shared with Workers daily limit | Unlimited |
| Concurrent Workflow instances (executions) per account 3 | 25 | 10,000 |
| Maximum Workflow instance creation rate 4 | 100 per second 5 | 100 per second 5 |
| Maximum number of queued instances | 10,000 | 100,000 |
| Retention limit for completed Workflow state | 3 days | 30 days 6 |
| Maximum length of a Workflow name 7 | 64 characters | 64 characters |
| Maximum length of a Workflow instance ID 7 | 100 characters | 100 characters |
| Maximum number of subrequests per Workflow instance | 50/request | 1000/request |
Instances that are on a waiting state - either sleeping, waiting for a retry, or waiting for an event - do not count towards concurrency limits. This means that other queued instances will be scheduled when an instance goes from a running state to a waiting one, usually the oldest instance queued, on a best-effort basis. This state transition - running to waiting - may not occur if the wait duration is too short.
For example, consider a Workflow that does some work, waits for 30 days, and then continues with more work:
import { WorkflowEntrypoint, WorkflowStep, WorkflowEvent } from 'cloudflare:workers';
type Env = { MY_WORKFLOW: Workflow;};
export class MyWorkflow extends WorkflowEntrypoint<Env> { async run(event: WorkflowEvent<unknown>, step: WorkflowStep) {
const apiResponse = await step.do('initial work', async () => { let resp = await fetch('https://api.cloudflare.com/client/v4/ips'); return await resp.json<any>(); });
await step.sleep('wait 30 days', '30 days');
await step.do( 'make a call to write that could maybe, just might, fail', { retries: { limit: 5, delay: '5 second', backoff: 'exponential', }, timeout: '15 minutes', }, async () => { if (Math.random() > 0.5) { throw new Error('API call to $STORAGE_SYSTEM failed'); } }, ); }}While a given Workflow instance is waiting for 30 days, it will transition to the waiting state, allowing other queued instances to run if concurrency limits are reached.
Workflows are Worker scripts, and share the same per invocation CPU limits as any Workers do. Note that CPU time is active processing time: not time spent waiting on network requests, storage calls, or other general I/O, which don't count towards your CPU time or Workflows compute consumption.
By default, the maximum CPU time per Workflow invocation is set to 30 seconds, but can be increased for all invocations associated with a Workflow definition by setting limits.cpu_ms in your Wrangler configuration:
{ // ...rest of your configuration... "limits": { "cpu_ms": 300000, // 300,000 milliseconds = 5 minutes }, // ...rest of your configuration...}[limits]cpu_ms = 300_000To learn more about CPU time and limits, review the Workers documentation.
-
A Workflow instance can run forever, as long as each step does not take more than the CPU time limit and the maximum number of steps per Workflow is not reached. ↩ ↩2
-
step.sleepdo not count towards the max. steps limit ↩ -
Only instances with a
runningstate count towards the concurrency limits. Instances in thewaitingstate are excluded from these limits. ↩ -
Each instance created or restarted counts towards this limit ↩
-
Workflows will return a HTTP 429 rate limited error if you exceed the rate of new Workflow instance creation. ↩ ↩2
-
Workflow state and logs will be retained for 3 days on the Workers Free plan and for 7 days on the Workers Paid plan. ↩
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark