Overview
Durable Actors is an open-source alternative to Cloudflare Durable Objects for building stateful serverless functions without vendor lock-in. It abstracts persistence, coordination, and infrastructure concerns for distributed applications while keeping actor state durable across interruptions, errors, and restarts.
Actors process concurrent updates through serialized execution, helping applications coordinate access to shared state safely. The runtime also includes built-in observability and is designed to avoid fixed memory limits.
Key Features
- Persists designated actor fields across failures and restarts.
- Serializes execution so concurrent callers can update shared state safely.
- Generates type-safe clients from actor definitions.
- Supports SDK usage from TypeScript and Python.
- Runs locally during development and can be self-hosted on Google Cloud Platform.
- Loads actors on demand through the runtime.
Actor methods can also permit other calls to proceed while awaiting long-running work, which is useful when maintaining responsive connections during streamed operations.
How It Works
Developers define an actor as a class containing durable state and application behavior. The local development runtime loads exported actors, persists fields marked for storage, and exposes them to generated clients through a type-safe contract.
A backend can connect to an actor over WebSocket to share state and receive updates. The provided quickstart demonstrates a multiplayer AI chat whose actor stores message history, accepts new messages, streams model output, and broadcasts the changing conversation to connected clients.
Use Cases
Durable Actors targets real-time and coordinated applications where multiple users, services, or agents interact with shared state. Examples supported by the project include chat systems that preserve conversations through model or server failures, collaborative documents that coordinate simultaneous edits, and agent swarms that need durable execution and state management.