API reference#

This is the curated reference for tractor’s public surface: the names you can import and lean on without reading runtime internals. Everything below is re-exported at the top level (import tractor) unless a page says otherwise; subsystems like tractor.msg, tractor.trionics, tractor.to_asyncio, tractor.devx and tractor.log are importable as submodules.

tractor is “just trio” extended across processes: every API here is designed to keep the structured concurrency (SC) rules you already know from the trio docs intact across the process boundary. If a name isn’t documented here it’s an internal — expect it to change without notice B).

Most-used names at a glance:

open_root_actor

Initialize the tractor runtime by starting a "root actor" in a parent-most Python process.

open_nursery

Create and yield a new ActorNursery to be used for spawning structured concurrent subactors.

run_daemon

Spawn a root (daemon) actor which will respond to RPC; the main task simply starts the runtime and then blocks via embedded trio.sleep_forever().

ActorNursery

The fundamental actor supervision construct: spawn and manage explicit lifetime and capability restricted, bootstrapped, trio.run() scheduled sub-processes.

Portal

A 'portal' to a memory-domain-separated Actor.

context

Mark an async function as an SC-supervised, inter-Actor, RPC scheduled child-side Task, IPC endpoint otherwise known more colloquially as a (RPC) "context".

Context

An inter-actor, SC transitive, trio.Task (pair) communication context.

MsgStream

A bidirectional message stream for receiving logically sequenced values over an inter-actor IPC Channel.

open_actor_cluster

find_actor

Ask the registrar to find actor(s) by name.

wait_for_actor

Wait on at least one peer actor to register name with the registrar, yield a Portal to the first registree.

get_registry

Return a portal instance connected to a local or remote registry-service actor; if a connection already exists re-use it (presumably to call a .register_actor() registry runtime RPC ep).

current_actor

Get the process-local actor instance.

current_ipc_ctx

is_root_process

get_runtime_vars

Deliver a copy of the current Actor's "runtime variables".

RemoteActorError

A box(ing) type which bundles a remote actor BaseException for (near identical, and only if possible,) local object/instance re-construction in the local process memory domain.

ContextCancelled

Inter-actor task context was cancelled by either a call to Portal.cancel_actor() or Context.cancel().

MsgTypeError

Equivalent of a runtime TypeError for IPC dialogs.

pause

A pause point (more commonly known as a "breakpoint") interrupt instruction for engaging a blocking debugger instance to conduct manual console-based-REPL-interaction from within tractor's async runtime, normally from some single-threaded and currently executing actor-hosted-trio-task in some (remote) process.

post_mortem

Our builtin async equivalient of pdb.post_mortem() which can be used inside exception handlers.

Channel

An inter-process channel for communication between (remote) actors.

Where to next? If you’re new, start with the runtime and spawning APIs in Runtime and spawning, then graduate to the inter-actor task linking model in Contexts and streaming — it’s the heart of the whole system.