Navigation
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:
- Run any language / command —
SimpleBox.exec - Run Python code —
CodeBox - Interactive shell (PTY) —
InteractiveBox - Browser automation —
BrowserBox - Computer use —
ComputerBox - GitHub operations
- Drive a sandbox from your agent loop — the host-side LLM tool-use loop
- MCP tool handler
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 forCodeBox/BrowserBox/ComputerBox/SkillBoxare fixed (the constructor still accepts animageoverride forCodeBox, but the others do not).SimpleBox/InteractiveBoxrequire you to provideimage. 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).
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 withpip show boxlite. - The Node runtime class is
JsBoxlite(there is no bareBoxlite). 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.execusestimeout_secs. - The wrapper-layer
SimpleBox.execusestimeout(float). CodeBox.runusestimeout(int). When you need an enforced timeout, useSimpleBox.exec’stimeout.
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/kvmmust be accessible; on WSL2, enable KVM and put the user in thekvmgroup). - macOS: uses Apple’s Hypervisor.framework, so no
/dev/kvmis needed. macOS Intel is not supported. - Environments without virtualization (some containers / CI):
start()fails and raises, but the process stays alive — catch it withtry/except.
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.

