Skip to main content

Python bindings for the rakka actor framework (Akka.NET port in Rust).

Project description

rakka

An idiomatic Rust port of Akka.NET with first-class Python bindings. The Rust crates mirror the Akka.NET module layout so upstream changes can be tracked, while using native Rust solutions for configuration (TOML), transport (Tokio + bincode), and serialization (Serde). Python users get the same actor model with GIL-isolated interpreter pools for CPU-bound workloads.

Why it matters: The actor model is the same programming idea whether it runs on the JVM, on .NET, or here as native code in Rust. You get a small, addressable unit of state plus behavior (an actor) that communicates by asynchronous message passing, which maps cleanly onto autonomous, collaborative processes in agentic and distributed systems. On one machine, actors spread work across cores without shared-memory soup; across machines, the same abstraction (location transparent addresses, cluster, sharding) extends that idea to a fleet. Deterministic designs are possible per actor (ordered mailbox, local state machine); non-determinism from concurrency, the network, and failure is explicit and supervised rather than an accident of raw threads. For a full argument, see docs/actors-and-agentic-computing.md.

Agentic stack (ecosystem): LangGraph-style agent state graphs map naturally onto supervised actors. Companion crates in the same family—rakka-langgraph (embed LangGraph agent state graphs in the runtime) and rakka-agents (patterns, tooling, and practices above the graph layer: orchestration, tools, and operational playbooks)—sit on top of the core in-tree crates. The doc above goes into depth.

Status

Scaffolding-complete, depth-in-progress. Every Akka.NET subsystem has a corresponding crate that builds and ships passing unit tests (174+ Rust tests, 23 Python tests), but a 2026-04-30 audit found that most subsystems cover only ~1–10% of upstream LOC and skip critical protocol machinery (active gossip, leader election, shard rebalance, recovery permitter, substream algebra, real persistence backends, …). See docs/full-port-plan.md for the audit and the 15-phase roadmap to true parity, and docs/parity.md for per-crate depth grades (a/b/c/d/f).

PORTING_TODO.md tracks per-phase progress; PORTING.md tracks upstream Akka.NET sync commits. docs/remoting.md describes the in-tree TCP remoting stack.

Workspace layout

Rust crates

Crate Mirrors
rakka Akka facade
rakka-core src/core/Akka
rakka-config src/core/Akka/Configuration
rakka-macros n/a (ergonomics)
rakka-testkit src/core/Akka.TestKit
rakka-remote src/core/Akka.Remote
rakka-cluster src/core/Akka.Cluster
rakka-cluster-tools src/contrib/cluster/Akka.Cluster.Tools
rakka-cluster-sharding src/contrib/cluster/Akka.Cluster.Sharding
rakka-cluster-metrics src/contrib/cluster/Akka.Cluster.Metrics
rakka-distributed-data src/contrib/cluster/Akka.DistributedData
rakka-persistence src/core/Akka.Persistence
rakka-persistence-query src/core/Akka.Persistence.Query
rakka-persistence-query-inmemory in-memory read journal
rakka-persistence-tck src/core/Akka.Persistence.TCK
rakka-streams src/core/Akka.Streams
rakka-coordination src/core/Akka.Coordination
rakka-discovery src/core/Akka.Discovery
rakka-di src/contrib/dependencyinjection/Akka.DependencyInjection
rakka-hosting Akka.Hosting (external)

Python bindings

Rust sub-crate Python module
crates/py-bindings/pycore rakka + rakka._native
crates/py-bindings/pytestkit rakka.testkit
crates/py-bindings/pycluster rakka.cluster
crates/py-bindings/pycluster-tools rakka.cluster_tools
crates/py-bindings/pycluster-sharding rakka.cluster_sharding
crates/py-bindings/pyddata rakka.ddata
crates/py-bindings/pypersistence rakka.persistence
crates/py-bindings/pystreams rakka.streams
crates/py-bindings/pycoordination rakka.coordination
crates/py-bindings/pydiscovery rakka.discovery
crates/py-bindings/pydi rakka.di
crates/py-bindings/pyhosting rakka.hosting

The sub-crates are aggregation placeholders — Python bindings for every subsystem are compiled into the single rakka._native cdylib by pycore. Individual wheels can be carved out later without renaming the Python facade.

Quick start (Rust)

use rakka::prelude::*;

#[derive(Default)]
struct Greeter;

#[async_trait::async_trait]
impl Actor for Greeter {
    type Msg = String;
    async fn handle(&mut self, _ctx: &mut Context<Self>, msg: String) {
        println!("hi {msg}");
    }
}

# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let system = ActorSystem::create("S", Config::empty()).await?;
let greeter = system.actor_of(Props::create(Greeter::default), "greeter")?;
greeter.tell("world".to_string());
system.terminate().await;
# Ok(()) }

Quick start (Python)

python -m venv .venv && source .venv/bin/activate
pip install maturin pytest pytest-asyncio
maturin develop --release

Sandboxed host without python3-dev? Copy .cargo/pyo3-config.txt.example to .cargo/pyo3-config.txt, edit the paths for your interpreter, and export PYO3_CONFIG_FILE="$PWD/.cargo/pyo3-config.txt". The helper source scripts/dev-env.sh automates the whole venv + env-var setup.

from rakka import Actor, ActorSystem, props

class Greeter(Actor):
    async def handle(self, ctx, msg):
        return f"hello, {msg}"

system = ActorSystem.create_blocking("app")
ref = system.actor_of(props(Greeter), "greeter")
print(ref.ask_blocking("world", timeout=5.0))   # -> "hello, world"
system.terminate_blocking()

See docs/python.md for the full GIL tuning guide — python-pinned, python-subinterpreter-pool (PEP 684), python-nogil (PEP 703), python-subprocess, plus InterpreterQuota, InterpreterMetrics, and the C-extension compatibility registry.

Profiling

A cross-runtime actor profiler ships with the repo. It measures the same four scenarios (tell, ask, fanout, cpu) in Rust and Python and emits a shared JSON schema so the two stacks can be compared directly.

# Rust only
cargo run --release -p rakka-profiler -- --scenario all --format md
cargo xtask profile -- --scenario cpu --messages 5000

# Python only (after maturin develop --release)
python -m rakka.profiler --scenario all --format md

# Both side-by-side, with a merged JSON artifact
python scripts/profile.py --output docs/reports/profiler.md \
                          --json   docs/reports/profiler.json

See docs/profiler.md for the full guide and a baseline captured on Linux / aarch64 / 20 cpus / py 3.12.

Building and testing

# Rust
cargo build --workspace
cargo test --workspace

# Python (requires maturin + a Python dev toolchain)
maturin develop --release
pytest python/tests -v

# Docs (optional)
pip install mkdocs-material
mkdocs serve

Layout on disk

crates/           Rust crates (one per Akka.NET subsystem)
crates/py-bindings/   PyO3 bridge crates + sub-crate placeholders
python/rakka/      Python facade package (pure Python)
python/tests/         pytest suite for the native extension
python/examples/      Python examples (pingpong, ml_inference, ...)
examples/             Rust examples (pingpong, chat, fault-tolerance)
benches/              Criterion benches
scripts/              Cross-runtime tooling (e.g. profile.py orchestrator)
docs/                 mkdocs-material source (index, actors-and-agentic-computing,
                      parity, python, persistence-providers, remoting,
                      profiler, dashboard, observability)
docs/reports/         profiler baselines (markdown + json)
xtask/                Cargo xtask (upstream sync, parity report, profile)
akka.net/             Upstream clone — gitignored, created on demand by
                      scripts/sync-upstream.py (never committed)

Learn more

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rakka-0.2.0.tar.gz (366.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rakka-0.2.0-cp310-abi3-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

rakka-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

rakka-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

rakka-0.2.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (5.0 MB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file rakka-0.2.0.tar.gz.

File metadata

  • Download URL: rakka-0.2.0.tar.gz
  • Upload date:
  • Size: 366.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rakka-0.2.0.tar.gz
Algorithm Hash digest
SHA256 985d53c6e599db051e383f28c225b118b892310b85c09de7fe50a56c0860c79c
MD5 ee32c3f4c84c0dfeccd71f13f5c80b08
BLAKE2b-256 2cce8c495850ebd8aa1e875dcd2993e509bfe8fe74f605a749125a994daead84

See more details on using hashes here.

Provenance

The following attestation bundles were made for rakka-0.2.0.tar.gz:

Publisher: release.yml on rustakka/rakka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rakka-0.2.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: rakka-0.2.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rakka-0.2.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 269354530fa1b451c7f03c0e3097f20759fcc50054818da386127da74370a4d3
MD5 5f1805e161f24a251b9afede64ac5048
BLAKE2b-256 283472e6d0387dcd6b2e0b236da733af874842f7be714f16108535512caac8ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for rakka-0.2.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on rustakka/rakka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rakka-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rakka-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 64b4787e61d367adae1324871820806b88c9ba7c9d26c39fde000754b61cb315
MD5 6493092a9e58c276654e8738c8efeb1b
BLAKE2b-256 c8baa076ed3a46122a1cf912feb5005828e7212c303024fee255a43fa0f1705b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rakka-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on rustakka/rakka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rakka-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rakka-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c05a0c7b76187a1d4a7170a09d21cdde0d992aafd57cec83d8f1cf1558f743e
MD5 bc3ce4aa79492159ef0939a0c2672622
BLAKE2b-256 e4ee4906c9ada50f190cfc263ca7389c50c01d35ed5613d4b12dbf28a944b651

See more details on using hashes here.

Provenance

The following attestation bundles were made for rakka-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on rustakka/rakka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rakka-0.2.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for rakka-0.2.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e1ace8b1b21d869e7e7c510194669ec18dab6b9dfd8e55b849688de9c77d55cc
MD5 45d7f007bc60e0bf9c7acc5fad613d8d
BLAKE2b-256 ba6597d9aa42c814402763ff13df7b650cd5856e47a5500e68b31a8e8f4d06fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rakka-0.2.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on rustakka/rakka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page