# Code runtimes and local worker pools

Run TypeScript, JavaScript, Python and PowerShell with explicit local pool capacity and runtime requirements.

Canonical URL: https://opennodeflow.dev/wiki/runtimes/
JSON reference: https://opennodeflow.dev/wiki/runtimes/index.json
Source snapshot: 2026-10-23

A worker is a local process executing one node attempt. Worker pools bound concurrency and allowed runtimes; they do not connect another computer or isolate untrusted code. The workflow runner and its run-concurrency limit remain separate from pool capacity.

## Select the runtime

A published node/trigger definition chooses `typescript`, `javascript`, `python` or `powershell`. Omitted runtime means TypeScript for compatibility. Existing graph instances keep their old definition pin until deliberately upgraded.

Python requires Python 3 on the hosting account's PATH. PowerShell requires PowerShell 7 through `pwsh`; version 5 is unsupported. Detect runtimes after installation or PATH changes, and verify the background host account sees the executable. Packages/modules must already be installed; ONF does not install dependencies per asset.

TypeScript/JavaScript use an async function body. Python uses the body of a synchronous function returning an output dictionary:

```python
value = inputs.get("value", 0)
context.state.set("calls", context.state.get("calls", 0) + 1)
return {"result": value * config.get("multiplier", 2)}
```

PowerShell receives `$inputs`, `$config` and `$context` as hashtables and must return exactly one hashtable:

```powershell
Write-Host 'Processing synthetic value'
$context.state.calls = 1 + [int]$context.state.calls
return @{ result = $inputs.value * $config.multiplier }
```

Python's print/stderr and PowerShell diagnostic output become logs. Multiple returned PowerShell hashtables fail. JavaScript executor adapters cannot wrap native bodies. Native code has staged state and protected secrets/connections, but no JavaScript storage/variable IPC helper; use dedicated typed nodes around it.

## Configure pools

Open Workers to inspect capabilities, pools, active attempts and queues. A pool has a stable ID, allowed runtimes, enabled flag and concurrency from 1 to 32. The initial local pool permits all four runtimes with four simultaneous attempts. Configure at most 32 pools; queued attempts are bounded.

Choose Execution → Worker pool in the node inspector. This stores `config.$workerPool`; omitted or local selects the default. Unknown, disabled or incompatible pools fail explicitly instead of silently executing elsewhere.

Reducing concurrency does not kill active work. Disabling or restricting a pool rejects queued work no longer permitted, while already running attempts settle normally. Queue waiting is cancellable. Container deadlines cover waiting and connection preparation too.

## Execution boundary

Workers use the hosting user's filesystem/network permissions and shared credential environment. Pool selection does not add tenant isolation, remote execution or a hostile-code sandbox. Native allocations do not inherit Node's V8 memory setting.

Timeout/cancellation terminates the attempt's owned process tree. Windows descendant cleanup has recorded validation; equivalent behavior on every other platform is not established. An external request may already have completed when a process is terminated.

Inspect attempts and timing in [debugging](/wiki/debugging/). Use [security](/wiki/security/) and [backup](/wiki/backup-restore/) guidance before changing the host identity or migrating pool configuration.

---

## Documentation provenance

- `docs/RUNTIMES-AND-WORKERS.md`
- `docs/AUTHORING.md`

This page describes maintained source, not a live inventory or an authorization to perform actions.
