# Agent Browser

Adopt this skill: https://proskills.md/skills/other/szsip239-teamclaw-data-skills-agent-browser

Page: https://proskills.md/skills/other/szsip239-teamclaw-data-skills-agent-browser
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: data/skills/agent-browser/SKILL.md
size: 10224
sha: 85d1ac3f8ff15ae56ff539168bd6dc44d027d3a7
upstream: https://github.com/szsip239/teamclaw/blob/main/data/skills/agent-browser/SKILL.md

````text
---
name: Agent Browser
description: A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and snapshot pages via structured commands.
read_when:
  - Automating web interactions
  - Extracting structured data from pages
  - Filling forms programmatically
  - Testing web UIs
metadata: {"clawdbot":{"emoji":"🌐","requires":{"bins":["node","npm"]}}}
allowed-tools: Bash(agent-browser:*)
---

# Browser Automation with agent-browser

## Installation

### npm recommended

```bash
npm install -g agent-browser
agent-browser install
agent-browser install --with-deps
```

### From Source

```bash
git clone https://github.com/vercel-labs/agent-browser
cd agent-browser
pnpm install
pnpm build
agent-browser install
```

## Quick start

```bash
agent-browser open <url>        # Navigate to page
agent-browser snapshot -i       # Get interactive elements with refs
agent-browser click @e1         # Click element by ref
agent-browser fill @e2 "text"   # Fill input by ref
agent-browser close             # Close browser
```

## Core workflow

1. Navigate: `agent-browser open <url>`
2. Snapshot: `agent-browser snapshot -i` (returns elements with refs like `@e1`, `@e2`)
3. Interact using refs from the snapshot
4. Re-snapshot after navigation or significant DOM changes

## Commands

### Navigation

```bash
agent-browser open <url>      # Navigate to URL
agent-browser back            # Go back
agent-browser forward         # Go forward
agent-browser reload          # Reload page
agent-browser close           # Close browser
```

### Snapshot (page analysis)

```bash
agent-browser snapshot            # Full accessibility tree
agent-browser snapshot -i         # Interactive elements only (recommended)
agent-browser snapshot -c         # Compact output
agent-browser snapshot -d 3       # Limit depth to 3
agent-browser snapshot -s "#main" # Scope to CSS selector
```

### Interactions (use @refs from snapshot)

```bash
agent-browser click @e1           # Click
agent-browser dblclick @e1        # Double-click
agent-browser focus @e1           # Focus element
agent-browser fill @e2 "text"     # Clear and type
agent-browser type @e2 "text"     # Type without clearing
agent-browser press Enter         # Press key
agent-browser press Control+a     # Key combination
agent-browser keydown Shift       # Hold key down
agent-browser keyup Shift         # Release key
agent-browser hover @e1           # Hover
agent-browser check @e1           # Check checkbox
agent-browser uncheck @e1         # Uncheck checkbox
agent-browser select @e1 "value"  # Select dropdown
agent-browser scroll down 500     # Scroll page
agent-browser scrollintoview @e1  # Scroll element into view
agent-browser drag @e1 @e2        # Drag and drop
agent-browser upload @e1 file.pdf # Upload files
```

### Get information

```bash
agent-browser get text @e1        # Get element text
agent-browser get html @e1        # Get innerHTML
agent-browser get value @e1       # Get input value
agent-browser get attr @e1 href   # Get attribute
agent-browser get title           # Get page title
agent-browser get url             # Get current URL
agent-browser get count ".item"   # Count matching elements
agent-browser get box @e1         # Get bounding box
```

### Check state

```bash
agent-browser is visible @e1      # Check if visible
agent-browser is enabled @e1      # Check if enabled
agent-browser is checked @e1      # Check if checked
```

### Screenshots & PDF

```bash
agent-browser screenshot          # Screenshot to stdout
agent-browser screenshot path.png # Save to file
agent-browser screenshot --full   # Full page
agent-browser pdf output.pdf      # Save as PDF
```

### Video recording

```bash
agent-browser record start ./demo.webm    # Start recording (uses current URL + state)
agent-browser click @e1                   # Perform actions
agent-browser record stop                 # Stop and save video
agent-browser record restart ./take2.webm # Stop current + start new recording
```

Recording creates a fresh context but preserves cookies/storage from your session. If no URL is provided, it automatically returns to your current page. For smooth demos, explore first, then start recording.

### Wait

```bash
agent-browser wait @e1                     # Wait for element
agent-browser wait 2000                    # Wait milliseconds
agent-browser wait --text "Success"        # Wait for text
agent-browser wait --url "/dashboard"    # Wait for URL pattern
agent-browser wait --load networkidle      # Wait for network idle
agent-browser wait --fn "window.ready"     # Wait for JS condition
```

### Mouse control

```bash
agent-browser mouse move 100 200      # Move mouse
agent-browser mouse down left         # Press button
agent-browser mouse up left           # Release button
agent-browser mouse wheel 100         # Scroll wheel
```

### Semantic locators (alternative to refs)

```bash
agent-browser find role button click --name "Submit"
agent-browser find text "Sign In" click
agent-browser find label "Email" fill "user@test.com"
agent-browser find first ".item" click
agent-browser find nth 2 "a" text
```

### Browser settings

```bash
agent-browser set viewport 1920 1080      # Set viewport size
agent-browser set device "iPhone 14"      # Emulate device
agent-browser set geo 37.7749 -122.4194   # Set geolocation
agent-browser set offline on              # Toggle offline mode
agent-browser set headers '{"X-Key":"v"}' # Extra HTTP headers
agent-browser set credentials user pass   # HTTP basic auth
agent-browser set media dark              # Emulate color scheme
```

### Cookies & Storage

```bash
agent-browser cookies                     # Get all cookies
agent-browser cookies set name value      # Set cookie
agent-browser cookies clear               # Clear cookies
agent-browser storage local               # Get all localStorage
agent-browser storage local key           # Get specific key
agent-browser storage local set k v       # Set value
agent-browser storage local clear         # Clear all
```

### Network

```bash
agent-browser network route <url>              # Intercept requests
agent-browser network route <url> --abort      # Block requests
agent-browser network route <url> --body '{}'  # Mock response
agent-browser network unroute [url]            # Remove routes
agent-browser network requests                 # View tracked requests
agent-browser network requests --filter api    # Filter requests
```

### Tabs & Windows

```bash
agent-browser tab                 # List tabs
agent-browser tab new [url]       # New tab
agent-browser tab 2               # Switch to tab
agent-browser tab close           # Close tab
agent-browser window new          # New window
```

### Frames

```bash
agent-browser frame "#iframe"     # Switch to iframe
agent-browser frame main          # Back to main frame
```

### Dialogs

```bash
agent-browser dialog accept [text]  # Accept dialog
agent-browser dialog dismiss        # Dismiss dialog
```

### JavaScript

```bash
agent-browser eval "document.title"   # Run JavaScript
```

### State management

```bash
agent-browser state save auth.json    # Save session state
agent-browser state load auth.json    # Load saved state
```

## Example: Form submission

```bash
agent-browser open https://example.com/form
agent-browser snapshot -i
# Output shows: textbox "Email" [ref=e1], textbox "Password" [ref=e2], button "Submit" [ref=e3]

agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "password123"
agent-browser click @e3
agent-browser wait --load networkidle
agent-browser snapshot -i  # Check result
```

## Example: Authentication with saved state

```bash
# Login once
agent-browser open https://app.example.com/login
agent-browser snapshot -i
agent-browser fill @e1 "username"
agent-browser fill @e2 "password"
agent-browser click @e3
agent-browser wait --url "/dashboard"
agent-browser state save auth.json

# Later sessions: load saved state
agent-browser state load auth.json
agent-browser open https://app.example.com/dashboard
```

## Sessions (parallel browsers)

```bash
agent-browser --session test1 open site-a.com
agent-browser --session test2 open site-b.com
agent-browser session list
```

## JSON output (for parsing)

Add `--json` for machine-readable output:

```bash
agent-browser snapshot -i --json
agent-browser get text @e1 --json
```

## Debugging

```bash
agent-browser open example.com --headed              # Show browser window
agent-browser console                                # View console messages
agent-browser console --clear                        # Clear console
agent-browser errors                                 # View page errors
agent-browser errors --clear                         # Clear errors
agent-browser highlight @e1                          # Highlight element
agent-browser trace start                            # Start recording trace
agent-browser trace stop trace.zip                   # Stop and save trace
agent-browser record start ./debug.webm              # Record from current page
agent-browser record stop                            # Save recording
agent-browser --cdp 9222 snapshot                    # Connect via CDP
```

## Troubleshooting

- If the command is not found on Linux ARM64, use the full path in the bin folder.
- If an element is not found, use snapshot to find the correct ref.
- If the page is not loaded, add a wait command after navigation.
- Use --headed to see the browser window for debugging.

## Options

- --session <name> uses an isolated session.
- --json provides JSON output.
- --full takes a full page screenshot.
- --headed shows the browser window.
- --timeout sets the command timeout in milliseconds.
- --cdp <port> connects via Chrome DevTools Protocol.

## Notes

- Refs are stable per page load but change on navigation.
- Always snapshot after navigation to get new refs.
- Use fill instead of type for input fields to ensure existing text is cleared.

## Reporting Issues

- Skill issues: Open an issue at https://github.com/TheSethRose/Agent-Browser-CLI
- agent-browser CLI issues: Open an issue at https://github.com/vercel-labs/agent-browser
````

## File: data/skills/agent-browser/CONTRIBUTING.md
size: 1626
sha: d44561a6abd5bb424fbc2ae11480b64e42bd148d
upstream: https://github.com/szsip239/teamclaw/blob/main/data/skills/agent-browser/CONTRIBUTING.md

````text
# Contributing to Agent Browser Skill

This skill wraps the agent-browser CLI. Determine where the problem lies before reporting issues.

## Issue Reporting Guide

### Open an issue in this repository if

- The skill documentation is unclear or missing
- Examples in SKILL.md do not work
- You need help using the CLI with this skill wrapper
- The skill is missing a command or feature

### Open an issue at the agent-browser repository if

- The CLI crashes or throws errors
- Commands do not behave as documented
- You found a bug in the browser automation
- You need a new feature in the CLI

## Before Opening an Issue

1. Install the latest version
   ```bash
   npm install -g agent-browser@latest
   ```

2. Test the command in your terminal to isolate the issue

## Issue Report Template

Use this template to provide necessary information.

```markdown
### Description
[Provide a clear and concise description of the bug]

### Reproduction Steps
1. [First Step]
2. [Second Step]
3. [Observe error]

### Expected Behavior
[Describe what you expected to happen]

### Environment Details
- **Skill Version:** [e.g. 1.0.2]
- **agent-browser Version:** [output of agent-browser --version]
- **Node.js Version:** [output of node -v]
- **Operating System:** [e.g. macOS Sonoma, Windows 11, Ubuntu 22.04]

### Additional Context
- [Full error output or stack trace]
- [Screenshots]
- [Website URLs where the failure occurred]
```

## Adding New Commands to the Skill

Update SKILL.md when the upstream CLI adds new commands.
- Keep the Installation section
- Add new commands in the correct category
- Include usage examples
````

## File: README.md
upstream: https://github.com/szsip239/teamclaw/blob/main/README.md

````text
<p align="center">
  <img src="docs/screenshots/cover.png" alt="TeamClaw Cover" width="800">
</p>

<p align="center">
  <h1 align="center">TeamClaw</h1>
  <p align="center">Enterprise AI Agent Operations Platform</p>
  <p align="center">企业级多实例 · 多租户 · 多 Agent · 多 Runtime 管理平台</p>
</p>

<p align="center">
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
  <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D20-green.svg" alt="Node.js"></a>
  <a href="https://github.com/szsip239/teamclaw/releases"><img src="https://img.shields.io/github/v/release/szsip239/teamclaw" alt="Release"></a>
</p>

<p align="center">
  <a href="#中文">中文</a> | <a href="#english">English</a>
</p>

---

<a id="中文"></a>

## TeamClaw 是什么？

TeamClaw 是面向企业内部 AI Agent 落地的 operations control plane。它把 runtime 实例、Agent、Skills、模型资源、知识库、权限、审计和对话体验收口到一个多租户平台里，让团队可以在同一套界面里管理多个实例、多个部门、多个 Agent 和多个 runtime。

[OpenClaw](https://github.com/anthropics/openclaw)、Pi 和后续 runtime 在 TeamClaw 中都是可插拔执行引擎。用户可以在 Chat 输入区切换普通/快速模式，平台层负责模型资源同步、会话隔离、文件产物、权限、审计和运维。

### v0.6.0 更新重点

- **多 Runtime Chat**：OpenClaw-compatible runtime 与 Pi runtime 在同一对话界面切换，支持 runtime 图标、当前模型展示和后台运行状态。
- **Pi Agent Runtime**：新增 Pi 会话、流式回复、图表/文件产物、模型配置同步和安全 gateway 接入。
- **OpenClaw 6.6 / v4 协议**：锁定 v4 gateway 协议，重构工具过程、阶段回复、隐藏 thinking 和错误结束状态。
- **文件产物稳定化**：生成文件归一化到 session output，重名自动编号，send/history/queue 共用下载链接补全与去重路径。
- **模型与资源同步**：支持 provider variants、OpenClaw/Pi 模型推送，并可在推送时选择 `low / medium / xhigh` 思考档位。
- **Agent 工作台体验**：Agent 长按重命名、运行中指示、未读/错误状态、后台对话完成提醒和最近会话排序修复。

### 核心能力

- 多实例和多租户：托管 Docker 实例、外部 gateway、部门隔离、RBAC、审计日志。
- 多 Agent 工作台：跨实例 Agent 浏览、创建、克隆、重命名、文件编辑和运行状态展示。
- Chat 体验：流式回复、工具过程、阶段回复、图片附件、文件下载、后台完成提醒。
- Skills 管理：ClawHub 搜索、安装、升级、本地编辑和实例自动发现。
- 模型资源：Provider variants、API Key 加密存储、默认模型、OpenClaw/Pi 同步推送。
- 知识库：PDF/DOCX/Excel 上传，Postgres FTS + pgvector + RRF 混合检索，PDF 页码预览。
- 工具箱：法规追踪、舆情监控等企业辅助工具入口。

## 快速开始

> TeamClaw 依赖 PostgreSQL、Redis、RAG service 和 Docker socket，**不支持**单独 `docker run` 启动。生产或试用请优先使用 `setup.sh`。

### 生产/试用部署

前置要求：

- Docker 与 Docker Compose v2
- `git`、`openssl`、`curl`
- Linux 上运行脚本的用户需要能访问 Docker daemon

```bash
git clone https://github.com/szsip239/teamclaw.git
cd teamclaw
bash setup.sh
```

`setup.sh` 会完成：

- 从 `.env.example` 创建 `.env`
- 只在空值或占位符时生成 JWT、加密密钥、数据库密码、RAG 内部密钥和初始管理员密码；复跑时保留已有值
- 自动设置 `TEAMCLAW_DATA_DIR`，Linux 下自动检测 `DOCKER_GID`
- 可选配置 Nginx HTTPS
- 启动 `docker-compose.prod.yml`，运行数据库迁移和 seed
- 检查 Web 服务是否可访问

访问 `http://localhost:3100`。初始管理员邮箱和密码会在 `setup.sh` 完成时打印，也会写入 `.env`：

- `INITIAL_ADMIN_EMAIL`
- `INITIAL_ADMIN_PASSWORD`

### 手动生产部署

仅当你不想使用交互式脚本时使用。请先准备好 `.env` 中的密钥、端口和数据目录：

```bash
cp .env.example .env
node scripts/generate-keys.mjs --write
# 编辑 .env：TEAMCLAW_DATA_DIR、可选 Nginx 证书配置

docker compose -f docker-compose.prod.yml up -d --build
docker compose -f docker-compose.prod.yml logs -f app
```

启用 Nginx HTTPS 时，把证书放到 `nginx/cert/`，设置 `.env` 中的 `NGINX_*`，再启动：

```bash
docker compose -f docker-compose.prod.yml --profile nginx up -d --build
```

如果目标主机已有其他反向代理占用 `80/443`，不要直接启用 TeamClaw 的 nginx profile。应改用现有反向代理转发到 TeamClaw app 端口，或设置不冲突的 `NGINX_HTTP_PORT` / `NGINX_HTTPS_PORT`。

### 本地开发

推荐用 Docker 起基础服务，Next.js 在宿主机开发：

```bash
git clone https://github.com/szsip239/teamclaw.git
cd teamclaw
cp .env.example .env
node scripts/generate-keys.mjs --write

docker compose up -d
npm install
npx prisma generate
npx prisma db push
npx tsx prisma/seed.ts
npm run dev
```

访问 `http://localhost:3100`。如果希望 app 也在 Docker 内运行：

```bash
docker compose --profile app up -d --build
```

### 首次使用流程

1. 进入 **资源管理**，创建模型资源并设置默认模型。
2. 进入 **实例管理**，创建 Docker 实例或接入外部 gateway。默认普通 runtime 镜像是 `alpine/openclaw:2026.6.6-browser`。
3. 实例上线后进入 **AI 对话**，选择 Agent 开始对话。
4. 需要知识库时，在 **知识库** 页面配置 RAG LLM、Embedding、Rerank 和 PaddleOCR。
5. 需要 Skills 时，在 **Skills 管理** 中搜索、安装或编辑。

### 用户必须关心的配置

| 配置                                                    | 说明                                                                            |
| ------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `JWT_PRIVATE_KEY` / `JWT_PUBLIC_KEY` / `ENCRYPTION_KEY` | `setup.sh` 或 `node scripts/generate-keys.mjs --write` 生成；上线后不要随意轮换 |
| `POSTGRES_PASSWORD` / `RAG_SERVICE_SECRET`              | `setup.sh` 或 `node scripts/generate-keys.mjs --write` 生成；不要使用固定公开值 |
| `INITIAL_ADMIN_EMAIL` / `INITIAL_ADMIN_PASSWORD`        | 只在首次 seed 创建管理员时使用；已有管理员复跑时不会被重置                      |
| `TEAMCLAW_DATA_DIR`                                     | 托管 runtime 的宿主机数据目录，必须是绝对路径                                   |
| `DOCKER_SOCKET_PATH` / `DOCKER_GID`                     | TeamClaw 管理 Docker runtime 所需；`setup.sh` 会尽量自动检测                    |
| `DEFAULT_OPENCLAW_IMAGE`                                | 新建普通 runtime 的默认镜像，默认 `alpine/openclaw:2026.6.6-browser`            |

更细的 RAG 并发、OCR、Embedding 维度和模型预算参数请看 `.env.example`；多数用户应该优先在后台 UI 配置。

## 系统架构

```mermaid
graph TB
    Browser["Browser / PWA"]
    Next["Next.js App"]
    PG["PostgreSQL + pgvector"]
    Redis["Redis"]
    RAG["RAG Service"]
    Docker["Docker Engine"]
    OC["OpenClaw-compatible Runtime"]
    PI["Pi Runtime"]
    External["External Gateway"]

    Browser --> Next
    Next --> PG
    Next --> Redis
    Next --> RAG
    RAG --> PG
    Next -. container lifecycle .-> Docker
    Docker --> OC
    Docker --> PI
    Next -- WebSocket --> OC
    Next -- WebSocket --> PI
    Next -- WebSocket --> External
```

### 技术栈

| 层级       | 技术                                               |
| ---------- | -------------------------------------------------- |
| Web        | Next.js 16, React 19, Tailwind CSS 4, shadcn/ui    |
| 状态与数据 | Zustand, TanStack Query, Prisma                    |
| 存储       | PostgreSQL 17 + pgvector, Redis 7                  |
| RAG        | Python FastAPI, asyncpg, tsvector, pgvector, jieba |
| 通信       | WebSocket gateway, Pi wrapper, Docker API          |
| 安全       | RS256 JWT, bcryptjs, 加密存储资源密钥              |

## 界面截图

<table>
  <tr>
    <td align="center"><img src="docs/screenshots/dashboard.png" width="400"><br><b>仪表盘</b></td>
    <td align="center"><img src="docs/screenshots/chat.png" width="400"><br><b>AI 对话</b></td>
  </tr>
  <tr>
    <td align="center"><img src="docs/screenshots/agents.png" width="400"><br><b>Agent 管理</b></td>
    <td align="center"><img src="docs/screenshots/skills.png" width="400"><br><b>Skills 管理</b></td>
  </tr>
  <tr>
    <td align="center"><img src="docs/screenshots/instances.png" width="400"><br><b>实例管理</b></td>
    <td align="center"><img src="docs/screenshots/config-editor.png" width="400"><br><b>配置编辑器</b></td>
  </tr>
</table>

## 贡献

详见 [CONTRIBUTING.md](CONTRIBUTING.md)，了解开发环境搭建、代码规范和 PR 流程。

## 许可证

[MIT](LICENSE)

---

<a id="english"></a>

## What is TeamClaw?

TeamClaw is an enterprise operations control plane for internal AI Agent deployments. It brings runtime instances, agents, skills, model resources, knowledge bases, permissions, audit logs, and chat workflows into one multi-tenant platform.

[OpenClaw](https://github.com/anthropics/openclaw), Pi, and future engines are pluggable runtimes in TeamClaw. Users can switch between normal and fast runtime modes in the chat composer, while the platform manages model sync, sessions, artifacts, permissions, audit logs, and operations.

### v0.6.0 Highlights

- **Multi-runtime Chat**: OpenClaw-compatible and Pi runtimes share one chat surface with runtime icons, model display, and background status.
- **Pi Agent Runtime**: Added Pi sessions, streaming replies, charts/file artifacts, model config sync, and secured gateway access.
- **OpenClaw 6.6 / v4 protocol**: Locked to gateway protocol v4 and refactored tool progress, staged replies, hidden thinking, and error completion states.
- **Reliable artifacts**: Generated files are normalized into session output, duplicate filenames are auto-numbered, and send/history/queue share
````
