run_script
Run deterministic multi-step browser scripts with loops, conditionals, and error handling on a cloned tab to automate repetitive page operations.
Instructions
Execute a deterministic multi-step script without per-step LLM round-trips, running on a cloned browser tab. Scripts support loops (for/while/forEach), conditionals (if/else), error handling (try/catch), parallel branches, and variable capture. Returns a script_id immediately — use wait_for_scripts to collect results. Provide either an inline script definition or a name to load a previously saved script. Use when you detect a repetitive pattern (same operation on 3+ pages/items).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limits | No | Override default execution limits. Keys: max_steps (int), max_timeout_secs (int), max_output_bytes (int), max_parallel_branches (int), per_step_timeout_secs (int). | |
| name | No | Name of a previously saved script to run (alternative to inline 'script'). Mutually exclusive with 'script' — provide one or the other. | |
| save_as | No | Save the script under this name after execution for future reuse (alphanumeric + underscore). Persists to ~/.acrawl/scripts/<name>.json. | |
| script | No | Inline script definition object. Must include: version ("1.0"), steps (array of node objects: ToolCall, Assign, Collect, Yield, ForLoop, ForEach, WhileLoop, IfElse, TryCatch, Parallel), and optional limits. Use instead of 'name' for new scripts. |