Sandbox CLI

Secure command execution in sandboxed environments

The praisonai sandbox command manages sandbox containers. The legacy --sandbox prompt flag is display-only.

Quick Start

bash
# Contain every agent shell command (macOS Seatbelt / Linux bwrap)
PRAISON_SHELL=sandboxed praisonai code

# Check sandbox status
praisonai sandbox status

Sandbox Commands

bash
praisonai sandbox <command> [OPTIONS]
CommandDescription
runExecute code in a registered sandbox backend
shellOpen an interactive shell inside a registered sandbox backend
backendsList registered backends and their availability
statusCheck sandbox container status
explainExplain sandbox configuration
listList all sandbox containers
recreateRecreate sandbox containers

Status

Check the status of sandbox containers:

bash
praisonai sandbox status

Output:

Sandbox Status

Container: praisonai-sandbox-main
  Status: Running
  Uptime: 2h 15m
  Memory: 256MB / 512MB
  CPU: 2%

Container: praisonai-sandbox-work
  Status: Stopped
  Last Run: 30m ago

With specific agent:

bash
praisonai sandbox status --agent work

Explain

Explain the sandbox configuration for an agent:

bash
praisonai sandbox explain

Output:

Sandbox Configuration

Mode: basic
Isolation Level: process

Allowed Commands:
  ✓ ls, cat, grep, find
  ✓ python, pip
  ✓ git (read-only)

Restricted:
  ✗ rm, mv (write operations)
  ✗ sudo, su (privilege escalation)
  ✗ curl, wget (network access)

Filesystem:
  Read: /home/user, /tmp
  Write: /tmp/sandbox
  Denied: /etc, /var, /usr

For specific agent:

bash
praisonai sandbox explain --agent work

List

List all sandbox containers:

bash
praisonai sandbox list

Output:

Sandbox Containers

NAME                        STATUS    CREATED         SIZE
praisonai-sandbox-main      Running   2 hours ago     45MB
praisonai-sandbox-work      Stopped   1 day ago       32MB
praisonai-sandbox-test      Exited    3 days ago      28MB

Output as JSON:

bash
praisonai sandbox list --json

Recreate

Recreate sandbox containers (useful for updates or fixing issues):

bash
praisonai sandbox recreate

Recreate specific container:

bash
praisonai sandbox recreate --agent work

Force recreate all:

bash
praisonai sandbox recreate --all --force
OptionDescription
--agent NAMERecreate for specific agent
--allRecreate all containers
--forceSkip confirmation prompt

Run

Execute code in a registered sandbox backend using --type to select the backend.

bash
praisonai sandbox run --code "print('hello')" --type subprocess
bash
praisonai sandbox run --code "print('hello')" --type docker --image python:3.12-slim
bash
praisonai sandbox run --code "print('hello')" --type novita
FlagDefaultDescription
--code, -c—Inline code to execute
--file, -f—Path to a Python file to execute
--type, -tsubprocessSandbox backend name: subprocess, docker, e2b, modal, ssh, sandlock, daytona, or novita
--imagepython:3.12-slimDocker image (docker backend only)
--timeout60Execution timeout in seconds

Shell

Open an interactive shell inside a registered sandbox backend.

bash
praisonai sandbox shell --type subprocess

Type exit or press Ctrl+D to quit the shell. If the backend isn’t installed, the CLI exits with code 2 and prints a fix-it hint.


Backends

List every registered backend and whether it is installed and ready to use:

bash
praisonai sandbox backends

Output:

Sandbox backends

NAME         AVAILABILITY   INSTALL HINT
subprocess   available      —
sandlock     available      —
docker       unavailable    pip install 'praisonai[docker]'
ssh          unavailable    pip install 'praisonai-sandbox[ssh]'
modal        unavailable    pip install 'praisonai[modal]'
e2b          unavailable    pip install 'praisonai[e2b]'
daytona      unavailable    pip install 'praisonai[daytona]'
novita       unavailable    pip install 'praisonai-sandbox[novita]'

Unavailable backends show the exact install command. See Sandbox Backends for the full matrix and praisonai-sandbox Package for the slim standalone install.


Sandbox Modes

The legacy --sandbox values are accepted but not enforced — commands run uncontained in every mode.

ModeDescription
offNo banner (default)
basicPrints the not-enforced warning; no containment
strictPrints the not-enforced warning; no containment

Usage with Prompts

Basic Mode

bash
praisonai "Execute ls -la" --sandbox basic

Output:

⚠ --sandbox is not enforced here; commands run uncontained. Use `praisonai code` with PRAISON_SHELL=sandboxed for OS-level containment.

╭─────────────── 🔒 Tool Approval Required ───────────────╮
│ Function: execute_command                               │
│ Risk Level: CRITICAL                                    │
│ Arguments:                                              │
│   command: ls -la                                       │
╰─────────────────────────────────────────────────────────╯
Execute this critical risk tool? [y/n]:

Strict Mode

bash
praisonai "Run python script.py" --sandbox strict

Strict mode prints the same warning and applies no restrictions. Use PRAISON_SHELL=sandboxed praisonai code to limit writes to the workspace.

Combine with Other Features

bash
# With auto-approve for low-risk commands
praisonai "List files" --sandbox basic --approve-level low

# With verbose output
praisonai "Run tests" --sandbox strict --verbose

# With bot
praisonai bot telegram --token $TOKEN --sandbox

Security Features

  • Command Validation: All commands are validated before execution
  • Risk Assessment: Commands are assigned risk levels (low, medium, high, critical)
  • User Approval: Critical commands require explicit user approval
  • Audit Trail: All executed commands are logged

Performance


Related