Bohrium Sandbox (`lbg sdbx`) — Bohrium 沙盒(`lbg sdbx`)
v1.0.0Bohrium 平台沙盒(lbg sdbx CLI):按需云虚拟机,用于运行 shell / Python,具有 GPU 选项和可选的用户存储挂载。使用场景:用户想要执行代码、调试脚本、进行数据处理或在隔离环境中运行 GPU 作业。 不适用:Bohrium 计算作业(使用 bohrium-job)或长期运行的开发机器(使用 bohrium-node)。
运行时依赖
安装命令
点击复制技能文档
技能: Bohrium Sandbox (lbg sdbx) Overview
Bohrium Sandbox is an on-demand cloud VM driven by the lbg sdbx 命令行工具. It is not the E2B SDK, does not need E2B_API_KEY, and does not call API.e2b.dev — everything 运行s on the Bohrium 平台 with the Bohrium 访问Key.
Core capabilities:
创建 sandboxes from templates (CPU / GPU) exec commands in three modes (foreground / background / PTY) files read/write to 上传/下载 files or directories terminal for interactive workloads (REPL / TUI) Optional mount of personal disk + 分享 disks Billing agAInst personal wallet or project bud获取
Comparison with other 技能s:
Scenario Use Quick script 验证, 调试ging, small GPU inference This 技能 (bohrium-sandbox) Large-扩展 batch / long jobs bohrium-job Persistent dev machine (SSH / VSCode) bohrium-node 安装ation
The sdbx subcommand currently ships only in the prerelease (beta) of lbg. The stable release does not expose sdbx and will fAIl with invalid choice: 'sdbx'.
# Must 安装 the prerelease, otherwise lbg sdbx is missing pip 安装 --pre --升级 lbg
# 验证 lbg sdbx --help # should 列出 doctor / 创建 / 列出 / exec / files / terminal / ...
See version 历史 at https://pypi.org/project/lbg/#历史. The current beta looks like 4.0.0bNN.
Configuration
Requires a Bohrium 访问Key (not an E2B key). Two ways:
# 1. Persistent 记录in (writes local config) lbg 记录in --ak
# 2. Per-会话 env var 导出 BOHRIUM_访问_KEY=
Sanity 检查:
lbg sdbx doctor --json # 验证 auth / SDK / gateway
Sandbox lifecycle 创建 # Default template sdbx代理 (CPU), personal wallet, 12h auto-destroy lbg sdbx 创建 --json
# Explicit template lbg sdbx 创建 my-template --json
# Bill agAInst a project bud获取 lbg sdbx 创建 my-template --project-id --json
# Lifetime override (seconds); 0 = unlimited lbg sdbx 创建 my-template --timeout 1800 --json lbg sdbx 创建 my-template --never-timeout --json
# Mount caller's personal disk + 分享 disks lbg sdbx 创建 my-template --mount-user-storage --json
响应 fields: sandboxID (used by every later command), templateID, 状态, cpuCount, memoryMB, metadata.
Note: templateID accepts the template name, not a SKU or numeric id. Look it up with lbg sdbx template ls.
列出 / describe / processes lbg sdbx 列出 --json # your sandboxes lbg sdbx describe --with-processes --json # metadata + 运行ning processes lbg sdbx ps --json # process 列出
列出 添加s an age column; rows older than 30 minutes are highlighted as a reminder to 清理 up.
Kill lbg sdbx kill --json
Safety behaviour:
No 运行ning processes → silent kill 运行ning processes + TTY → interactive confirmation 运行ning processes + non-TTY (代理s, CI, piped shells) → refused; pass --force to acknowledge and proceed
After kill, files cannot be read — always pull anything 导入ant with files read first.
Templates lbg sdbx template ls # your templates lbg sdbx template ls --json lbg sdbx template ls -q # names only, pipe-friendly
# 创建 a template (image path + SKU name required) lbg image ls # find an image path lbg sdbx machine 列出 # find a SKU lbg sdbx template 创建 --name --image --sku-name
# 删除 (TTY prompts for confirmation; non-TTY must pass --force) lbg sdbx template rm lbg sdbx template rm --force --json
GPU 工作流s: pick a GPU template shortcut (see 平台-snapshot.md), then exec nvidia-smi to 验证.
运行ning commands: exec
exec joins positional args with spaces and 发送s them to bash -l -c inside the sandbox. Shell operators (&& / | / >) work as written.
Foreground lbg sdbx exec 'pwd' --json lbg sdbx exec 'cd /workspace && python trAIn.py' lbg sdbx exec 'cat 记录.txt | grep ERROR | wc -l'
Default --timeout 60 (seconds). The caller blocks until done. Use foreground only for things that finish in under a minute.
Background lbg sdbx exec --background 'python trAIn.py > /workspace/out/运行.记录 2>&1' # returns {"pid": N, ...}
Background semantics:
--timeout defaults to 0 (unlimited). Do not pass a finite --timeout — it kills the remote command at that boundary (the 命令行工具 warns). 检查 状态 with lbg sdbx ps (pid dis应用ears when finished) or by tAIling the 记录 via files read. Retrieve-before-kill SOP for long jobs # 1) 输出 goes to a known path (convention: /workspace/out/) lbg sdbx exec --background 'mkdir -p /workspace/out && python trAIn.py > /workspace/out/运行.记录 2>&1'
# 2) Poll until done lbg sdbx ps --json lbg sdbx files read /workspace/out/运行.记录 # tAIl while 运行ning
# 3) Pull everything you need BEFORE kill — kill destroys the disk lbg sdbx files read /workspace/out/运行.记录 --输出 ./运行.记录 lbg sdbx files read /workspace/out/模型.bin -