# Isolation and sandboxes

> Where a node runs and where its code runs: workers in the service process or in their own thread, expressions in a separate JavaScript context, code nodes in their own context or process.

Source: https://docs.sommatic.ai/en/workflows/lifecycle/isolation/ (updated 2026-11-26)

Node workers run inside the orchestrator process: the Link Loom SDK's default isolation (`process`). Each step gets a
new worker instance that only sees the context it receives (`ctx`), never another step's memory, and is removed when
the step ends. The SDK also has a threaded mode (one worker thread and V8 heap per worker), but workflow nodes do not
use it: in that mode the worker's result does not travel back to the engine.

Expressions are evaluated apart from the worker's own code: each node resolves its `{{ }}` values in a **separate
JavaScript context** (a `vm` context of its own), with only the variables and helpers of the
[expression API](https://docs.sommatic.ai/en/expressions/reference.md), no `require`, `process`, network or timers, and 100 ms per expression. The
code nodes also run their program in a context of their own: `code.js` in a separate `vm` context with its own time
limit, `code.python` in a separate process (see [Code nodes](https://docs.sommatic.ai/en/expressions/code-nodes.md)).

## Summary

| What runs           | Where                                               | Limit                                |
| ------------------- | --------------------------------------------------- | ------------------------------------ |
| The node's worker   | The orchestrator process, one new instance per step | The node's own timeouts              |
| `{{ }}` expressions | A separate JavaScript (`vm`) context per node       | 100 ms per expression                |
| `code.js`           | A separate `vm` context (default)                   | Its `timeout_ms`, 5000 ms by default |
| `code.python`       | A separate Python process                           | Its own timeout                      |

What an expression can read and call is listed in the [expression API reference](https://docs.sommatic.ai/en/expressions/reference.md), and what
it cannot (Node APIs, network, timers) in [JavaScript Globals](https://docs.sommatic.ai/en/expressions/reference/javascript-globals.md#unavailable).

## Next steps

- [Drafts and versions](https://docs.sommatic.ai/en/workflows/lifecycle/versions.md): From draft to an immutable version, and which mode runs what.
- [Runs and their statuses](https://docs.sommatic.ai/en/workflows/lifecycle/runs.md): The statuses of a run and of its result.
- [How a node runs](https://docs.sommatic.ai/en/workflows/lifecycle/node-execution.md): Each node is a Link Loom worker: spawn, activate, stop.
- [Worker state machine](https://docs.sommatic.ai/en/workflows/lifecycle/worker-states.md): Seven states, nine events and the hook each transition runs.
- [When a node fails](https://docs.sommatic.ai/en/workflows/lifecycle/failures.md): Error port or crash, and how each one ends the run.
