cli-and-sessions
Use the persistent browser-use/bu CLI for browser automation, named sessions, profiles, cloud connect, tunnels, config, doctor/setup/init, and CLI failure recovery.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- cli-and-sessions
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use the persistent browser-use/bu CLI for browser automation, named sessions, profiles, cloud connect, tunnels, config, doctor/setup/init, and CLI failure recovery.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/cli-reference.md9.8 KB
- 参考文档references/session-recipes.md8.8 KB
- 参考文档references/troubleshooting.md10.1 KB
- 脚本scripts/cli_smoke.sh2.5 KB
03 SKILL.md 正文
CLI and Sessions
Use this sub-skill when the user wants terminal-first Browser Use automation: browser-use or bu commands, persistent browser sessions, local/remote Chrome connection, cloud browser connection from the CLI, template generation, config, setup/doctor checks, tunnels, profile sync, or browser-use python.
Route First
- Use this sub-skill for CLI commands, daemon/session lifecycle,
browser-use cloud ...,browser-use tunnel,browser-use profile,browser-use config,browser-use doctor,browser-use setup,browser-use init, andbrowser-use python. - Route Python
Agent(...)workflows,agent.run(), history objects, callbacks, prompt design, and initial actions to../agent-programming/SKILL.md. - Route Python
Browser,BrowserSession,BrowserProfile, CDP/profile/session constructor parameters, downloads, HAR/video, domain filters, and direct browser control to../browser-control/SKILL.md. - Route custom actions, default tool behavior inside an Agent, file tools, sensitive data, and tool validation to
../tools-and-actions/SKILL.md. - Route LLM provider selection,
ChatBrowserUse, model credentials for Agents, structured output, extraction LLMs, and cost tracking to../llm-and-output/SKILL.md. - Route production
@sandbox, PythonBrowser(use_cloud=True), MCP deployment, skills loading, telemetry, and broader cloud integrations to../production-integrations/SKILL.md.
Safe Defaults
- Prefer
browser-usein docs and scripts;bu,browseruse, andbrowserare aliases for the same fast CLI entrypoint. - Start with help-only validation before launching browsers:
browser-use --help,browser-use init --help,browser-use cloud v2 --help, thenbrowser-use doctorif environment checks are acceptable. - Use
--jsonfor coding-agent parsers when command output must be consumed programmatically. - Use named sessions for parallel work:
browser-use --session NAME ...; names should contain only letters, digits, hyphens, and underscores. - Close sessions explicitly with
browser-use --session NAME closeorbrowser-use close --allto avoid stale daemons. - Do not paste real API keys into logs. For cloud CLI, use
browser-use cloud login <key>orbrowser-use config set api_key "$BROWSER_USE_API_KEY"; the CLI reads cloud API keys from its config file, not directly fromBROWSER_USE_API_KEY. - Use
BROWSER_USE_HOMEonly for isolation/testing; otherwise the CLI stores state under the user’s Browser Use home.
Install and Health Checks
uv pip install "browser-use[cli]"
browser-use install
browser-use doctor
browser-use installinstalls Chromium through Playwright and includes Linux system dependencies when needed.browser-use setupcreates CLI home/config state, offers Chromium/profile-use/cloudflared setup, and prints config status.browser-use setup --yesis suitable for non-interactive setup when the user approved dependency installation.browser-use doctorchecks package import, browser profile availability, network connectivity,cloudflared, andprofile-use.- If only command availability needs verification, run
scripts/cli_smoke.sh --help-onlyfrom this sub-skill.
Core Browser Commands
browser-use open https://example.com
browser-use state
browser-use click 5
browser-use input 3 "john@example.com"
browser-use keys "Enter"
browser-use screenshot page.png
browser-use close
openauto-prefixes plain domains withhttps://.stateprints page/viewport/scroll details plus indexed interactive elements; rerun it after navigation or page mutation because indices can change.clickaccepts either one element index or two pixel coordinates:browser-use click 5orbrowser-use click 120 240.inputclicks an indexed element and clear-then-types text; pass""when you need to clear only.screenshotwrites bytes to a path or emits base64 when no path is provided; use--fullfor full-page capture.- See
references/cli-reference.mdfor the command matrix.
Sessions and Browser Modes
browser-use --session work --headed open https://example.com
browser-use --session work state
browser-use sessions
browser-use --session work close
- The first command for a session starts a background daemon; subsequent commands talk to that daemon over a socket/TCP channel.
- Each named session has separate PID/socket/token/state files and keeps the browser alive across CLI calls.
--headedstarts a visible browser; omit it for headless Chromium.--profile "Default"launches real Chrome with a local profile; bare--profileusesDefault.browser-use connectdiscovers a running local Chrome CDP endpoint;--cdp-url http://...or--cdp-url ws://...connects to a known CDP endpoint.--cdp-urland--profileare mutually exclusive; cloud connect also conflicts with--connect,--cdp-url, and--profile.- See
references/session-recipes.mdfor multi-session, CDP, profile, tunnel, cloud, andpythonrecipes.
Tabs, Cookies, Waits, and Data
browser-use tab list
browser-use tab new https://example.org
browser-use tab switch 1
browser-use cookies export cookies.json
browser-use wait selector "h1" --timeout 5000
browser-use get html --selector "main"
browser-use eval "document.title"
- Use
tabsubcommands to manage pages in the current session without starting another browser. - Use
cookies get/set/clear/export/importfor session cookie state; treat exported cookie files as secrets. - Use
wait selectororwait textbefore interacting with pages that load asynchronously. - Use
get title/html/text/value/attributes/bboxfor deterministic data retrieval from the current page. - Use
evalfor JavaScript snippets; avoid evaluating untrusted code. extractexists in the CLI parser but currently returns an implementation error, so route extraction workflows to Agent/Python guidance instead.
Persistent Python Command
browser-use python "x = 42"
browser-use python "print(x)"
browser-use python "print(browser.url)"
browser-use python --vars
browser-use python --reset
browser-use python --file automate.py
- The CLI Python namespace persists per browser session and includes
json,re,os,Path,asyncio, and a synchronousbrowserwrapper. - The
browserwrapper supports common browser actions such asgoto,click,type,input,upload,scroll,screenshot,keys, and page properties likeurl,title, andhtml. - Use
browser-use pythonfor quick session automation; use../agent-programming/SKILL.mdwhen the user needs an LLM-drivenAgentscript. --filereads and executes a local Python file in the persistent namespace; review file contents before running.
Cloud CLI, Profiles, and Tunnels
browser-use cloud login <api-key>
browser-use cloud connect
browser-use state
browser-use cloud v2 GET /browsers
browser-use cloud v2 POST /tasks '{"task":"Search for AI news","url":"https://google.com"}'
browser-use cloud v2 poll <task-id>
browser-use close
cloud loginstores the API key in CLI config with restricted permissions where supported.cloud connectprovisions a cloud browser profile, starts the session daemon in cloud mode, and may print a live/CDP URL.cloud v2andcloud v3are generic REST passthroughs; 4xx responses exit with code2and may print an expected body suggestion from OpenAPI.cloud signupflows exist for account creation/claiming; do not run signup without explicit user approval.profiledelegates to the managedprofile-usebinary for local cookie/profile sync; install or update it withbrowser-use profile updatewhen doctor reports it missing.tunnel <port>starts a Cloudflare quick tunnel for local apps;tunnel list,tunnel stop <port>, andtunnel stop --allmanage tunnel processes.- For Python cloud browser parameters or
@sandbox, route to../production-integrations/SKILL.mdand../browser-control/SKILL.md.
Config and Templates
browser-use config list
browser-use config set cloud_connect_proxy us
browser-use config set cloud_connect_timeout 30
browser-use config unset cloud_connect_timeout
browser-use init --list
browser-use init --template basic --output my_agent.py
- Valid config keys include
api_key,cloud_connect_profile_id,cloud_connect_proxy,cloud_connect_timeout, andcloud_connect_recording. config setvalidates known keys and coerces integer/boolean values based on the schema.initfetches template metadata/content at runtime; offline failures usually mean network/template service access is unavailable.- Use
--forceonly when the user approved overwriting an existing generated file.
Troubleshooting Protocol
- Capture the exact command, exit code, stdout/stderr, OS, shell, and whether
browser-useorbuwas used. - Run
browser-use --helpand the specific subcommand help when possible. - Run
browser-use doctorfor install/browser/network/profile/tunnel checks if safe in the environment. - Inspect active sessions with
browser-use sessions; close the affected session and retry with a fresh named session. - For config/cloud issues, run
browser-use config listand verifyapi_keyis set without printing secret values. - For page element failures, rerun
browser-use stateand update indices; page changes invalidate earlier indices. - For stale daemon/socket issues, run
browser-use --session NAME close, then retry; usebrowser-use close --allonly when the user accepts closing every CLI browser session. - Use
references/troubleshooting.mdfor symptom-specific fixes.
Verification Snippets
# Help-only smoke test; does not launch browsers or require credentials.
./scripts/cli_smoke.sh --help-only
# Isolated CLI home for a temporary session.
BROWSER_USE_HOME="$(mktemp -d)" browser-use --session smoke --json sessions
- Do not run browser-launching commands in restricted CI unless Chromium/browser dependencies are available and the user approved environment mutation.
- Do not run cloud commands that create browsers, tasks, profiles, or signup accounts without explicit user approval.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).