Run Python

action_run_python · action · Utility · Available · v1.1.0

Description

Execute Python in an isolated Docker sandbox (512MB RAM, 1 CPU core, no privileges, read-only FS) with matplotlib/numpy/pandas/scipy/plotly/pillow/sympy/openpyxl available, plus requests/httpx when network is explicitly allowed. Output: stdout, stderr, exit code and generated files (charts, CSVs).

⚙️ Configuration parameters

Fields shown in the editor when configuring the node. Generated directly from the NodeDefconfigFields.

FieldTypeRequiredDefaultDescription
code
Codice Python
codeyesimport json, os data = json.loads(os.environ.get("FLOWFORGE_INPUT", "{}")) print({"received_keys": list(data.keys()), "count": len(data)}) Codice Python. Input del nodo precedente disponibile in env var FLOWFORGE_INPUT (JSON string). Output stdout viene catturato e parsato come JSON se possibile, altrimenti tornato come stringa. Per output file (grafici/CSV) salva in cartella output/. Esempio: plt.savefig("output/chart.png"). Con allowNetwork=true: import requests; r=requests.get("https://api.esempio.it/x", timeout=10); print(r.json()).
timeoutMs
Timeout (ms)
numberno30000Tempo massimo esecuzione. Min 5000, max 120000. Default 30s.
parseStdoutJson
Parse stdout come JSON
booleannotrueSe on, prova a parsare stdout come JSON e ritorna l'oggetto strutturato. Se off o parsing fail, ritorna stdout come stringa.
allowNetwork
Abilita egress Internet (HTTP outbound)
booleannofalseOFF (default, raccomandato): nessun egress, sandbox massimamente isolata. ON (opt-in): il codice può chiamare API HTTP esterne (requests/httpx). SSRF block automatico verso cloud metadata (169.254.169.254) + RFC1918 + loopback + reti Docker interne. Ogni esecuzione con ON viene auditata nel log dedicato code-runner. Per task production-grade preferisci action_http_request (più ergonomico + circuit breaker per host).

💡 Configuration example

JSON snippet of the node as it appears in the workflow. Values are derived fromdefaultValue and from required parameters.

{
  "id": "node-action_run_python-1",
  "defId": "action_run_python",
  "label": "Run Python",
  "config": {
    "code": "import json, os\n\ndata = json.loads(os.environ.get(\"FLOWFORGE_INPUT\", \"{}\"))\nprint({\"received_keys\": list(data.keys()), \"count\": len(data)})\n",
    "timeoutMs": 30000,
    "parseStdoutJson": true,
    "allowNetwork": false
  }
}

🔗 Related nodes in the same category

Ready to use Run Python?

Available now on all FlowForge plans. Try it free without a credit card.

Start freeBrowse all nodes