run_script
Execute a script on a RunWhen runner for testing. Returns a run ID to monitor execution and retrieve results.
Instructions
Execute a script on a RunWhen runner for testing.
Sends the script to the workspace's runner at the specified location. Returns a run ID that can be used with get_run_status and get_run_output to monitor execution and retrieve results.
The script must follow the RunWhen contract:
Python task: define main() returning List[Dict] with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.
Python SLI: define main() returning a float 0-1.
Bash task: define main() writing issue JSON array to FD 3 (>&3).
Bash SLI: define main() writing a metric float to FD 3.
Provide exactly one of: script | script_base64 | script_gzip_base64 | script_path (stdio) | script_base64_path (stdio). Use script_gzip_base64 for scripts >5KB to maximise transport headroom.
Use validate_script first to check compliance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | No | The full script source code (raw text). | |
| env_vars | No | Environment variables (e.g. {'NAMESPACE': 'default'}). | |
| location | No | Runner location (use get_workspace_locations). | |
| run_type | No | 'task' or 'sli'. | task |
| interpreter | No | 'bash' or 'python'. | bash |
| script_path | No | Local file path to read the script from. **stdio mode only.** Mutually exclusive with the other script_* params. | |
| secret_vars | No | Secret mappings (e.g. {'kubeconfig': 'kubeconfig'}). | |
| script_base64 | No | UTF-8 script as standard base64. Prefer over inline 'script' when JSON-escaping multiline content is error-prone. | |
| workspace_name | Yes | The workspace to run in (e.g. 't-oncall'). | |
| script_base64_path | No | Local file path to a file containing the base64-encoded script. **stdio mode only.** | |
| script_gzip_base64 | No | UTF-8 script as base64(gzip(...)). Best inline option for scripts >5KB — 3-5x denser than 'script_base64'. Encode with: base64.b64encode(gzip.compress(script.encode())).decode(). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |