| Name | Type | Description |
|---|---|---|
command* | str | Shell command to execute. |
timeout | int | Default: 60Command timeout in seconds. |
env | Optional[dict[str, str]] | Default: None |
cwd | Optional[str] | Default: None |
shell | str | Default: '/bin/bash' |
on_stdout | Optional[Callable[[str], Any]] | Default: None |
on_stderr | Optional[Callable[[str], Any]] | Default: None |
idle_timeout | int | Default: 300 |
kill_on_disconnect | bool | Default: False |
ttl_seconds | int | Default: 600 |
pty | bool | Default: False |
wait | bool | Default: True |
Execute a command in the sandbox asynchronously.
Environment variables to set for the command.
Working directory for command execution. If None, uses sandbox default.
Shell to use for command execution. Defaults to "/bin/bash".
Callback invoked with each stdout chunk as it arrives. Blocks until the command completes and returns ExecutionResult. Cannot be combined with wait=False.
Callback invoked with each stderr chunk as it arrives. Blocks until the command completes and returns ExecutionResult. Cannot be combined with wait=False.
Idle timeout in seconds. If the command has no connected clients for this duration, it is killed. Defaults to 300 (5 minutes). Set to -1 for no idle timeout. Only applies to WebSocket execution.
If True, kill the command immediately when the last client disconnects. Defaults to False (command continues running and can be reconnected to).
How long (in seconds) a finished command's session is kept for reconnection. Defaults to 600 (10 minutes). Set to -1 to keep indefinitely.
If True, allocate a pseudo-terminal for the command. Useful for commands that require a TTY (e.g., interactive programs, commands that use terminal control codes). Defaults to False.
If True (default), block until the command completes and return ExecutionResult. If False, return an AsyncCommandHandle immediately for streaming output, kill, stdin input, and reconnection. Cannot be combined with on_stdout/on_stderr callbacks.