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.1

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.1
File Size Uploaded Provenance
durable_actors-0.9.1.tar.gz 164.5 kB With provenance Details

Built distribution (wheel)

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

Total release size: 239.0 kB

Release files / durable_actors-0.9.1.tar.gz

Download URL durable_actors-0.9.1.tar.gz
Size 164.5 kB
Tags Source
SHA-256 checksum
How to use checksums
593c97ed23e991185395e28aa85e66a8b4f53028c6425571fa163c303b87981a
BLAKE2b-256 checksum
How to use checksums
d4dd80aa0fa8e769f0e7dfdb42c3b12c449e74258cf34e62f2a1059ad3f29ff6
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.1-py3-none-any.whl

Download URL durable_actors-0.9.1-py3-none-any.whl
Size 74.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4feeb08a4da1efe41ae2915501d33077e68db5482bcc737f90b8a6662a829960
BLAKE2b-256 checksum
How to use checksums
4958cb1df084f3e991ff7205fd4a6253f79a4bed24f94782b53174c2ff335763
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.1

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.1.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