Last Verified: 2025-01-27
Package:
@hopx-ai/sdk on npm
Overview
TheCommands resource provides shell command execution capabilities for sandboxes. Access it via the commands property on a Sandbox instance.
Methods
run
Run a shell command.
command(string): Shell command to executeoptions.timeout(number, optional): Command timeout in seconds (default:30)options.background(boolean, optional): Run in background (default:false)options.workingDir(string, optional): Working directory (default:'/workspace')options.env(Record<string, string>, optional): Environment variables
Promise<CommandResponse> - Command execution result
Example:
runBackground
Run command in background.
Promise<{ processId: string }> - Process ID
Related Classes
See Also
- Core Concepts: Execution - Learn about code execution
- Sandbox Class - Access commands via
sandbox.commands
Related
- Python SDK: Commands - Python SDK command execution
- Running Commands - Learn about command execution
- Background Commands - Run commands in background
Next Steps
- Learn about Running Commands for synchronous execution
- Explore Background Commands for non-blocking tasks
- Review Code Execution for programmatic execution
- CLI Commands - Execute shell commands from CLI

