feat: add batch command for multi-step workflows (#865)

Add `batch` command that reads a JSON array of commands from stdin
and executes them sequentially against the daemon. This avoids
per-command process startup overhead when AI agents run multi-step
browser workflows.

Supports --bail to stop on first error (default: continue all)
and --json for structured output as an array of results.

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-03-17 08:48:50 -05:00
committed by GitHub
co-authored by Matt Van Horn Claude Opus 4.6
parent a865dd56e0
commit 7734bb2702
5 changed files with 234 additions and 1 deletions
+19
View File
@@ -187,6 +187,25 @@ agent-browser wait "#spinner" --state hidden
**Load states:** `load`, `domcontentloaded`, `networkidle`
### Batch Execution
Execute multiple commands in a single invocation by piping a JSON array of
string arrays to `batch`. This avoids per-command process startup overhead
when running multi-step workflows.
```bash
# Pipe commands as JSON
echo '[
["open", "https://example.com"],
["snapshot", "-i"],
["click", "@e1"],
["screenshot", "result.png"]
]' | agent-browser batch --json
# Stop on first error
agent-browser batch --bail < commands.json
```
### Clipboard
```bash