Cloudflare Workflows

What is it?

Cloudflare Workflows is a durable execution engine for running multi-step, long-running tasks on Cloudflare Workers. While a regular Worker handles a single request and responds quickly, Workflows can orchestrate complex sequences of steps that may take minutes, hours, or even days — with automatic retries, state persistence, and failure handling.

What problem does it solve?

Many real-world processes involve multiple steps that depend on each other:

  • AI agent tasks: An AI agent might need to search the web, summarize results, check a database, draft an email, and wait for human approval — a multi-step process that can't be done in a single request.
  • Payment processing: Charge a card → update inventory → send confirmation email → update analytics. If step 3 fails, you need to retry without re-charging the card.
  • Data pipelines: Fetch data from an API → transform it → store it → trigger notifications.
  • Approval workflows: Submit a request → wait for human approval → execute action.

Regular serverless functions (including Workers) are designed for short-lived, single-step operations. They can't persist state across steps, handle retries gracefully, or wait for external events.

How does it work?

  1. A developer defines a Workflow as a series of steps in code.
  2. Each step is a function that takes input, does work, and returns output that feeds into the next step.
  3. Between steps, the Workflow's state is durably persisted — if the Worker crashes, the internet goes down, or an API call fails, the Workflow resumes from the last completed step.
  4. Automatic retries: If a step fails, Workflows automatically retries it with configurable backoff.
  5. Sleep/wait: Workflows can pause for minutes, hours, or days and then resume — useful for scheduled tasks or waiting for external events.

Example: An AI-powered content pipeline:

Step 1: Accept a topic from the user
Step 2: Call an AI model to generate a draft
Step 3: Send the draft for human review (wait for approval)
Step 4: Publish the approved content
Step 5: Send notifications

If Step 2 fails (the AI API is down), the Workflow retries. If Step 3 takes 3 days (waiting for a human), the Workflow patiently waits and resumes when approval arrives.

Why it matters strategically

Workflows is a foundational product for Act 4 because AI agents need durable execution. An AI agent that performs complex tasks on behalf of a user (booking travel, managing code deployments, processing documents) needs a system that can handle multi-step processes reliably. Workflows makes Cloudflare the infrastructure layer for agentic applications. It competes with AWS Step Functions, Temporal, and Inngest.

Learn more