browserbase-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBrowserbase CLI
Browserbase CLI
Use the official CLI for Browserbase platform operations, Functions workflows, and Fetch API calls.
bb使用官方 CLI来执行Browserbase平台操作、Functions工作流以及Fetch API调用。
bbSetup check
安装检查
Before using the CLI, verify it is installed:
bash
which bb || npm install -g @browserbasehq/cli
bb --helpFor authenticated commands, set the API key:
bash
export BROWSERBASE_API_KEY="your_api_key"If using or , also set:
bb functions devbb functions publishbash
export BROWSERBASE_PROJECT_ID="your_project_id"使用CLI前,请确认已安装:
bash
which bb || npm install -g @browserbasehq/cli
bb --help对于需要认证的命令,请设置API密钥:
bash
export BROWSERBASE_API_KEY="your_api_key"如果使用或,还需设置:
bb functions devbb functions publishbash
export BROWSERBASE_PROJECT_ID="your_project_id"When to use this skill
适用场景
Use this skill when the user wants to:
- run Browserbase commands through
bb - scaffold, develop, publish, or invoke Browserbase Functions
- inspect or manage Browserbase sessions, projects, contexts, or extensions
- fetch a page through Browserbase without opening a browser session
- search the web through Browserbase without opening a browser session
- open the Browserbase dashboard from the terminal
当用户需要以下操作时,使用本技能:
- 通过运行Browserbase命令
bb - 搭建、开发、发布或调用Browserbase Functions
- 查看或管理Browserbase会话、项目、上下文或扩展
- 无需打开浏览器会话即可通过Browserbase获取页面
- 无需打开浏览器会话即可通过Browserbase搜索网页
- 从终端打开Browserbase控制台
When not to use this skill
不适用场景
- For interactive browsing, page inspection, screenshots, clicking, typing, or login flows, prefer the skill.
browser - For simple HTTP content retrieval where the user does not care about using the CLI specifically, the dedicated skill is often a better fit.
fetch - Use only when the user explicitly wants the CLI wrapper or is already working in a
bb browse ...-centric workflow.bb
- 对于交互式浏览、页面检查、截图、点击、输入或登录流程,优先使用技能。
browser - 对于不关心是否使用CLI的简单HTTP内容获取,专用的技能通常更合适。
fetch - 仅当用户明确需要CLI包装器或已在以为中心的工作流中操作时,才使用
bb。bb browse ...
Command selection
命令选择
- for local dev, packaging, publishing, and invocation
bb functions - ,
bb sessions,bb projects,bb contextsfor Browserbase platform resourcesbb extensions - for Fetch API requests
bb fetch <url> - for Search API requests
bb search "<query>" - to open Browserbase Overview locally
bb dashboard - to forward to the standalone
bb browse ...binary (requiresbrowse)@browserbasehq/browse-cli - to install Browserbase agent skills for Claude Code
bb skills install
- :用于本地开发、打包、发布和调用
bb functions - 、
bb sessions、bb projects、bb contexts:用于管理Browserbase平台资源bb extensions - :用于发送Fetch API请求
bb fetch <url> - :用于发送Search API请求
bb search "<query>" - :在本地打开Browserbase概览页面
bb dashboard - :转发至独立的
bb browse ...二进制文件(需安装browse)@browserbasehq/browse-cli - :为Claude Code安装Browserbase agent技能
bb skills install
Common workflows
常见工作流
Functions
Functions
bash
bb functions init my-function
cd my-function
bb functions dev index.ts
bb functions publish index.ts
bb functions invoke <function_id> --params '{"url":"https://example.com"}'Use to poll an existing invocation instead of creating a new one.
bb functions invoke --check-status <invocation_id>bash
bb functions init my-function
cd my-function
bb functions dev index.ts
bb functions publish index.ts
bb functions invoke <function_id> --params '{"url":"https://example.com"}'使用来轮询现有调用,而非创建新调用。
bb functions invoke --check-status <invocation_id>Platform APIs
平台API
bash
bb projects list --json
bb sessions get <session_id> --json
bb sessions downloads get <session_id> --output session-artifacts.zip
bb contexts create --body '{"region":"us-west-2"}' --json
bb extensions upload ./my-extension.zip --jsonbash
bb projects list --json
bb sessions get <session_id> --json
bb sessions downloads get <session_id> --output session-artifacts.zip
bb contexts create --body '{"region":"us-west-2"}' --json
bb extensions upload ./my-extension.zip --jsonFetch API
Fetch API
bash
bb fetch https://example.com --json
bb fetch https://example.com --allow-redirects --output page.htmlbash
bb fetch https://example.com --json
bb fetch https://example.com --allow-redirects --output page.htmlSearch API
Search API
bash
bb search "browser automation" --json
bb search "web scraping" --num-results 5 --json
bb search "AI agents" --output results.jsonbash
bb search "browser automation" --json
bb search "web scraping" --num-results 5 --json
bb search "AI agents" --output results.jsonDashboard
控制台
bash
bb dashboardbash
bb dashboardBest practices
最佳实践
- Prefer and subgroup
bb --helpbefore guessing flags.--help - Use dash-case flags exactly as shown in CLI help.
- Prefer when the result may need follow-up parsing.
--json - Use environment variables for auth unless the user explicitly wants one-off overrides.
- Pass structured request bodies with JSON strings in or
--body.--params - Remember that uses
bb functions ..., while platform API commands use--api-url.--base-url - If fails because
bb browseis missing, either installbrowseor switch to the@browserbasehq/browse-cliskill.browser
- 在猜测参数前,优先使用及子命令的
bb --help。--help - 严格按照CLI帮助中所示使用短横线命名(dash-case)的参数。
- 当结果可能需要后续解析时,优先使用参数。
--json - 除非用户明确要求一次性覆盖,否则使用环境变量进行认证。
- 在或
--body中通过JSON字符串传递结构化请求体。--params - 注意使用
bb functions ...,而平台API命令使用--api-url。--base-url - 如果因缺少
bb browse而失败,可安装browse或切换至@browserbasehq/browse-cli技能。browser
Troubleshooting
故障排除
- Missing API key: set or pass
BROWSERBASE_API_KEY--api-key - Missing project ID on or
bb functions dev: setbb functions publishor passBROWSERBASE_PROJECT_ID--project-id - Unknown flag: rerun the relevant command with and use the exact dash-case form
--help - install error: run
bb browsenpm install -g @browserbasehq/browse-cli
For command-by-command reference and more examples, see REFERENCE.md.
- 缺少API密钥:设置或传递
BROWSERBASE_API_KEY参数--api-key - 使用或
bb functions dev时缺少项目ID:设置bb functions publish或传递BROWSERBASE_PROJECT_ID参数--project-id - 未知参数:重新运行相关命令并添加,使用正确的短横线命名形式
--help - 安装错误:运行
bb browsenpm install -g @browserbasehq/browse-cli
如需逐命令参考及更多示例,请查看REFERENCE.md。