Provides Python bindings for the atomr actor model framework, covering actor authoring, GIL/dispatcher strategies (pinned, subinterpreter-pool, nogil, subprocess), and async/sync ask/tell patterns.
Ships in atomr-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The Python facade (pip install atomr) gives you the atomr actor
model with the Rust scheduler, mailbox, supervision, clustering,
persistence, and streams machinery underneath. Heavy lifting happens
in atomr._native (built with PyO3 + maturin); the Python package is
ergonomic wrappers and the Actor base class.
Supported Python: 3.10+ (abi3). 3.12 enables subinterpreters; 3.13t
(PEP 703 free-threaded) enables the python-nogil dispatcher.
from atomr 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))
system.terminate_blocking()
There is also an async variant — await ActorSystem.create("app"),
await ref.ask("world", timeout=5.0) — for use inside asyncio
applications. Don't mix the blocking and async APIs in the same coroutine.
The Python package mirrors the Rust workspace:
| Rust crate | Python module |
|---|---|
atomr-core | atomr (Actor, Props, ActorSystem) |
atomr-testkit | atomr.testkit |
atomr-cluster | atomr.cluster |
atomr-cluster-tools | atomr.cluster_tools |
atomr-cluster-sharding | atomr.cluster_sharding |
atomr-distributed-data | atomr.ddata |
atomr-persistence | atomr.persistence |
atomr-streams | atomr.streams |
atomr-coordination | atomr.coordination |
atomr-discovery | atomr.discovery |
atomr-di | atomr.di |
atomr-hosting | atomr.hosting |
This is the most important decision in any non-trivial atomr-Python deployment. There are four shapes; pick one per workload.
python-pinned (default)One interpreter, one OS thread, one GIL. Best latency for small actor graphs where handlers are short and the bulk of the work is I/O or is delegated to Rust.
system.configure_interpreter("default", "python-pinned")
python-subinterpreter-pool (recommended for CPU-bound)N subinterpreters on N OS threads (PEP 684). Each interpreter has its own GIL, so CPU-bound Python handlers actually run in parallel — provided the C extensions you import are subinterpreter-safe.
from atomr import InterpreterQuota
system.configure_interpreter(
"ml-inference",
"python-subinterpreter-pool",
quota=InterpreterQuota(n=4),
)
Validate via subinterpreters_supported(). Declare third-party C
extensions via atomr.declare_compat(...); see
atomr.compat.compat_list() for what's already known.
python-nogil (PEP 703)One interpreter, no GIL. Requires Python 3.13t (the free-threaded
build). Validate via nogil_supported(). Best for highly concurrent
Python handlers that share state, when subinterpreter isolation
breaks something you need.
python-subprocessOne subprocess per dispatch. Heaviest; use only when you must run incompatible C extensions or untrusted code with an isolation boundary.
| Method | Returns | Use from |
|---|---|---|
ref.tell(msg) | None | anywhere |
await ref.ask(msg, timeout=…) | reply | async def |
ref.ask_blocking(msg, timeout=…) | reply | sync code, __main__, REPL |
tell is fire-and-forget. ask allocates a oneshot and waits for the
handler's return value (or an explicit reply). Don't ask_blocking
from inside an async actor — it deadlocks the dispatcher.
Subinterpreters and free-threaded Python both stress C extensions in
ways that the GIL'd single-interpreter world did not. Before deploying
on python-subinterpreter-pool or python-nogil:
atomr.compat.compat_list() to see which extensions are flagged.atomr.declare_compat("my_pkg", flags=...).python-pinned for that dispatcher.The Python facade exposes typed exceptions:
| Exception | Raised when |
|---|---|
AtomrError | base class — catch this to net everything |
ActorSystemError | ActorSystem startup/shutdown failure |
SpawnError | actor_of failed (name conflict, factory raised, …) |
AskError | ask timed out or the actor was stopped |
InterpreterOverloaded | subinterpreter pool saturated |
InterpreterCompatError | extension declared incompatible with strategy |
atomr.testkit mirrors atomr-testkit:
from atomr.testkit import TestKit
kit = TestKit()
probe = kit.probe("p")
ref.tell("hi")
assert probe.expect_msg(timeout=2.0) == "hi"
The cross-runtime profiler is callable from Python:
python -m atomr.profiler --scenario all --format md
The output schema matches the Rust profiler's, so Rust and Python
runs are directly comparable. See docs/profiler.md.
docs/python.md — bindings overview + GIL strategy guidedocs/profiler.md — cross-runtime profilerpython/atomr/__init__.py — public API surfacepython/atomr/actor.py — Actor base classpython/atomr/system.py — ActorSystem, Props, ActorRef, Contextpython/atomr/interpreter.py — interpreter quotas, capability checkspython/atomr/compat.py — C-extension compatibility registrypython/tests/ — integration tests (good usage examples)*_blocking and await APIs in the same coroutine. Pick one.ask_blocking from inside an actor handler. Deadlocks
the dispatcher; use ask (and await it) instead.subinterpreters_supported(). Pre-3.12 builds silently fall back.declare_compat for in-house C extensions. They will
appear unsafe and the dispatcher will refuse to load them in the
pool.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
/atomr-ai-skills:atomr-pythonfrom atomr-ai-skills
npx claudepluginhub rustakka/atomr --plugin atomr-ai-skills6 skills in this plugin
/atomr-actor-designUse when authoring or modifying an actor in a project that depends on atomr. Covers Msg type design, the Actor trait's lifecycle hooks, ask vs tell, supervision strategies, and FSM patterns. Triggers on writing or editing an `impl Actor`, choosing a Msg enum, picking a supervision strategy, or wiring `Props`/`ActorSystem`./atomr-clusterUse when bringing up clustering, sharding, singleton, distributed pub/sub, or distributed-data (CRDT) features in a project that depends on atomr. Covers feature flag selection, seed-node bootstrap, MessageExtractor design for sharding, and DistributedPubSub patterns. Triggers when adding cluster membership, ShardRegion, ShardCoordinator, ClusterSingleton, or Replicator usage./atomr-persistenceUse when adding event sourcing to an actor in a project that depends on atomr. Covers the Eventsourced trait, journals, snapshots, recovery, RecoveryPermitter, AsyncSnapshotter, and choosing a storage adapter (sql / redis / mongodb / cassandra / aws / azure). Triggers when implementing PersistentActor or Eventsourced, configuring a Journal/SnapshotStore, or wiring a backend./atomr-testingUse when writing tests against atomr actors using atomr-testkit. Covers TestKit, TestProbe (expect_msg / receive_n / expect_no_msg / expect_msg_pf), and the virtual-time TestScheduler. Triggers when authoring `#[tokio::test]` cases that exercise actors, mailboxes, or scheduled timers./atomr-troubleshootingUse when diagnosing failures in a project that depends on atomr. Covers compile-time errors (missing feature flags, wrong prelude), runtime issues (mailbox stalls, restart loops, ask timeouts), and cluster-level problems (split-brain, unreachable members). Triggers on atomr error messages, missing-symbol errors, hangs, or repeated restarts.