Feature
Shell Commands
Run any shell command with full output capture. Install packages, configure system, run pipelines — all with root access.
commands.py
1from hopx_ai import Sandbox
2
3sandbox = Sandbox.create(template="code-interpreter")
4
5# Run a simple command
6result = sandbox.commands.run("ls -la /workspace")
7print(result.stdout)
8
9# Install packages
10sandbox.commands.run("pip install pandas numpy matplotlib")
11
12# Run complex pipelines
13result = sandbox.commands.run("""
14 curl -s https://api.example.com/data.json | \
15 jq '.items[] | .name' | \
16 sort | uniq -c | sort -rn
17""")
18
19# Background command
20proc = sandbox.commands.run_background(
21 "python train_model.py --epochs 100"
22)
23print(f"Started: {proc.id}")
24
25# Check exit code
26result = sandbox.commands.run("python --version")
27print(f"Exit code: {result.exit_code}")Any Command
Run any shell command with full stdout/stderr capture
Root Access
Full root privileges — install packages, configure system
Instant Output
Get results immediately or stream in real-time
Background Mode
Run long commands asynchronously without blocking