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:
Initialize the tractor runtime by starting a "root actor" in a parent-most Python process. |
|
Create and yield a new |
|
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(). |
|
The fundamental actor supervision construct: spawn and manage explicit lifetime and capability restricted, bootstrapped, |
|
A 'portal' to a memory-domain-separated Actor. |
|
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". |
|
An inter-actor, SC transitive, trio.Task (pair) communication context. |
|
A bidirectional message stream for receiving logically sequenced values over an inter-actor IPC Channel. |
|
Ask the registrar to find actor(s) by name. |
|
Wait on at least one peer actor to register name with the registrar, yield a Portal to the first registree. |
|
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). |
|
Get the process-local actor instance. |
|
Deliver a copy of the current Actor's "runtime variables". |
|
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. |
|
Inter-actor task context was cancelled by either a call to |
|
Equivalent of a runtime TypeError for IPC dialogs. |
|
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. |
|
Our builtin async equivalient of pdb.post_mortem() which can be used inside exception handlers. |
|
An inter-process channel for communication between (remote) actors. |
Reference pages
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.