Browser Steel
Use Steel CLI first. Use the Python runtime only when the workflow needs selector-heavy custom logic that is awkward to express through raw CLI steps.
What CLI means here
INLINECODE1 means Command Line Interface.
In this skill, it specifically means the Steel terminal commands themselves, for example:
CODEBLOCK0
The wrapper script does not replace Steel CLI. It packages it into a more publishable, agent-friendly entrypoint:
CODEBLOCK1
So the relationship is:
- - Steel CLI = the underlying browser command system
scripts/main.py = the wrapper that calls Steel CLI by default- Python runtime = a fallback path for custom Playwright logic when CLI steps are not enough
First checks
- 1. Run the doctor command before the first real task in a new environment:
python3 {baseDir}/scripts/main.py doctor
- 2. Prefer stateless commands for one-shot extraction or capture.
- Prefer named sessions for multi-step interaction.
- Keep the same
--session value across every step in one workflow. - Never bake private cookies, profile names, or local paths into the skill itself.
Runtime selection
- -
auto: prefer installed steel, otherwise fall back to INLINECODE6 - INLINECODE7 : same as
auto, but fail if no CLI path is available - INLINECODE9 : force the Node-distributed CLI path through INLINECODE10
- INLINECODE11 : use Steel SDK + Playwright through INLINECODE12
Read references/runtime-modes.md only when runtime choice or env resolution matters.
Read references/official-docs.md when you need the authoritative Steel CLI or Playwright-Python upstream reference.
Preferred commands
Health check
CODEBLOCK3
Stateless commands
CODEBLOCK4
Named-session workflow
CODEBLOCK5
Python Playwright plan
CODEBLOCK6
Read references/python-plan.md only when the CLI path is insufficient.
Guardrails
- - Start with
scrape, screenshot, or pdf when the task is stateless. - For interactive workflows, follow
start-session -> browser commands -> stop-session. - After any navigation or meaningful DOM change, take a fresh
snapshot -i before using another @eN ref. - Keep secrets in env vars or an explicit
--env-file, not in the skill files. - Pass cookies only through
--cookies-file or STEEL_BROWSER_COOKIES_FILE. - Use the Python runtime only for tasks that genuinely benefit from custom Playwright logic.
- Record confirmed improvements in
maintenance.log.
References
- -
references/official-docs.md — upstream Steel CLI and Playwright-Python references - INLINECODE27 — runtime choice, env loading, and privacy rules
- INLINECODE28 — reliable Steel CLI patterns
- INLINECODE29 — JSON plan schema and supported actions
- INLINECODE30 — install/auth/runtime recovery
Browser Steel
优先使用Steel CLI。仅当工作流需要大量选择器的自定义逻辑,且难以通过原始CLI步骤表达时,才使用Python运行时。
此处CLI的含义
CLI指命令行界面。
在此技能中,特指Steel终端命令本身,例如:
bash
steel scrape https://example.com
steel browser start --session demo
steel browser open https://example.com --session demo
steel browser snapshot -i --session demo
包装脚本不会替代Steel CLI。它将CLI打包成更易于发布、对代理更友好的入口点:
bash
python3 {baseDir}/scripts/main.py scrape --url https://example.com
python3 {baseDir}/scripts/main.py start-session --session demo
python3 {baseDir}/scripts/main.py browser --session demo -- snapshot -i -c
因此关系如下:
- - Steel CLI = 底层浏览器命令系统
- scripts/main.py = 默认调用Steel CLI的包装器
- Python运行时 = 当CLI步骤不足时,用于自定义Playwright逻辑的回退路径
初始检查
- 1. 在新环境中执行首个实际任务前,先运行诊断命令:
bash
python3 {baseDir}/scripts/main.py doctor
- 2. 对于一次性提取或捕获,优先使用无状态命令。
- 对于多步骤交互,优先使用命名会话。
- 在同一工作流的每个步骤中保持相同的--session值。
- 切勿将私有cookies、配置文件名称或本地路径硬编码到技能本身中。
运行时选择
- - auto:优先使用已安装的steel,否则回退到npx @steel-dev/cli
- cli:与auto相同,但若无可用CLI路径则报错
- node:通过npx @steel-dev/cli强制使用Node分发的CLI路径
- python:通过run-python-plan使用Steel SDK + Playwright
仅在运行时选择或环境解析相关时,阅读references/runtime-modes.md。
当需要权威的Steel CLI或Playwright-Python上游参考时,阅读references/official-docs.md。
首选命令
健康检查
bash
python3 {baseDir}/scripts/main.py doctor
无状态命令
bash
python3 {baseDir}/scripts/main.py scrape --url https://example.com --format markdown --json
python3 {baseDir}/scripts/main.py screenshot --url https://example.com --full-page --json
python3 {baseDir}/scripts/main.py pdf --url https://example.com --json
命名会话工作流
bash
python3 {baseDir}/scripts/main.py start-session --session demo --stealth --json
python3 {baseDir}/scripts/main.py browser --session demo -- open https://example.com
python3 {baseDir}/scripts/main.py browser --session demo -- snapshot -i -c
python3 {baseDir}/scripts/main.py browser --session demo -- fill @e2 hello
python3 {baseDir}/scripts/main.py browser --session demo -- click @e5
python3 {baseDir}/scripts/main.py browser --session demo -- wait --load-state networkidle
python3 {baseDir}/scripts/main.py stop-session --session demo --json
Python Playwright计划
bash
python3 {baseDir}/scripts/main.py run-python-plan \
--plan-file {baseDir}/references/example-plan.json \
--url https://example.com
仅在CLI路径不足时,阅读references/python-plan.md。
防护措施
- - 当任务为无状态时,从scrape、screenshot或pdf开始。
- 对于交互式工作流,遵循start-session -> browser commands -> stop-session的顺序。
- 在任何导航或有意义的DOM变更后,在使用另一个@eN引用前,先获取新的snapshot -i。
- 将机密信息保存在环境变量或显式的--env-file中,而非技能文件中。
- 仅通过--cookies-file或STEELBROWSERCOOKIES_FILE传递cookies。
- 仅对真正需要自定义Playwright逻辑的任务使用Python运行时。
- 将确认的改进记录在maintenance.log中。
参考资料
- - references/official-docs.md — 上游Steel CLI和Playwright-Python参考
- references/runtime-modes.md — 运行时选择、环境加载和隐私规则
- references/cli-workflows.md — 可靠的Steel CLI模式
- references/python-plan.md — JSON计划模式和受支持的操作
- references/troubleshooting.md — 安装/认证/运行时恢复