batch command executes multiple commands in a single invocation. This reduces overhead and enables atomic workflows.
Overview
batch
Execute multiple commands from a JSON array
Batch Format
Pass a JSON array of command objects:command: Command name (e.g.,click,type,press)args: Arguments as a JSON object
Common Patterns
Stop on First Error
Continue on Errors
--stop-on-error, all commands execute regardless of failures. The response includes success/failure for each.
Examples
Fill Out Form
Multi-Step Workflow
Bulk Actions
Use Cases
Atomic Workflows
Atomic Workflows
Execute multi-step actions with rollback on failure:If any step fails, execution stops immediately.
Reduce Latency
Reduce Latency
Batch commands to minimize round-trip overhead:
Conditional Execution
Conditional Execution
Generate batch JSON dynamically based on conditions:
Scripted Automation
Scripted Automation
Build complex workflows in scripts:
Response Format
With--stop-on-error, returns the first error:
--stop-on-error, returns all results:
Supported Commands
All commands exceptbatch itself can be batched:
- Observation:
snapshot,find,screenshot,get,is,list-surfaces - Interaction:
click,type,set-value,clear,focus,select,toggle,check,uncheck,expand,collapse,scroll,scroll-to - Keyboard:
press,key-down,key-up - Mouse:
hover,drag,mouse-move,mouse-click,mouse-down,mouse-up - App/Window:
launch,close-app,list-windows,list-apps,focus-window,resize-window,move-window,minimize,maximize,restore - Clipboard:
clipboard-get,clipboard-set,clipboard-clear - Wait:
wait - System:
status,permissions,version
Error Handling
Common error codes:INVALID_ARGS: Malformed JSON or unrecognized commandSTALE_REF: Ref from previous snapshot (runsnapshotto refresh)ACTION_FAILED: OS rejected an action
--stop-on-error, the response includes command_index to identify which command failed.
All commands return structured JSON with error codes and recovery hints.