Skip to main content

Installation

Requirements:
  • Python 3.10 or later
  • pip 20.0+
Verify Installation:

Basic Execution

1

Create a file hello.py

2

Run it

What’s happening:
  1. BoxLite pulls the python:slim OCI image (first run only)
  2. Creates a lightweight VM with the image
  3. Executes the Python command inside the VM
  4. Streams output back to your application
  5. Automatically cleans up when the context exits

Code Execution (AI Agents)

1

Create a file codebox.py

2

Run it

What’s happening:
  1. CodeBox automatically installs required packages (requests)
  2. Executes the code in complete isolation
  3. Returns the output
  4. Your host system remains completely safe

Running Examples

BoxLite includes 9 comprehensive Python examples:
Examples overview:

Next Steps

Core concepts

Understand the different box types (SimpleBox, CodeBox, BrowserBox, and more), lifecycle, images, and resource configuration.

Execute AI-generated code

Learn to use CodeBox for safe code execution — auto-install packages, run untrusted code, and capture output.

Python SDK Reference

Complete API reference for SimpleBox, CodeBox, BrowserBox, ComputerBox, and more.