Feature
WebSocket Terminal
Interactive terminal sessions via WebSocket. Full PTY support for running interactive commands, REPLs, and shell sessions.
terminal.py
1from hopx_ai import Sandbox
2
3sandbox = Sandbox.create(template="code-interpreter")
4
5# Connect to interactive terminal
6terminal = sandbox.terminal.connect()
7
8# Send commands
9terminal.send_input("cd /workspace\n")
10terminal.send_input("ls -la\n")
11
12# Read output
13output = terminal.read()
14print(output)
15
16# Interactive Python REPL
17terminal.send_input("python3\n")
18terminal.send_input("print('Hello from Python!')\n")
19terminal.send_input("exit()\n")
20
21# Send control sequences
22terminal.send_input("\x03") # Ctrl+C
23terminal.send_input("\x04") # Ctrl+D
24
25# Close terminal
26terminal.close()Interactive Shell
Full PTY access with interactive commands
WebSocket Stream
Real-time bidirectional communication
Send Input
Send keystrokes and control sequences
Low Latency
Optimized for responsive terminal sessions