Download tools/sandbox_exec.md from StarpowerTechnology/HiggsfieldMCP: direct link, hf CLI and curl.
- Browser
- Download file 5.71 kB
-
https://huggingface.co/datasets/StarpowerTechnology/HiggsfieldMCP/resolve/main/tools/sandbox_exec.md
- Command line
-
hf download hf://datasets/StarpowerTechnology/HiggsfieldMCP/tools/sandbox_exec.md
-
curl -L -o sandbox_exec.md https://huggingface.co/datasets/StarpowerTechnology/HiggsfieldMCP/resolve/main/tools/sandbox_exec.md
Execute a shell command in a remote Higgsfield cloud Linux sandbox — NOT your local machine or the client's own shell. Use it for Higgsfield media workflows and website_repo_access checkouts that require the hosted toolchain. Do not use it to inspect a local repository, install desktop software, or control applications on the user's computer. Preinstalled: ffmpeg/ffprobe, ImageMagick, sox, python3 with Pillow and faster-whisper, node/npm/npx, sharp-cli, Playwright with headless Chromium, caption fonts (Metropolis, Montserrat), zip/unzip, git, curl, jq. Use it for media processing (trim, convert, overlay, concat with ffmpeg), image manipulation, and packaging that dedicated Higgsfield tools do not cover. The sandbox is isolated per user and deployment. Workspace files in /home/user persist across idle replacement for 24 hours since last use. Processes and RAM do not survive replacement. Files outside /home/user are checkpointed best-effort; export finished results. A result with sandbox_created:true indicates a new sandbox, so files from earlier calls are not present; re-download missing inputs. It has internet access: bring files in with curl from confirmed uploads or generation result URLs. For an output created here, call media_upload BEFORE starting the producing command, then append curl -f -X PUT --upload-file <file> '<upload_url>' to that SAME command so the ephemeral file is uploaded before it exits; call media_confirm only after HTTP 200. Client attachment upload tools cannot read sandbox paths; use the direct upload flow above for files created here. Commands run in /home/user and time out after timeout_seconds (default 60, max 120); for longer work (large renders, installs) set background:true and poll the returned log/status files with later sandbox_exec calls. Background commands have a 15-minute execution limit and keep the sandbox active until they finish. Use background:true for long work; do not detach commands yourself with nohup, setsid or shell &. Inspect existing jobs before starting another render, and bound worker parallelism to sandbox capacity. If a Modal sandbox remains unresponsive, ask the user before using sandbox_id from its result as recover_sandbox_id: recovery stops all running work, retains /home/user, and does not execute command. Unflushed writes and files outside /home/user may be lost. Recovery is not a retry of the failed command. Set restart:true to discard the sandbox and start clean. Set size:"xl" only for the heaviest CPU work, such as a final multi-job video render; omit it for downloads, probes, edits, polling and inspection. An XL request may move the workspace to a new larger sandbox (files kept, running processes not), and the XL sandbox shuts down about a minute after its work finishes. For actual visual inspection, pass image_paths (up to 4 PNG/JPEG paths, <=512 KiB total) with a foreground command: images are returned natively to the model, not as text or URLs. With background work, wait for completion then use a foreground poll with image_paths before its lease expires. No upload is needed for inspection. The command limit is 128000 characters including signed URLs; keep upload batches small and use installed scripts. Workflow bundle scripts are already installed in every sandbox under $HF_WORKFLOWS (/home/user/.higgsfield/workflows), laid out as $HF_WORKFLOWS//scripts/... — run them straight from there (they survive restart:true), and never paste script contents into the command.
mcp__Higgsfield__sandbox_exec(args: {
// Run the command detached and return immediately with a pid, log_path, and status_path. Poll with a later sandbox_exec call; stop with kill <pid>.
background?: boolean,
// Shell command to run (bash). Runs in the persistent per-user sandbox.
command: string, // minLength: 1, maxLength: 128000
// PNG/JPEG files to return as native images after a successful foreground command. All image files together must be <=512 KiB; split larger sets across calls. Relative paths start at /home/user. Inspect the actual images before writing visual review verdicts.
// minItems: 1, maxItems: 4
image_paths?: Array<
string // minLength: 1, maxLength: 1024
>,
// After user confirmation, replace this current Modal sandbox while retaining /home/user. Stops all processes. Use the ID returned by sandbox_exec. command is required but ignored in recovery mode; use ':' as a placeholder. Cannot combine with restart, background or image_paths.
recover_sandbox_id?: string, // minLength: 1, maxLength: 128
// Discard the current sandbox (all files and processes) and start a fresh one before running the command.
restart?: boolean,
// Sandbox size (default "standard"). Use "xl" only for heavy rendering or encoding; it stops shortly after the work finishes. Later calls without size reuse a live XL sandbox.
size?: "standard" | "xl",
// Seconds before the command is killed (default 60, max 120). Ignored with background:true.
timeout_seconds?: integer, // minimum: 1, maximum: 120
}): Promise<{
error?: string,
exit_code?: number,
// File collecting the background command's combined output (background:true only).
log_path?: string,
// Background process id (background:true only).
pid?: number,
// True when this call acquired a new sandbox without files or processes from earlier calls.
sandbox_created?: boolean,
// Current sandbox ID; a recovery request must match this ID.
sandbox_id?: string,
// File containing the terminal exit code once a background command finishes.
status_path?: string,
stderr?: string,
stdout?: string,
// True when stdout/stderr were truncated. Re-run with a narrower command (head, grep, wc) for full data.
truncated?: boolean,
}>;