Skip to main content
Agent-produced commands are untrusted — they may delete files, exfiltrate data, or install anything. Each box is a disposable microVM, so moving only the execute step inside leaves the host untouched. The capabilities an agent needs, grouped by purpose. Each capability below has its own subpage with a Quick Example, a parameter table, and Troubleshooting: Subpages in this section:

Which Box should I use?

You do not need to build a Box from scratch for each capability. BoxLite provides Box types with preset images and wrapper methods. Pick one by the agent’s task, then call the matching method:
The images for CodeBox / BrowserBox / ComputerBox / SkillBox are fixed (the constructor still accepts an image override for CodeBox, but the others do not). SimpleBox / InteractiveBox require you to provide image. See each subpage for the full parameter set.

Quick Example (minimal happy path)

The most fundamental agent tool is exec — running a command inside the sandbox and reading the result. Both snippets below run as-is.

Python: an agent runs a command and runs generated code

Node: the equivalent two steps


Parameters and Returns (entry-point quick reference)

This is a navigation page; it lists only the core entry points and return types for each capability. See each subpage for the full parameter set and defaults.

Run commands

Run code (CodeBox, extends SimpleBox)

Read and write files

ExecResult fields (Python wrapper layer)

The Node fields are camelCase: exitCode / stdout / stderr.

Troubleshooting

An exec command “failed” but raised nothing

When a command exits with a non-zero code, exec does not raise; it returns ExecResult(exit_code != 0).
By contrast, a missing command or an image pull failure raises a standard RuntimeError (in Node, a bare Error with instanceof BoxliteError === false and a message such as internal error: spawn_failed: ...). Use a broad except RuntimeError / catch as your fallback; do not catch only BoxliteError.

Wrong package or class name

  • The Python package is boxlite. Install the latest published version; check it with pip show boxlite.
  • The Node runtime class is JsBoxlite (there is no bare Boxlite). For day-to-day use, the wrapper layer (SimpleBox / CodeBox, etc.) is enough; you do not need to touch the runtime class directly.

Mistakenly awaiting box.info()

info() is a synchronous method (it does not touch the VM). Writing await box.info() raises an error (for example, TypeError: object BoxInfo can't be used in 'await' expression). Call box.info() directly; read state via box.info().state.status.

Passing a list to SimpleBox.exec(env=...)

The wrapper-layer SimpleBox.exec requires env to be a dict (for example, env={"KEY": "value"}), not a list. Only the lower-level native Box.exec uses list[tuple[str,str]].

The timeout parameter name / type differs by layer

  • The lower-level Box.exec uses timeout_secs.
  • The wrapper-layer SimpleBox.exec uses timeout (float).
  • CodeBox.run uses timeout (int). When you need an enforced timeout, use SimpleBox.exec’s timeout.

Passing image to a fixed-image Box

BrowserBox and ComputerBox pin their images: their constructors do not accept image. CodeBox (default python:slim) and SkillBox (default ghcr.io/boxlite-ai/boxlite-skillbox:0.1.0) do accept an image override — but SkillBox’s installer assumes its default image’s Ubuntu layout, so overriding it is an advanced case. If an agent task needs a fully custom image, use SimpleBox(image=...) and run the commands / set up the environment yourself.

Startup failure: no hardware virtualization

BoxLite needs hardware virtualization to launch a microVM:
  • Linux: requires KVM (/dev/kvm must be accessible; on WSL2, enable KVM and put the user in the kvm group).
  • macOS: uses Apple’s Hypervisor.framework, so no /dev/kvm is needed. macOS Intel is not supported.
  • Environments without virtualization (some containers / CI): start() fails and raises, but the process stays alive — catch it with try/except.
Platform support: macOS ARM64 (supported) · Linux x86_64 (supported) · Linux ARM64 (supported) · Windows WSL2 (supported) · macOS Intel (not supported).

Next steps

  • Don’t have the Box lifecycle mental model yet? Start with Manage Sandbox.
  • Want to understand each Box type and its default resources? See Box types.
  • Need to tune CPU / memory? See Compute Resources.