Demo chat
← All resources

GUIDE / AGENTS AND THEIR ARCHITECTURE

Durable Object Facets for Dynamic Workers.

Cloudflare explains how a supervisor Durable Object can run dynamically loaded applications with separate SQLite storage for each facet.

Maintained in JetskibayPublic information
Cloudflare diagram showing a request entering a supervisor Durable Object, which forwards it to an isolated facet with a separate SQLite database
Overview

Durable Object Facets for Dynamic Workers

This Cloudflare article is for developers building platforms where an AI agent or a user can create an application that needs to keep state. Dynamic Workers can run code supplied at runtime; Durable Object Facets add a way to give that code SQLite-backed storage while a Durable Object you deploy controls how requests reach it. It is an architecture walkthrough with a runnable counter example, supported by a more detailed Facets reference.

The platform deploys a normal Durable Object class as a supervisor. That class loads a Dynamic Worker whose code exports a Durable Object class, creates a named child facet with ctx.facets.get(), and forwards requests with facet.fetch() or RPC. The supervisor and facet each have a separate SQLite database, so the dynamic application can use standard Durable Object storage APIs without reading the supervisor’s records. One supervisor can have multiple named facets. Cloudflare’s documentation shows the three layers and the storage boundary.

To try the pattern, follow the article’s example: configure a SQLite-backed Durable Object class and Worker Loader binding, load a small App class, then route one request through the supervisor to its facet. The sample counter proves that requests can update persistent state. From there, make the supervisor choose the app code and facet name, decide which bindings the dynamic Worker receives, and set outbound access according to the application’s needs. The Dynamic Workers overview describes those runtime controls.

The key design responsibility remains with the platform builder. Facets isolate their databases, but your supervisor must still authenticate callers, decide which code may run, control resource access, and manage code changes. The Facets reference documents abort() for stopping a facet while preserving storage and delete() for permanently removing its database. The article’s compact demo initializes its code on each request for illustration; a real application needs a deliberate code and migration lifecycle.

Example use cases

  • Suggested application — generated personal apps: Give each user-created app a supervisor instance and a facet for its own counters, preferences, or task records.
  • Suggested application — hosted plugins: Run user-authored plugin code in a facet while the supervisor checks access and keeps platform metadata in its separate database.
  • Suggested application — editable prototypes: Load revised app code after stopping the old facet, then test whether its existing data remains compatible before serving users.

Sources

Source image: Cloudflare.

Maintained by Jetskibay. Reviewed 2026-09-29T00:00:00Z.

if you liked this…

Follow the trail.

  1. Read nextProject ThinkCloudflare’s Think harness helps developers build persistent AI agents with an agent loop, tools, streaming chat, and sub-agent coordination on the Agents SDK.
  2. Use nextwappCreate on-demand WhatsApp assistants, share pairing codes, and manage their activity through MCP.
  3. See nextSlidesA presentation workspace that brings your slide brief and visual editor together.