The --sandbox flag enables secure command execution with validation and restrictions. The praisonai sandbox command manages sandbox containers.
Quick Start
# Enable sandbox mode
praisonai "Run echo hello" --sandbox basic
# Check sandbox status
praisonai sandbox status
Sandbox Commands
praisonai sandbox <command> [OPTIONS]
| Command | Description |
|---|
status | Check sandbox container status |
explain | Explain sandbox configuration |
list | List all sandbox containers |
recreate | Recreate sandbox containers |
Status
Check the status of sandbox containers:
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:
praisonai sandbox status --agent work
Explain
Explain the sandbox configuration for an agent:
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:
praisonai sandbox explain --agent work
List
List all sandbox containers:
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:
praisonai sandbox list --json
Recreate
Recreate sandbox containers (useful for updates or fixing issues):
praisonai sandbox recreate
Recreate specific container:
praisonai sandbox recreate --agent work
Force recreate all:
praisonai sandbox recreate --all --force
| Option | Description |
|---|
--agent NAME | Recreate for specific agent |
--all | Recreate all containers |
--force | Skip confirmation prompt |
Sandbox Modes
| Mode | Description |
|---|
off | No sandboxing (default) |
basic | Basic isolation with command validation |
strict | Strict isolation with filesystem restrictions |
Usage with Prompts
Basic Mode
praisonai "Execute ls -la" --sandbox basic
Output:
🔒 Sandbox Mode: BASIC
Commands will be validated before execution
╭─────────────── 🔒 Tool Approval Required ───────────────╮
│ Function: execute_command │
│ Risk Level: CRITICAL │
│ Arguments: │
│ command: ls -la │
╰─────────────────────────────────────────────────────────╯
Execute this critical risk tool? [y/n]:
Strict Mode
praisonai "Run python script.py" --sandbox strict
Strict mode adds additional restrictions:
- Filesystem access limited to current directory
- Network access may be restricted
- Resource limits applied
Combine with Other Features
# 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
Sandbox mode provides an additional layer of security but should not be considered a complete security solution. Always review commands before approving execution.