validate_script
Validates scripts against RunWhen contract, checking main function, output format, and extracting environment variables to prevent runtime errors.
Instructions
Validate a script against the RunWhen contract before running it.
Checks that the script follows the required structure (main function, correct output format, etc.) and extracts referenced environment variables.
Task scripts must return/write issues with keys: 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps', and optionally 'issue observed at'.
Script-source parameter matrix (provide exactly one):
Variant | Best for | Mode |
script | Small scripts <~5KB, readable | any |
script_base64 | Any size; safe JSON escaping | any |
script_gzip_base64 | >5KB; 3-5x denser than b64 | any |
script_path | Local file, raw text | stdio only |
script_base64_path | Local file containing base64 blob | stdio only |
Skill: runwhen-skill://build-runwhen-task (full authoring workflow).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | No | The full script source code (raw text). | |
| task_type | No | 'task' (returns issues) or 'sli' (returns 0-1 metric). | 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. | |
| script_base64 | No | UTF-8 script as standard base64. Prefer over inline 'script' when JSON-escaping multiline content is error-prone. Mutually exclusive with the other script_* params. | |
| script_base64_path | No | Local file path to a file containing the base64-encoded script. **stdio mode only.** Convenient when the agent has already written the encoded script to a scratch file. Mutually exclusive with the other script_* params. | |
| script_gzip_base64 | No | UTF-8 script as base64(gzip(...)). Best inline option for scripts >5KB — typically 3-5x denser than 'script_base64'. Encode with: base64.b64encode(gzip.compress(script.encode())).decode(). Mutually exclusive with the other script_* params. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |