TypeScript CLI Sandbox Filter

Use praisonai-ts sandbox exec, check, and mode to filter host commands — and know when to use real isolation instead

praisonai-ts sandbox checks shell commands against allow/deny lists and runs them on the host as the current user — it is a guard rail against accidents, not isolation and not a security boundary.

typescript
import { Agent } from 'praisonai';

const agent = new Agent({
  name: 'Assistant',
  instructions: 'Help inspect the workspace safely.',
});
await agent.start('Check the current project files');
Diagram

praisonai-ts sandbox

Blocked

Allowed

⌨️ praisonai-ts sandbox exec

🛡️ CommandValidator

⛔ Refused

🖥️ Host Subprocess
current OS user

Quick Start

  1. Check whether a command is allowed
    bash
    praisonai-ts sandbox check "rm -rf /"
    praisonai-ts sandbox check "ls -la" --json

    Validates the command against the filter rules without running it.

  2. Execute a filtered command
    bash
    praisonai-ts sandbox exec "echo hello" --mode basic --timeout 30000
    praisonai-ts sandbox exec "ls -la" --mode strict
  3. Inspect filter modes
    bash
    praisonai-ts sandbox mode

    Prints the available filter modes and what each mode checks.


Subcommands and Modes

SubcommandDescription
praisonai-ts sandbox exec <command>Checks <command> against the selected filter mode (--mode, default basic; --timeout, default 30000 ms) and runs it on the host.
praisonai-ts sandbox check <command>Runs CommandValidator on <command> without executing it. Supports --json / --output json.
praisonai-ts sandbox modeLists the supported filter modes.
ModeWhat it checks (runs on host)
disabledNo command filtering.
basicRefuses deny-listed destructive/privilege commands and dangerous patterns.
strictStricter command deny list including common network tools; runs in a temporary working directory on the host.
network-isolatedRefuses common network CLI tools on the command line (does not create a network namespace).

Best Practices

Use praisonai-ts sandbox check in dry-run pipelines

Validate generated commands with praisonai-ts sandbox check --json before deciding whether to run them.

Do not rely on command filters for untrusted code

String-based command filters can be worded around. Always use an isolating backend (docker, sandlock, e2b, modal, daytona, novita) when executing untrusted code.

Keep mode names distinct from OS containment

Mode names (basic, strict, network-isolated) are preserved for backward compatibility; they describe command filtering rules rather than kernel isolation.


Related