---
title: Script run action
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/utils/script-run
---

This page provides a comprehensive reference for the `script.run` action available in the workflow automation actions catalog. This action enables you to execute Python scripts within your workflows for data transformation, processing, and custom operations.

## Run a script [#script-run]

Execute a python script and returns the response to a workflow.

### Inputs

| Input Field    | Optionality | Type   | Description                             | Example                                        |
| -------------- | ----------- | ------ | --------------------------------------- | ---------------------------------------------- |
| **script**     | Required    | String | Any data transformation script          | ```yaml script: |   print("Hello, World!") ``` |
| **runtime**    | Required    | Enum   | Run time version of script              | `PYTHON_3_13`                                  |
| **parameters** | Optional    | List   | list of parameters to be used in script | `parameters: ["--a", "10", "--b", "5"]`        |

### Outputs

| Output Field     | Datatype | Examples                                              |
| ---------------- | -------- | ----------------------------------------------------- |
| **success**      | Boolean  | `true/false`                                          |
| **payload**      | Object   | `"sessionId": "7fa97f26-3791-492e-a39b-53793163dfb9"` |
| **errorMessage** | String   | `parsing error at line 9"`                            |

### Example

| Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: script-workflow  steps:   - name: runScript     type: action     action: script.run     version: 1     inputs:       script: |         import json         import argparse          p = argparse.ArgumentParser()         p.add_argument("--a", type=int, required=True)         p.add_argument("--b", type=int, required=True)         args = p.parse_args()         # Data transformation: output original, squared, and sum         result = {             "original": {"a": args.a, "b": args.b},             "transformed": {"a_squared": args.a ** 2, "b_squared": args.b ** 2},             "sum": args.a + args.b         }         print(json.dumps(result))       parameters: ["--a", "10", "--b", "5"]       runtime: PYTHON_3_13   - name: logOutput     type: action     action: newrelic.ingest.sendLogs     version: 1     inputs:       logs:         - message: "Hello from script testing : ${{ .steps.runScript.outputs.payload  }}" ``` |

## What script.run can do

### Supported python version

-   PYTHON_3_13 runtime with full language features

### Allowed imports

```yaml
"python-dateutil",
"simplejson",
"re",
"math",
"decimal",
"json",
"datetime",
"collections",
"itertools",
"functools",
"operator",
"string",
"argparse"
```

### Data handling

-   Parse and transform JSON data structures
-   Process complex strings and perform text manipulation
-   Format output as tables, markdown, or structured data

### Parameter Passing

-   Pass simple values via command-line arguments with argparse

## What script.run cannot do

### Restricted imports

-   `base64` - Not allowed for security reasons
-   `sys` - Not allowed for security reasons
-   `os` - System operations restricted
-   Most third-party libraries not included in Python 3.13 stdlib

### Parameter limitations

-   Cannot pass strings with special characters via parameters

### Network/External access

-   No network calls or external API access
-   No file system access outside script execution
