agent-browser Batch Automation & AI Chat

Multi-step execution with batch, natural language browser control via chat, concurrent multi-session orchestration — from single commands to automated pipelines.

16Yun Engineering TeamMay 9, 20261 min read

From Single Commands to Pipelines

Single commands are great for debugging. Production needs orchestrated multi-step workflows.

agent-browser provides two approaches: batch (parameterized) and chat (natural language).

Batch: Multi-Step in One Call

Each standalone command spawns a process — that has overhead. batch merges everything into one invocation:

# Three process launches
agent-browser open https://example.com
agent-browser fill @e3 "user@example.com"
agent-browser click @e5

# One process launch
agent-browser batch \
  "open https://example.com" \
  "fill @e3 user@example.com" \
  "click @e5"

Batch Syntax

agent-browser batch \
  "open https://example.com/login" \
  "fill @e3 admin@example.com" \
  "fill @e4 password123" \
  "click @e5" \
  "wait 2000" \
  "screenshot dashboard.png"

JSON via stdin

echo '[
  ["open", "https://example.com"],
  ["fill", "@e3", "user@example.com"],
  ["fill", "@e4", "password123"],
  ["click", "@e5"],
  ["screenshot", "result.png"]
]' | agent-browser batch --json

Error Handling

# --bail stops on first error
agent-browser batch --bail \
  "open https://example.com" \
  "click @e1" \
  "screenshot page.png"

# Without --bail, continues on error

Chat: Natural Language Browser Control

# Single instruction
agent-browser chat "open example.com and take a screenshot"

# Interactive REPL
agent-browser chat
# Chat> open example.com
# Chat> type "browser automation" into the search box
# Chat> click the search button
# Chat> get the first result title
# Chat> exit

The AI translates natural language into browser commands and executes them.

Chat Workflow

User input → AI parses intent → generates commands → executes → returns result → continue

Orchestration Patterns

Pattern 1: Scheduled Check

#!/bin/bash
SITES=(
  "https://app.example.com/dashboard"
  "https://app.example.com/api/health"
)

for site in "${SITES[@]}"; do
  agent-browser batch \
    "open $site" \
    "screenshot shots/$(basename $site)-$(date +%Y%m%d).png"
done

Pattern 2: Concurrent Multi-Session

#!/bin/bash
sites=("site-a:https://example.com/products"
       "site-b:https://example.com/products")

for entry in "${sites[@]}"; do
  name="${entry%%:*}"
  url="${entry##*:}"

  HTTP_PROXY=http://user:pass@proxy.16yun.cn:8888 \
  AGENT_BROWSER_SESSION_NAME=$name \
  agent-browser batch \
    "open $url" \
    "snapshot -i -c > data/$name-snapshot.txt" &
done
wait

Pattern 3: Data Extraction Pipeline

agent-browser batch \
  "open https://example.com" \
  "snapshot -i -c -u" \
  "eval \"JSON.stringify([...document.querySelectorAll('article h2 a')].map(a => ({title: a.textContent, url: a.href})))\""

Using with Proxies

export HTTP_PROXY=http://user:pass@proxy.16yun.cn:8888
export HTTPS_PROXY=http://user:pass@proxy.16yun.cn:8888

agent-browser batch \
  "open https://example.com" \
  "snapshot -i" \
  "screenshot target.png"

API Proxy IP Pool

#!/bin/bash
IP_LIST=$(curl -s "http://ip.16yun.cn:817/myip/pl/xxx/?s=xxx&u=user&format=json&count=10")
echo "$IP_LIST" | jq -c '.[]' | while read proxy; do
  IP=$(echo $proxy | jq -r '.ip')
  PORT=$(echo $proxy | jq -r '.port')

  HTTP_PROXY="http://user:pass@$IP:$PORT" \
  agent-browser batch \
    "open https://example.com" \
    "screenshot shots/$IP.png" &
done
wait

Performance Comparison

Method10-step execution timeBest For
Standalone x10~3-5sDebugging
batch x1~0.3-0.5sCI/CD, scheduled tasks
chat (AI)~1-2s + AI processingExploratory

Summary

MethodCommandBest For
Standaloneagent-browser open/clickDebugging
Batch (args)batch "cmd1" "cmd2"CI/CD, schedules
Batch (JSON)echo [...] | batch --jsonProgrammatic
Chatchat "description"AI Agent integration

Need an enterprise proxy plan?

We can tailor architecture to your target domains, concurrency, and reliability goals.