browser-use--browser-harness
5ab5a958bb
* add remote browser support via Browser Use cloud + multi-daemon HARNESLESS_NAME suffixes socket/pid/log — daemons are independent, no supervisor. start_remote_daemon() creates a Browser Use cloud browser and launches a daemon attached to it; kill_daemon() stops both. Local Chrome path is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * rename env vars to BU_ prefix (shorter, less noisy in tool calls) HARNESLESS_NAME → BU_NAME HARNESLESS_CDP_WS → BU_CDP_WS HARNESLESS_REMOTE_BROWSER_ID → BU_BROWSER_ID Socket/pid/log files keep the harnesless- prefix on disk so they're recognizable in /tmp. BROWSER_USE_API_KEY unchanged (external convention). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * rename project from harnesless to bu Socket/pid/log paths now /tmp/bu-<name>.{sock,pid,log}. pyproject package name updated, uv.lock regenerated. Slash command now /bu. Note: the repo directory itself is still named harnesless on disk. Rename manually (mv harnesless bu) so the absolute paths in docs line up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
52 行
1.4 KiB
Markdown
52 行
1.4 KiB
Markdown
# bu
|
|
|
|
LLM-first browser control via CDP. No CLI, no wrappers, just Python and CDP.
|
|
|
|
## Setup
|
|
|
|
1. Install deps (uses `uv`):
|
|
```
|
|
uv sync
|
|
```
|
|
|
|
2. Enable Chrome remote debugging: open `chrome://inspect/#remote-debugging`, check the box. Chrome now listens at `127.0.0.1:9222`.
|
|
|
|
3. (Optional) For remote browsers: `cp .env.example .env` and fill in `BROWSER_USE_API_KEY`.
|
|
|
|
4. Start the daemon:
|
|
```
|
|
uv run daemon.py &
|
|
```
|
|
|
|
## Usage
|
|
|
|
```
|
|
uv run run.py <<'PY'
|
|
goto("https://example.com")
|
|
wait(1)
|
|
screenshot("/tmp/shot.png")
|
|
print(page_info())
|
|
PY
|
|
```
|
|
|
|
Parallel agents / remote browsers: `BU_NAME=<n> uv run run.py`. See `SKILL.md`.
|
|
|
|
Read `SKILL.md` for the full LLM workflow. Read `AGENTS.md` if you're an agent working ON this codebase (extending helpers, debugging the daemon). Read `helpers.py` for every function — they're all ~5 lines each and you can edit any of them.
|
|
|
|
## Files
|
|
|
|
- `daemon.py` — holds the WebSocket, listens on `/tmp/bu-<name>.sock`
|
|
- `helpers.py` — ~250 lines of transparent helpers
|
|
- `run.py` — 3 lines: `from helpers import *; exec(stdin)`
|
|
- `SKILL.md` — how an agent *uses* bu to drive a browser
|
|
- `AGENTS.md` — how an agent *modifies* bu (code structure, extension points)
|
|
|
|
## Stop
|
|
|
|
```
|
|
uv run python -c "from helpers import kill_daemon; kill_daemon()" # default daemon
|
|
uv run python -c "from helpers import kill_daemon; kill_daemon('work')" # named daemon (also stops remote browser)
|
|
# or
|
|
pkill -f bu/daemon.py
|
|
```
|