How to Build Multi-Tenant Durable Workflows with Dynamic Workers

Introduction

When Cloudflare Workers launched, it was a direct-to-developer platform. Today, the ecosystem has grown to support multi-tenant applications where platforms enable their customers to deploy custom code at runtime. From AI-written TypeScript to CI/CD pipelines defined per repository, the need for per-tenant logic is everywhere. This guide walks you through bridging durable execution with dynamic deployment using Cloudflare’s Dynamic Workflows — a solution that gives each tenant its own isolated, durable workflow without requiring you to hardcode a single class per deploy.

How to Build Multi-Tenant Durable Workflows with Dynamic Workers
Source: blog.cloudflare.com

What You Need

Step-by-Step Implementation

Step 1: Understand the Gap Between Durable and Dynamic Execution

Traditional Workflows assume your workflow code is part of your deployment. A single wrangler.jsonc binds one class to one workflow. This works when you own all the code, but fails when you need per‑tenant or per‑agent workflows. For example:

Dynamic Workflows solve this by letting you hand workflow code to the runtime at runtime, just as Dynamic Workers solved compute and Durable Object Facets solved storage.

Step 2: Set Up Dynamic Workers for Compute

Before tackling workflows, you need a dynamic compute primitive. Use Dynamic Workers (open beta) to spin up isolated, sandboxed Workers on the same machine in single‑digit milliseconds. Each tenant gets its own runtime context. Your platform provides the code — be it generated by AI, submitted by users, or fetched from a repository.

Step 3: Integrate Durable Object Facets for Per‑Tenant Storage

Each dynamically loaded app needs its own persistent storage. Durable Object Facets extend the dynamic idea to storage: each tenant gets its own SQLite database, created on demand, with the platform acting as a supervisor.

This gives you the same on‑demand, isolated storage that Dynamic Workers give for compute.

Step 4: Add Versioned Source Control with Artifacts

For workflows that involve code or configuration evolution, you need a Git‑native filesystem. Artifacts provide a versioned filesystem that you can create by the tens of millions — one per agent, session, or tenant.

Step 5: Bridge Durable Execution with Dynamic Workflows

Now you can combine all three primitives. Dynamic Workflows bring durable execution to dynamic deployments. Instead of a static class, your platform injects the workflow code at runtime. Each tenant, agent, or pipeline gets its own workflow instance that can run for hours, sleep, wait for external events, and resume exactly where it left off.

How to Build Multi-Tenant Durable Workflows with Dynamic Workers
Source: blog.cloudflare.com

For example, a CI/CD platform can let each repository define its own pipeline as a workflow. The platform deploys a Dynamic Worker per repository, which runs the pipeline steps durably.

Step 6: Test, Monitor, and Scale

After implementation, ensure your system is robust:

Tips

By following these steps, you can offer durable, dynamic workflows to your customers — exactly what platforms building the next generation of SaaS, AI agents, and CI/CD tools need.

Tags:

Recommended

Discover More

10 Essential Insights Into Google's Enhanced AI Search: What You Need to Know7 Key Insights About NVIDIA's Nemotron 3 Nano Omni: The Unified Multimodal AI ModelMastering Meta is running get-rich-quick ads for its AI toolsNew Python-Based Validation Technique Reveals Hidden Risks in Credit Scoring ModelsGameStop's Cohen Offers $56B for eBay, Then Sells Collectibles to Fund Deal