Get Started
Script actions
Execute custom Python scripts in a sandboxed environment.
Python Script Action
Use the core.script.run_python
action to execute Python code in a sandboxed WebAssembly environment using Pyodide.
This ensures isolation from the host system while providing access to popular Python libraries.
You can include 3rd-party Python packages in your script by adding them to the dependencies
field.
- Scripts must contain at least one function
- If multiple functions exist, one must be named
main
- The function’s return value becomes the action output
- The output must be JSON serializable (e.g. str, int, float, bool, list, dict)
- Network access is disabled by default for security; enable with
allow_network: true
when using dependencies
Configuration
Field | Type | Description | Required |
---|---|---|---|
script | string | Python code with at least one function | ✅ |
inputs | object | Dictionary mapping parameter names to values for function arguments | ❌ |
dependencies | array | List of Python packages to install | ❌ |
timeout_seconds | integer | Maximum execution time (default: 30) | ❌ |
allow_network | boolean | Enable network access for package downloads (default: false) | ❌ |
inputs
are passed as function arguments into the main function- Keys must match the parameter names in the function signature
- Missing parameters will receive
None
- Functions must have parameters to receive inputs
- Extra input fields that don’t match function parameters are ignored
- If your function has
def main(name, age):
but inputs include{"name": "Alice", "age": 30, "city": "NYC"}
, thecity
field will be ignored without error.
Examples
The following examples show valid inputs for the Run Python script
action.