Execute an autonomous browsing goal against a URL and stream live events. Each SSE event is re-emitted on stdout as a single JSON line so a caller (subagent, TUI, etc.) can display progress as it arrives.
Requires: TINYFISH_API_KEY environment variable.
[ -n "$TINYFISH_API_KEY" ] && echo "TINYFISH_API_KEY is set" || echo "TINYFISH_API_KEY is NOT set"
If the key is not set, stop and ask the user to add it. Get one at
scripts/agent-run.sh <url> <goal>
Example:
scripts/agent-run.sh https://scrapeme.live/shop "Extract the first 2 product names and prices. Return JSON."
Under the hood this POSTs to https://agent.tinyfish.ai/v1/automation/run-sse with:
{
"url": "https://scrapeme.live/shop",
"goal": "Extract the first 2 product names and prices. Return JSON."
}
and the header X-API-Key: $TINYFISH_API_KEY.
One JSON object per line on stdout:
{"type":"STARTED","run_id":"abc123"}
{"type":"PROGRESS","run_id":"abc123","purpose":"Navigating to https://scrapeme.live/shop"}
{"type":"PROGRESS","run_id":"abc123","purpose":"Reading product list"}
{"type":"COMPLETE","run_id":"abc123","status":"COMPLETED","result":{...}}
A caller can:
PROGRESS.purpose as a live status line.purpose against Navigating to and surface the URL to an embedded browser view.COMPLETE.result for the final payload.STARTED — {type, run_id} — emitted once when the run begins.PROGRESS — {type, run_id, purpose} — one per agent step. purpose is a short human-readable description.COMPLETE — {type, run_id, status, result} — emitted once when the run finishes. status is typically COMPLETED.共 1 个版本