Out-of-Process Workers (Python, TypeScript, C# source)
"Out-of-process" means outside the WorkManager.Runtime process that hosts the worker: the Runtime's engine starts one child process per worker and talks to it over a socket. The worker still belongs to that Runtime pod; the WorkManager itself runs no worker code.
Three engines run their worker in a child process of the Runtime:
| Engine | MIME types | Child process |
|---|---|---|
PythonEngine |
text/x-python, application/x-python (wheel) |
python3 (Python 3.14 in the Runtime image) running the engine's bootstrap |
TypeScriptEngine |
text/x-typescript, application/x-npm |
node running the engine's worker-bridge.mts |
CSharpSourceEngine |
text/x-csharp |
CSharpSource.Bridge, a self-contained .NET process that compiles the source with Roslyn |
The compiled engines, .NET DLL (in-process) and native, run inside the Runtime process instead.
Architecture
flowchart LR
subgraph POD["Runtime pod"]
subgraph RT["Runtime process"]
A["Worker actor"] --> E["Engine<br/>(SubprocessEngineBase)"]
end
subgraph CH["Child process"]
B["Bridge, one per worker<br/>(bootstrap, worker-bridge.mts,<br/>CSharpSource.Bridge)"] --> W["Worker code"]
end
E <-->|"Unix domain socket<br/>binary frames, protobuf CloudEvents"| B
end
- One child process per worker, started when the worker's code is loaded and kept for the worker's lifetime: no process start per event.
- One protocol for all three. The engine binds a Unix domain socket and
starts the child with its path; the child connects and the two exchange
length-prefixed binary frames (
SubprocessFrames). Events cross as the worker wire protocol, a protobufCloudEventin and a protobufCloudEventBatchout, as for every other engine. The frames, their order and their timeouts are in the reference: Subprocess engines: the frames and Start and stop. - The worker keeps its context. Its host calls (publish, status, state, secrets) travel back over the same socket and are carried out by the Runtime against the worker's context, while an event is in flight.
- The Runtime looks after the child. It pings an idle child every 10 s, replaces one that exits or stops answering, and starts the worker again in the new process with the same context.
Why a child process
- The Runtime cannot run this code itself. It is a NativeAOT binary: no
Python interpreter, no JavaScript engine and no JIT to load code compiled at
run time. C# source is compiled by Roslyn and needs a JIT, so it runs in the
CSharpSource.Bridgeprocess. (Compiled DLLs go the other way: the Runtime embeds a CoreCLR for them, see in-process workers.) - Each language keeps its own ecosystem. A Python wheel's dependencies are
installed with
uv, a TypeScript worker's with npm, a C# source worker's#r "nuget: …"packages with the DLL engine's NuGet installer, each when the worker is loaded.
What you get
- Fault isolation from the Runtime. A worker that crashes or hangs takes down its own child process, not the Runtime pod and the other workers on it. The Runtime replaces the process and starts the worker again. Memory is still shared: a child that grows without bound uses the pod's memory limit.
- Independent workers. Every worker has its own interpreter or runtime and its own module state; nothing one worker sets globally reaches another.
- Any code the language allows. Third-party Python and npm packages, C# source that references NuGet packages, without packaging a worker for the Runtime's own process.
What you give up
- A round trip per call. Each call crosses the socket and is encoded and
decoded on both sides. Without batching that is one round trip per event; with
batchinga whole batch is oneprocessbatchframe and one answer (batched delivery). For bulk input the worker's own code is then the limit: Python and TypeScript workers took 100,000 events at about 14,000 events/s locally (process events in bulk). - Memory and start-up per worker. Every worker is a process of its own, with its own interpreter or runtime in memory, and loading one starts that process (and installs its dependencies on a cold cache). Typical start-up figures per engine are in Performance Characteristics.
- One event at a time per worker. The engine sends one request at a time to its child; parallelism comes from several workers, not from one worker's process.
Isolation is not a sandbox
The child process is a separate process, not a separate security boundary. It runs in the Runtime's container, as the same user, with the same file system view and network access. A worker can therefore read what the Runtime can read and reach what the Runtime can reach.
- No engine restricts what a worker imports or calls: a Python worker can use
os,subprocessorsocketlike any other module, a TypeScript worker any Node API, a C# source worker any .NET API.
Run only code you trust in these engines, as in every other engine. The platform's view on worker isolation is in Security.
Where the details are
| Topic | Reference |
|---|---|
| Frame layout, frame types, host calls, health check | Subprocess engines: the frames |
| Start and stop, timeouts, restarts | Start and stop |
| Python: source and wheels, dependencies, internals | PythonEngine, Python Engine Internals |
| TypeScript: modules, npm packages, type stripping | TypeScriptEngine |
C# source: #r "nuget: …", compilation, host-shared assemblies |
CSharpSourceEngine |