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.12.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.12.1
File Size Uploaded Provenance Actions
durable_actors-0.12.1.tar.gz 164.6 kB With provenance Details for durable_actors-0.12.1.tar.gz

Built distribution (wheel)

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

Total release size: 239.2 kB

Release files / durable_actors-0.12.1.tar.gz

Download URL durable_actors-0.12.1.tar.gz
Size 164.6 kB
Tags Source
SHA-256 checksum
How to use checksums
de0f1b2712c00000ab28e5089ca1f645cf9a657581ba34efd3dd7dc2af09e456
BLAKE2b-256 checksum
How to use checksums
862a3f3b6159de7e59bb05e1596f4d1e58534543c0e1d572716a8e4d8a209d7d
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 25, 2026.

Transparency log

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

Download URL durable_actors-0.12.1-py3-none-any.whl
Size 74.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d4100dfa254b3e6ee2b0ee7115f66f83d119747ffaed9053e6ac5b5101fb013
BLAKE2b-256 checksum
How to use checksums
8b5559690178c99bfa2e269ec161de0707556b525c3e459b583b3eeb0fecc073
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 25, 2026.

Transparency log

Security for durable-actors 0.12.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.12.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 25, 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.

Release history Release notifications | RSS feed

This release

0.12.1 This release

2 release files Full provenance

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