bailian-sandbox
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBailian Sandbox (bl sandbox
)
bl sandbox百炼沙箱(bl sandbox
)
bl sandboxBefore running , read the shared bailian-protocol for consent, high-risk confirmation, version checks, authentication, and error handling. If it is missing, stop execution and prompt the user to install the full family with .
blbl skill init运行 之前,请阅读共享的 bailian-protocol 以了解同意条款、高危确认、版本检查、身份验证和错误处理相关内容。如果缺少该协议,请停止执行并提示用户通过 安装完整套件。
blbl skill initScope and setup
适用范围与设置
- Manage Sandbox instances and templates through Bailian's E2B-compatible REST control plane. No E2B SDK or E2B API key is required; authentication uses the Bailian API Key as an Authorization Bearer token.
- Resolve Base URL through the same CLI chain as Managed Agent: >
--base-url> login/profileDASHSCOPE_BASE_URL. Use an origin such asbase_url; the CLI strips URL paths/query/fragment and appendshttps://workspace.cn-beijing.maas.aliyuncs.comfor lifecycle operations, or/api/v1/agentstudio/sandboxfor template file uploads. The saved API Key is reused. Profile capability fallback follows the shared protocol for both the key and Base URL./api/v1/agentstudio/files - If no Base URL is configured, resolve the workspace from , then
--workspace-id, then configuredBAILIAN_WORKSPACE_ID, and useworkspace_id. With a configured Base URL, the workspace flag is optional. The service currently supportshttps://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/sandboxand requires prior Sandbox SLR authorization.cn-beijing - No or local IaC state is required.
agents.yaml/getreturn instance connection information; neither opens an interactive shell or browser. For WebShell, CDP, or VNC, use that information with the runtime APIs described below. Do not inventconnect,bl sandbox exec, or browser subcommands.webshell
- 通过百炼兼容E2B的REST控制面管理Sandbox实例与模板。无需E2B SDK或E2B API密钥;身份验证使用百炼API Key作为Authorization Bearer令牌。
- Base URL的解析遵循与Managed Agent相同的CLI优先级链:>
--base-url> 登录/配置文件中的DASHSCOPE_BASE_URL。使用类似base_url的源地址;CLI会移除URL的路径/查询参数/片段,对于生命周期操作追加https://workspace.cn-beijing.maas.aliyuncs.com,对于模板文件上传追加/api/v1/agentstudio/sandbox。已保存的API Key会被复用。配置文件的能力降级规则遵循共享协议中关于密钥和Base URL的约定。/api/v1/agentstudio/files - 如果未配置Base URL,将按以下顺序解析工作空间:>
--workspace-id> 已配置的BAILIAN_WORKSPACE_ID,并使用workspace_id作为地址。如果已配置Base URL,则workspace参数为可选。该服务目前支持https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/sandbox区域,且需要提前完成Sandbox SLR授权。cn-beijing - 无需或本地IaC状态。
agents.yaml/get命令返回实例连接信息;两者都不会打开交互式Shell或浏览器。对于WebShell、CDP或VNC,请结合下述运行时API使用这些信息。请勿自行发明connect、bl sandbox exec或浏览器相关子命令。webshell
Choose the operation
选择操作
| User intent | Command family |
|---|---|
| Discover built-in base image presets | |
| Upload a local file for template mounts | |
| Inspect or create instances | |
| Connect, pause, or resume an instance | |
| Release an instance | |
| Inspect or build templates | |
| Check a submitted template build | |
| Delete a template | |
Read reference/index.md and the relevant section of reference/sandbox.md for exact flags, usage, and examples, or run the matching command with . Do not guess flags.
--helpTo save the origin in an isolated Profile, use . For a one-command override, use . Custom gateways also apply to template build-status polling.
bl auth login --config sandbox --api-key <key> --base-url <origin>bl sandbox list --base-url <origin>For built-in template images, discover the preset ID or Chinese name through , then pass it to template create/update with . This fills both and ; alone remains a display name, not an image selector. Presets override the body's image fields; explicit / override the corresponding preset fields. Presets are pinned cn-beijing image URLs, not a live catalog or an availability guarantee for other environments. Omitting does not change existing defaults or update a template's image implicitly. See the generated reference for the catalog and exact flags.
sandbox official-images--imagefromImageimageName--image-name--from-image--image-name--image| 用户意图 | 对应命令族 |
|---|---|
| 查看内置基础镜像预设 | |
| 上传本地文件用于模板挂载 | |
| 查看或创建实例 | |
| 连接、暂停或恢复实例 | |
| 释放实例 | |
| 查看或构建模板 | |
| 查看已提交的模板构建状态 | |
| 删除模板 | |
请阅读 reference/index.md 和 reference/sandbox.md 的相关章节以获取准确的参数、用法和示例,或运行对应命令并加上参数。请勿猜测参数。
--help如需将源地址保存到独立的配置文件(Profile)中,请使用 。如需单次命令覆盖,请使用 。自定义网关同样适用于模板构建状态的轮询。
bl auth login --config sandbox --api-key <key> --base-url <origin>bl sandbox list --base-url <origin>对于内置模板镜像,可通过命令查看预设ID或中文名称,然后通过参数传递给模板创建/更新命令。该参数会同时填充和;单独使用仅作为显示名称,而非镜像选择器。预设会覆盖请求体中的镜像字段;显式指定的 / 会覆盖对应的预设字段。预设是固定的cn-beijing区域镜像URL,并非实时目录,也不保证在其他环境中可用。省略不会更改现有默认值,也不会隐式更新模板的镜像。请查看生成的参考文档以获取完整目录和准确参数。
sandbox official-images--imagefromImageimageName--image-name--from-image--image-name--imageConnect to an instance
连接实例
For requests to access a running instance, open WebShell, control a browser, or show its live desktop, read assets/instance-connections.md. It contains the connection workflow, API payloads, verification steps, and official documentation links.
- Obtain fresh JSON with . Use
bl sandbox get --sandbox-id <id> --show-credentials --output jsonasenvdAccessToken; the control-plane Bailian API Key is a different credential.X-Access-Token - WebShell uses the returned and envd PTY RPCs. The official browser template uses port 3000 on
envdUrlfor CDP and VNC. These ports and paths come from the template contract, not fields returned by{port}-{sandboxID}.{domain}; do not apply them to other images without checking their documentation.get - When the user asks to open or access the instance, complete the connection and verify a terminal command or rendered browser page. Returning connection JSON or a successful health check alone does not complete that request. A local proxy URL is a host-side access page, not a URL returned by the Sandbox API.
对于访问运行中实例、打开WebShell、控制浏览器或显示实时桌面的请求,请阅读 assets/instance-connections.md。该文档包含连接流程、API请求体、验证步骤和官方文档链接。
- 使用 获取最新的JSON数据。将
bl sandbox get --sandbox-id <id> --show-credentials --output json用作envdAccessToken;控制面的百炼API Key是不同的凭证。X-Access-Token - WebShell使用返回的和envd PTY RPC。官方浏览器模板使用
envdUrl上的3000端口提供CDP和VNC服务。这些端口和路径来自模板约定,而非{port}-{sandboxID}.{domain}命令返回的字段;在未查看其他镜像文档的情况下,请勿将这些规则应用于其他镜像。get - 当用户要求打开或访问实例时,请完成连接并验证终端命令或浏览器页面渲染是否正常。仅返回连接JSON或健康检查成功并不等于完成该请求。本地代理URL是宿主侧的访问页面,并非Sandbox API返回的URL。
Operational boundaries
操作边界
- Mutating commands act on remote resources. Only perform the requested operation and scope; read-only discovery does not authorize creating, pausing, resuming, or deleting resources.
- Instance and template deletion are high-risk. Follow the shared protocol: show the exact target and risk, then wait for explicit confirmation before adding . Treat
--yesas a stop signal, not a reason to retry automatically.requires_confirmation - Connection credentials are redacted by default. A request to connect to or access the instance needs the tokens: use for that operation, capture the result privately, and keep tokens out of chat summaries, logs, URLs, and committed files.
--show-credentials - Template create/update wait by polling the build-status endpoint, not template details. returns after the submission response with
--async/templateID; it does not mean the build is ready. Use those IDs withbuildIDto check completion.template build-status - Global limits HTTP requests and total template-build polling.
--timeoutsets instance lifetime; these are different limits. A polling timeout does not prove the remote build failed or stopped; check its status before submitting another build.--instance-timeout - accepts a JSON object inline or through
--body; explicit flags override body fields. For local template mounts, first use@path: it sends multipartbl sandbox file uploadand fixedfiledirectly tosource=sandbox_templatewith the Bailian API Key. Use the returned/api/v1/agentstudio/filesasid, withmntConfig[].originFileIdand optionalmountPath, in template create/updateoriginFileName. The upload and template must use the same workspace. This is not the temporary OSS upload from--bodyor a transfer into a running instance.bl file upload - File upload returns immediately after the upload response and does not poll security review. is not ready to mount; only use files whose status is
status=checking.availablereturns the File ID only; inspect the normal/JSON response for status. Upload alone does not authorize creating a template or instance.--quiet
- 变更类命令会操作远程资源。仅执行用户请求的操作和范围;只读性质的查询操作不代表有权创建、暂停、恢复或删除资源。
- 实例和模板的删除属于高危操作。请遵循共享协议:先展示准确的操作目标和风险,等待用户明确确认后再添加参数。将
--yes视为停止信号,而非自动重试的理由。requires_confirmation - 连接凭证默认会被脱敏。连接或访问实例的请求需要用到令牌:请在该操作中使用参数,私下保存结果,切勿将令牌暴露在聊天摘要、日志、URL和提交的文件中。
--show-credentials - 模板创建/更新通过轮询build-status接口等待结果,而非通过模板详情接口。参数会在提交请求后立即返回
--async/templateID;这并不代表构建已完成。请使用这些ID通过buildID命令检查构建是否完成。template build-status - 全局参数限制HTTP请求和模板构建轮询的总时长。
--timeout设置实例的生命周期;这是两个不同的限制。轮询超时并不代表远程构建失败或停止;在提交新的构建请求前,请先检查其状态。--instance-timeout - 参数支持内联JSON对象或通过
--body指定文件路径;显式参数会覆盖body中的字段。对于本地模板挂载,请先使用@path命令:该命令会将multipart格式的bl sandbox file upload和固定的file参数连同百炼API Key一起直接发送到source=sandbox_template。在模板创建/更新的/api/v1/agentstudio/files中,将返回的--body用作id,并搭配mntConfig[].originFileId和可选的mountPath使用。上传操作和模板必须使用同一个工作空间。这不同于originFileName的临时OSS上传,也不是向运行中实例传输文件。bl file upload - 文件上传在收到上传响应后立即返回,不会轮询安全审核结果。状态的文件尚未准备好挂载;仅可使用状态为
status=checking的文件。available参数仅返回文件ID;请查看普通/JSON响应以获取状态。仅上传文件并不代表有权创建模板或实例。--quiet
Common hand-offs
常见交接场景
Refer to sibling skills by name: read them if installed; otherwise use the command's or prompt .
--helpbl skill init- Managed Agent / Session / Environment resources or IaC →
agents.yaml(bailian-managed-agent).bl managed-agent --help - Workspace discovery or CLI login/configuration → (
bailian-cli/bl workspace --help/bl auth --help).bl config --help
请按名称引用兄弟技能:如果已安装则读取其内容;否则使用命令的参数或提示用户执行。
--helpbl skill init- Managed Agent / Session / Environment 资源或IaC →
agents.yaml(bailian-managed-agent)。bl managed-agent --help - 工作空间查询或CLI登录/配置 → (
bailian-cli/bl workspace --help/bl auth --help)。bl config --help
references
参考资料
- bailian-protocol — shared execution protocol, installed with
bl skill init - reference/ — generated command reference
- Instance connections — WebShell, browser CDP, VNC, and official runtime documentation
- bailian-protocol — 共享执行协议,随一同安装
bl skill init - reference/ — 生成的命令参考文档
- 实例连接 — WebShell、浏览器CDP、VNC及官方运行时文档