@@ -45,6 +45,61 @@ agent-device click @e3
4545agent-device close
4646```
4747
48+ ## Fast batching for agents (JSON steps)
49+
50+ Use ` batch ` to execute multiple commands in a single daemon request.
51+
52+ CLI examples:
53+
54+ ``` bash
55+ agent-device batch \
56+ --session sim \
57+ --platform ios \
58+ --udid 00008150-001849640CF8401C \
59+ --steps-file /tmp/batch-steps.json \
60+ --json
61+ ```
62+
63+ ``` bash
64+ cat /tmp/batch-steps.json | agent-device batch \
65+ --session sim \
66+ --platform ios \
67+ --udid 00008150-001849640CF8401C \
68+ --steps-stdin \
69+ --json
70+ ```
71+
72+ Small inline payloads are also supported:
73+
74+ ``` bash
75+ agent-device batch --steps ' [{"command":"open","positionals":["settings"]},{"command":"wait","positionals":["100"]}]'
76+ ```
77+
78+ Batch payload format:
79+
80+ ``` json
81+ [
82+ { "command" : " open" , "positionals" : [" settings" ], "flags" : {} },
83+ { "command" : " wait" , "positionals" : [" label=\" Privacy & Security\" " , " 3000" ], "flags" : {} },
84+ { "command" : " click" , "positionals" : [" label=\" Privacy & Security\" " ], "flags" : {} },
85+ { "command" : " get" , "positionals" : [" text" , " label=\" Tracking\" " ], "flags" : {} }
86+ ]
87+ ```
88+
89+ Batch response includes:
90+
91+ - ` total ` , ` executed ` , ` totalDurationMs `
92+ - per-step ` results[] ` with ` durationMs `
93+ - failure context with failing ` step ` and ` partialResults `
94+
95+ Agent usage guidelines:
96+
97+ - Keep each batch to one screen-local workflow.
98+ - Add sync guards (` wait ` , ` is exists ` ) after mutating steps (` open ` , ` click ` , ` fill ` , ` swipe ` ).
99+ - Treat refs/snapshot assumptions as stale after UI mutations.
100+ - Prefer ` --steps-file ` or ` --steps-stdin ` over inline JSON for reliability.
101+ - Keep batches moderate (about 5-20 steps) and stop on first error.
102+
48103## CLI Usage
49104
50105``` bash
@@ -84,6 +139,7 @@ agent-device swipe 540 1500 540 500 120 --count 8 --pause-ms 30 --pattern ping-p
84139
85140## Command Index
86141- ` boot ` , ` open ` , ` close ` , ` reinstall ` , ` home ` , ` back ` , ` app-switcher `
142+ - ` batch `
87143- ` snapshot ` , ` find ` , ` get `
88144- ` click ` , ` focus ` , ` type ` , ` fill ` , ` press ` , ` long-press ` , ` swipe ` , ` scroll ` , ` scrollintoview ` , ` pinch ` , ` is `
89145- ` alert ` , ` wait ` , ` screenshot `
@@ -114,6 +170,11 @@ Flags:
114170- ` --pattern one-way|ping-pong ` repeat pattern for ` swipe `
115171- ` --verbose ` for daemon and runner logs
116172- ` --json ` for structured output
173+ - ` --steps <json> ` batch: JSON array of steps
174+ - ` --steps-file <path> ` batch: read step JSON from file
175+ - ` --steps-stdin ` batch: read step JSON from stdin
176+ - ` --on-error stop ` batch: stop when a step fails
177+ - ` --max-steps <n> ` batch: max allowed steps per request
117178
118179Pinch:
119180- ` pinch ` is supported on iOS simulators.
0 commit comments