Code
Run sandboxed Python to transform data or emit JSON.
Runs a Python function on the frame, in a sandbox.
The escape hatch for what the primitives do not cover. The body must define run(inputs) and return a dict; inputs["data"] is the in-port and the returned output and json keys become the out-ports. timeoutSeconds bounds it — the sandbox has no network and no filesystem.
At a glance
Module type
Code
Category
Intelligence
Default tier
reactive
Runs on
reactive, durable
Starts a flow
no
Holds a body
no
Keeps state between runs
no
Available in
every application type
Parameters
code
string · required · defaults to "def run(inputs):\n df = inputs.get(\"data\")\n return {\"output\": df}\n"
The Python to run. Must define run(inputs) and return a dict of port id to value.
timeoutSeconds
number · required · defaults to 30
Seconds the sandbox is allowed before the run is killed; the handler clamps it to 1-120.
Inputs
on
event
no
Implicit on every module that does not itself start a flow: wire an event here to make this module the start of what that event runs.
data
dataframe
no
The frame to work on; unconnected, run receives no data key.
Outputs
output
dataframe
dataframe, signal
The output key of what run returned, as a frame.
json
json
json, scalar, signal
The json key of what run returned, for anything that is not tabular.
Last updated

