What you’ll build
A script that:- Launches an InteractiveBox with a shell
- Runs interactive commands in a TTY session
- Connects to a Python REPL inside the VM
Prerequisites
- Python
- Node.js
Step 1: Start a shell session
Launch an InteractiveBox and drop into a shell. The session stays open until you typeexit or the shell terminates.
- Python
- Node.js
shell.py
- InteractiveBox creates a VM with Alpine Linux and attaches your terminal to
/bin/sh - Your keystrokes go directly into the VM’s shell, and output streams back in real-time
wait()blocks until the shell process exits (when you typeexitor press Ctrl+D)
Step 2: Choose your shell
You can run any shell or REPL available in the image. Specify it with theshell parameter.
- Python
- Node.js
bash_session.py
python_repl.py
Step 3: Choose the right TTY mode
Thetty parameter controls how InteractiveBox handles terminal I/O. The right choice depends on how you’re using the box.
- Python
- Node.js
tty_modes.py
programmatic.py
InteractiveBox extends SimpleBox, so you always have access to
exec() for running one-off commands. The tty parameter only controls whether the shell session itself gets I/O forwarding — exec() works regardless.What’s next?
Run any language or tool
Use SimpleBox with custom images to run Node.js, Go, Rust, or any CLI tool.
Handle errors and debug
Catch exceptions, handle timeouts, and debug failures.
InteractiveBox API reference
Full API docs for InteractiveBox constructor options and methods.

