Python Script
Run custom Python script inside an Isolated Sandbox.
About this Node
Executes a versioned Python script inside an Isolated Sandbox with read access to workflow inputs and mounted `FileRef` objects. The script reads values from the `inputs` dictionary (with `inputs["input"]` mapped from `input_key` plus every other non-internal scoped state key) and assigns results into `outputs`, which are written back to workflow state under `output_key`.
Ports & Branches
inPort 0Inbound execution flowoutPort 1Outbound execution flow with script resultHow this Node Reads Data
| Input | Access | Field | Example | Description |
|---|---|---|---|---|
| Sandbox `inputs` Dictionary | Python Context | — |
payload = inputs["input"]; tier = inputs.get("customer_tier") |
Receives `inputs["input"]` from `input_key` along with all other non-internal scoped state keys. Any `FileRef` values are automatically staged on disk inside the sandbox. |
State Keys Written (Outputs)
| Key Pattern | Type | Role | Description |
|---|---|---|---|
{output_key} |
object | any |
Primary | Clean serialized contents written to the script's `outputs` dictionary (default key `python_result`), including any newly produced `FileRef` artifacts. |
Tips & Best Practices
- Scripts are version-pinned in Project Storage so production runs remain reproducible.
- Keep scripts deterministic and bounded by `timeout_seconds` (default 300s).
Commonly Paired With
Settings Parameters (2)
Configuration schema synchronized with the workflow catalog
| Field | Type | Default | Allowed Options | Description |
|---|---|---|---|---|
script_uuid |
string |
— |
— | UUID of the versioned Python script |
script_version |
string |
— |
— | Active version of the script |
Normalize Nested JSON for Downstream Templates
Flatten nested fields from an HTTP API response so downstream template nodes can reference simple top-level keys.
Node Configuration
{
"Id": "action_python_1",
"Type": "action_python",
"Config": {
"script_uuid": "script-normalize-order",
"script_version": "v1"
}
}Sample Input State
{
"input": { "order": { "id": "ORD-9", "items": [{"sku": "A1"}, {"sku": "B2"}] } }
}Expected Output State
{
"python_result": { "order_id": "ORD-9", "item_count": 2 }
}Tip: Remember that `{{key}}` templates match top-level keys; use Python Script to reshape or aggregate nested payloads.
Transform Parquet/CSV Dataset FileRef
Read a staged `FileRef` produced by Dataset Read, compute KPI summaries with pandas, and emit tabular rows for Dataset Write.
Node Configuration
{
"Id": "action_python_1",
"Type": "action_python",
"Config": {
"script_uuid": "script-kpi-rollup",
"script_version": "v2"
}
}Sample Input State
{
"input": { "type": "file_ref", "filename": "sales_2026.parquet" }
}Expected Output State
{
"python_result": [ { "region": "NA", "revenue": 420000 } ]
}