Skip to content

Start here

Python exec (sandboxed)

Run a sandboxed Python snippet over records without network access.

Run a sandboxed Python snippet over records without network access.

When to use it

Write a bounded Python transform using records as input and out as the output list. Network access and access to the host environment are unavailable. Imports are restricted; unavailable or unsupported execution is refused rather than running the code with broader access.

Add and configure

  1. Add Python exec (sandboxed) from the workflow step picker.
  2. Give the step a recognisable name and connect its required inputs.
  3. Set the options below. Nested names identify fields within an object or a list item.
  4. Validate the recipe, inspect the test result, then run it on the intended data.

The step identifier used in the editor’s code view is python_exec.

Settings

SettingAccepted valueRequiredDefaultWhat it controls
Code (code)string; minimum characters 1; maximum characters 64000No"# records is the input list[dict]; append output records to out.\n# Default: pass records through unchanged.\nout.extend(records)\n"Python source. Reads input from records (list[dict]); appends output records to out (list[dict]). Defaults to the passthrough transform (records out unchanged).
Imports (imports)list of stringNoNot specifiedOptional import statements prepended to the snippet. Restricted by the shared Tier-1 allowlist.
Memory Mb (memory_mb)integer; minimum 32; maximum 2048No256Memory limit for the restricted interpreter. Execution fails when the interpreter exceeds its allocation budget.
Timeout Seconds (timeout_seconds)number; minimum 1.0; maximum 300.0No30.0Time limit in seconds for the configured processing operation. Inspect its saved outcome before retrying after a timeout.

Inputs and outputs

DirectionPortContentRequiredMultiple records
InputsinrecordsYesYes
OutputsoutrecordsYesYes

Effects, testing, and recovery

Transforms or passes records without a declared external side effect.

The declared preview behaviour is to execute this step. Reads, processing, or model usage can therefore be real. Read dry runs before using a preview with live connections.

No duplicate-prevention key is declared for this step. Do not assume that manually repeating the step is free of repeated effects.

Example: Pass records through (the default snippet)

Step settings:

{}

Input records:

[
  {
    "id": 1
  },
  {
    "id": 2
  }
]

Expected output for this example:

[
  {
    "id": 1
  },
  {
    "id": 2
  }
]

Example: Add a computed field

Step settings:

{
  "code": "for r in records:\n    out.append({**r, 'total': r['qty'] * r['price']})\n"
}

Input records:

[
  {
    "price": 3,
    "qty": 2
  },
  {
    "price": 10,
    "qty": 1
  }
]

Expected output for this example:

[
  {
    "price": 3,
    "qty": 2,
    "total": 6
  },
  {
    "price": 10,
    "qty": 1,
    "total": 10
  }
]

Check the result

Inspect the selected run’s status, counts, errors, and output records. An empty collection can be a valid result, and a completed step can contain per-record failures where the step defines that behaviour. Check the next step’s expected record shape before publishing or delivering the result.