Chapter 04
Give every runtime a role.
Embed ordinary language code inside explicit tags. Block reads the boundary, starts the native runtime and carries compatible workflow state forward.
Shared workflow state
When a language stage completes, selected compatible values can return to the orchestrator and become available to the following stage.
PYTHONrecords[]STAGE COMPLETE
MASK / SERIALIZE / INJECTNODE.JSrecords[]STATE RECEIVED
Shared state is a transfer, not shared physical memory.
Separate native processes retain separate execution contexts. The orchestrator prepares compatible values at each boundary.
Python to JavaScript
report.blk
counter = 100
<py>
records = [12, 18, 21, 27]
average = sum(records) / len(records)
counter = counter + len(records)
</py>
<js>
const summary = {
count: counter,
average,
generatedAt: new Date().toISOString()
};
console.log(JSON.stringify(summary));
</js>01Native value02Python stage03State bridge04Node.js stage
Rules inside a block
Write ordinary language code
Inside a runtime block, follow that language's syntax, indentation and library conventions.
Keep tags balanced
Every opening runtime tag must have a matching closing tag.
Respect transfer compatibility
Prefer clear scalar and structured values when state needs to cross a runtime boundary.
Follow execution order
A later stage can use completed earlier state; an earlier stage cannot read a future result.