Cloudflare is expanding its serverless capabilities with the introduction of Durable Objects Facets, a new feature enabling dynamically loaded code to manage persistent state. This innovation addresses a key challenge for developers building sophisticated applications, particularly those leveraging AI agents.
Previously, Cloudflare's Dynamic Workers offered lightweight, on-demand execution akin to a secure 'eval()'. While ideal for single-use AI agent tasks, they lacked the ability to maintain long-term data. Conversely, Cloudflare's Cloudflare Durable Objects provided robust, globally unique instances with attached SQLite databases for fast, zero-latency storage, but required pre-defined code implementation.
Bridging the State Gap
Durable Objects Facets act as a bridge, allowing code loaded via Dynamic Workers to instantiate and manage its own Durable Object instance. This means an AI can now generate not just executable code, but also the persistent storage logic for an application.
The core concept involves a supervisor Durable Object that dynamically loads and instantiates another Durable Object class. This instantiated object, known as a 'facet,' receives its own isolated SQLite database, separate from the supervisor's storage.
This architecture provides granular control. Developers can implement logic in the supervisor to manage the creation and access of these facets, enabling features like rate limiting, billing, and enhanced observability for AI-generated applications.
