Skip to main content

Durable Actors for Python

Durable actors and typed clients, backed by the Rust runtime.

Quickstart · Reference · Runnable example

Quickstart

Requires Python 3.11+ and uv. The CLI, SDK, and native runtime are installed as Python packages.

Create a project anywhere. uv installs the SDK, CLI, and matching native runtime wheel from PyPI.

uvx --from 'durable-actors[cli]' durable-actors init my-actors
cd my-actors

Define src/actors.py. Every instance field must use persisted() or ephemeral(). Persisted fields are stored in SQLite, which the Rust runtime owns and replicates with Litestream; local development persists to the filesystem. Wrap persisted fields with emitted() to broadcast saved changes.

from durable_actors import Actor, emitted, persisted

class Counter(Actor):
    count: int = emitted(persisted(0))

    def increment(self, amount: int = 1) -> int:
        self.count += amount
        return self.count
uv run durable-actors dev

Call an actor

In another terminal in the same directory, generate the client:

uv run durable-actors generate

Save as client.py and run uv run client.py:

from generated import actors

counter = actors.Counter.get("one")
print(counter.increment())

Async actors and clients

Define AsyncActor methods and socket hooks with async def. Calls stay serialized across await unless marked @interleave. Generated async_actors clients work with either actor style:

from durable_actors import AsyncClient
from generated import async_actors

async with AsyncClient() as client:
    print(await async_actors.Counter.get("one", client).increment())

Await actor database and connection queries, and broadcast(); socket handle methods remain synchronous. Reuse AsyncClient for connection pooling. Close async connections and subscriptions with async with or aclose().

Use the client in another application

Copy the entire generated package, including its helper modules, into the application. From that application's root, install the client runtime:

uv add durable-actors

This installs the runtime dependencies automatically. The [codegen] extras are only needed to generate or regenerate clients, not to run them.

Subscribe to state

Callbacks receive complete typed snapshots on a background thread. Keep the process running while listening; the context manager closes the subscription.

from generated import actors

counter = actors.Counter.get("one")
with counter.subscribe(lambda state: print(state.count), on_error=print):
    counter.increment()
    input("Press Enter to stop.\n")

Metadata

Release files for durable-actors 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for durable-actors 0.9.0
File Size Uploaded Provenance
durable_actors-0.9.0.tar.gz 164.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for durable-actors 0.9.0
File Interpreter ABI Platform
durable_actors-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 239.0 kB

Release files / durable_actors-0.9.0.tar.gz

Download URL durable_actors-0.9.0.tar.gz
Size 164.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c18842bd535fa20f693b2d9132a4ac37918e2d3203481bbac0eeca73967b8c8c
BLAKE2b-256 checksum
How to use checksums
7002f8d9c1b16a730b966f708db9e27eac547e9819af4261ae2e698b5251890d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / durable_actors-0.9.0-py3-none-any.whl

Download URL durable_actors-0.9.0-py3-none-any.whl
Size 74.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0ee381be68a01755f3a8f27bb3a97e3bd628a6636577e8df9ecc46a4218db7f
BLAKE2b-256 checksum
How to use checksums
b8b6ef416c629ff72c1d9f1f013b1a00f88032c70f32bd562b1818c6c9df0319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for durable-actors 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for durable_actors-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page