Dynamic Workflows: Enabling Durable Execution for Every Tenant

By

Introduction

When Cloudflare launched Workers eight years ago, the platform was designed primarily for individual developers. Over time, it evolved to support not only direct development but also multi-tenant applications where platforms could enable their customers to deploy code at scale. Today, Workers powers a variety of scenarios: AI-driven applications that generate and run code for users, multi-tenant SaaS where each customer's business logic is TypeScript unknown to the platform beforehand, agentic systems that write and execute their own tools, and CI/CD products where every repository defines a custom pipeline.

Dynamic Workflows: Enabling Durable Execution for Every Tenant
Source: blog.cloudflare.com

This evolution required new primitives. Last month, we introduced Dynamic Workers in open beta, which provides a clean compute abstraction: hand code to the Workers runtime at runtime and receive an isolated, sandboxed Worker in single-digit milliseconds on the same machine. Durable Object Facets extended this idea to storage, offering per-app SQLite databases that spin up on demand, with the platform acting as a supervisor. Artifacts completed the picture for source control, providing a Git-native versioned filesystem that can be created in massive numbers — one per agent, session, or tenant. With dynamic deployment for compute, storage, and source control, the next logical step was to address durable execution. Today, we announce Dynamic Workflows, bridging durable execution with dynamic deployment.

The Challenge of Multi-Tenant Workflows

Cloudflare Workflows is our durable execution engine. It transforms a run(event, step) function into a resilient program where every step survives failures, can sleep for hours or days, wait for external events, and resume exactly where it left off after an isolate is recycled. This is ideal for any process that must persist beyond a single request: onboarding flows, video transcoding pipelines, multi-stage billing, and long-running agent loops. With Workflows V2, we now support up to 50,000 concurrent instances and 300 new instances per second per account, designed for the agentic era.

However, Workflows had a fundamental assumption: the workflow code must be part of your deployment. The wrangler.jsonc configuration includes a binding that maps the engine to a specific class — one binding per class per deploy. This works well when you control all the code, such as in a traditional application. But it breaks the moment you need to let each customer define their own workflow. Consider a platform where AI generates TypeScript for every tenant, a CI/CD product where each repository has its own pipeline, or an agent SDK where each agent writes its own durable plan. In these cases, the workflow differs for every tenant, agent, or request. There is no single class to bind.

Bridging Durable and Dynamic Execution

Dynamic Workflows solve exactly this problem. They combine the reliability of durable execution with the flexibility of runtime code injection. Instead of defining a fixed class in a deployment, platforms can now hand over workflow code at runtime — just as Dynamic Workers do for compute, Durable Object Facets do for storage, and Artifacts do for source control. Each invocation receives its own isolated execution context, with the same guarantees of durability and fault tolerance.

This approach mirrors the pattern established by Dynamic Workers: hand code to the runtime, get a sandboxed Worker back. But now, that code is not just a stateless request handler; it is a durable workflow that can manage state over time. The platform sits in front as a supervisor, orchestrating execution and storage, while the workflow code runs in a secure, isolated environment. This enables true multi-tenancy without sacrificing performance or reliability.

Dynamic Workflows: Enabling Durable Execution for Every Tenant
Source: blog.cloudflare.com

Key Benefits and Use Cases

Dynamic Workflows unlock several key benefits:

Use cases abound. Onboarding flows can be personalized per tenant, with AI-generated steps that adapt to user behavior. Video transcoding pipelines can be dynamically composed based on content type and target devices. Billing systems can handle complex multi-stage invoicing with custom logic for each customer. Long-running agent loops can write and refine their own workflows over time, learning from interactions. In CI/CD products, each repository can define a pipeline that runs as a durable workflow, ensuring builds and deployments complete reliably.

The Future of Dynamic Deployments

Dynamic Workflows complete the trio of dynamic primitives. Together with Dynamic Workers, Durable Object Facets, and Artifacts, they provide a comprehensive platform for building next-generation applications. The combination allows any tenant, agent, or session to have its own compute, storage, source control, and durable execution — all managed by a single, unified platform.

Looking ahead, we see a future where autonomous agents can not only write their own tools but also design and execute durable plans that span days or weeks. Platforms will be able to offer workflow-as-a-service, where customers define logic in TypeScript and the infrastructure handles the rest. The gap between dynamic and durable execution is now closed, enabling a new wave of multi-tenant, agentic, and AI-driven applications on Cloudflare Workers.

For developers eager to explore, Dynamic Workflows are available in open beta. We invite you to try them out and see how they can transform your platform's capabilities.

Tags:

Related Articles

Recommended

Discover More

10 Critical Facts About the PhantomRPC Windows Privilege Escalation VulnerabilityStep-by-Step Guide to Uncovering the Real Costs of Hybrid SUV OwnershipCritical Supply Chain Attack Hits PyTorch Lightning and Intercom-client Packages: Credential Theft ConfirmedHow to Thrive When Your UX Role Demands Production-Ready Code: A Step-by-Step GuideWhy Letting AI Write Your Difficult Emails Could Backfire: The Hidden Risks