Metadata-Version: 2.4
Name: webpilot-cli
Version: 0.1.4
Summary: pip launcher for the WebPilot browser agent (npm package: @capagents/webpilot)
Author: CLI-Agents
License: MIT
Keywords: webpilot,browser,agent,cli,opentui
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"

# WebPilot

Browser agent CLI. Type a goal; [browser-use](https://github.com/browser-use/browser-use) 0.13.10 drives Chrome, then WebPilot writes a replayable Playwright spec.

The engine is the browser-use service from test-agent-nexus, copied into this package (`py/webpilot_engine`). It keeps the nexus behaviour: error-recovery system prompt, fast-mode agent tuning, Chrome launch flags, the search/select loop breaker, the 600 s run timeout, `browser-use-v2-compact` workflow YAML with semantic locators, and the Playwright codegen. There is no dependency on test-agent-nexus, FastAPI, or a database.

The shell is [OpenTUI](https://opentui.com). Headless `run` is for CI. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) and [HOW_TO_USE.md](HOW_TO_USE.md).

## Install

OpenTUI needs **Bun 1.3+**. Node cannot load the native renderer. Live runs also need **uv** or **Python 3.11+** for the browser-use engine.

The CLI is published on **npm** as `@capagents/webpilot`. **PyPI** package `webpilot-cli` is a pip launcher for the same `webpilot` command.

```bash
curl -fsSL https://bun.sh/install | bash
curl -LsSf https://astral.sh/uv/install.sh | sh   # recommended for the engine

npm install -g @capagents/webpilot
# or
pip install webpilot-cli

webpilot setup   # optional: the first live run does this too
```

`webpilot setup` creates `~/.webpilot/engine/.venv` with browser-use 0.13.10. It uses installed Google Chrome, or installs Chromium when Chrome is missing. `WEBPILOT_PYTHON` points WebPilot at an existing Python that already has browser-use.

From this repo:

```bash
cd WebPilot
bun install
bun src/index.ts init
bun src/index.ts start
```

One-shot release (same version on both registries; assumes `npm` and `twine` are already logged in):

```bash
./scripts/publish.sh           # current version
./scripts/publish.sh 0.2.0     # bump + publish
./scripts/publish.sh --dry-run # pack only
```

## Configure

`init` writes:

| File | Purpose |
|------|---------|
| `webpilot.yaml` | Browser, prompts, export, active profile |
| `llms.json` | Named LLM profiles (azure, openai, ollama, openai_compatible, mock) |
| `.env.example` | API key names |

```bash
webpilot models
webpilot run --goal "Read the homepage" --url https://example.com --profile mock --plain
```

`mock` is an offline demo on a synthetic page: no engine, browser, or model. Pick a live profile (Tab in the shell, or `llm.active`) for a real run.

## CLI

```bash
webpilot start
webpilot start -g "Go to booking.com and search hotels in Mumbai" -p azure-gpt4o

webpilot run --goal "Get a quote" --url https://example.com --profile azure-gpt4o --headed
webpilot run --goal "..." --url https://example.com --profile mock --plain --out ./out/demo
```

Inside the shell: `/url`, `/goal`, `/run`, `/stop`, `/headed`, `/steps`, `/profile`, `/export`, `/exit`. A line without a slash is the goal and starts the run; the agent chooses which site to open. `/url` only pins a start page.
