General Questions
What is BoxLite, and how is it different from Docker?
BoxLite runs each sandbox as a separate microVM with its own kernel, embedded directly in your process — no daemon, no root. Docker shares the host kernel via namespaces/cgroups and needs a daemon.
Choose BoxLite when you need hardware-level isolation for untrusted or agent-generated code without standing up infrastructure.
Do I need root or sudo?
No. On macOS the virtualization stack is available to all users. On Linux you only need access to/dev/kvm, granted via group membership:
Which platforms are supported?
Native Windows (without WSL2) is not supported.
What Python / Node versions are required?
- Python 3.10+ (
python --version). - Node.js 18+ (the package is ESM-only).
How do I check my installed version?
Configuration & Resources
How much memory does a box use, and what’s the default?
When you do not passmemory_mib/cpus, the wrapper forwards an unset value (None), and the actual VM allocation is decided by the libkrun runtime, not by the SDK constants. The runtime’s own fallback is host-derived and can be larger than any of the SDK constants below.
Each SDK also exports its own DEFAULT_MEMORY_MIB / DEFAULT_CPUS constants, but these are not the effective default — the wrappers do not substitute them when the value is unset, so don’t rely on them:
The safest approach is to always set resources explicitly:
How do I mount a host directory into the box?
Use thevolumes parameter. The third element of each tuple is a boolean read_only (True = read-only, False = read-write) — not the string "ro"/"rw". A 2-tuple defaults to read-write.
WhySimpleBoxand notruntime.create(opts)here?runtime.create()returns the nativeBox, whoseexec(command, args_list)takes args as a list and returns a streamingExecution(you thenawait execution.wait()forexit_code; stdout/stderr stream off theExecution). The convenientexec(cmd, *args) -> ExecResultshown throughout this page is theSimpleBox/CodeBoxwrapper API. Don’t mix the two:nativeBox.exec("ls", "-la", "/x")raisesTypeError: argument 'args': Can't extract 'str' to 'Vec', and the returnedExecutionhas no.exit_code/.stdout.
How do I expose ports from a box?
Useports. Each entry is (host_port, guest_port, protocol) in Python or an object in Node. A host_port of 0/omitted means “same as guest port”.
How do I pass secrets into a box?
Secrets are the Vault entry point. PassSecret objects via BoxOptions(secrets=[...]).
How do I enable stronger isolation / security?
Security options go throughadvanced. There is no top-level security= keyword on BoxOptions, and AdvancedBoxOptions is only importable from boxlite.boxlite (it is not re-exported at the top level). Presets are development(), standard(), and maximum() (there is no minimum()).
Lifecycle & Inspection
How do I list, inspect, and remove boxes?
These are runtime methods —list_info() (not list()) and remove(id_or_name, force=False). There is no box.remove().
How do I read a box’s state and metrics?
box.info() is synchronous (do not await it). State lives in info().state.status. Metric field names are memory_bytes and cpu_percent (not memory_usage_bytes / cpu_time_ms).
Note:metrics()lives on the nativeBox(the object returned byruntime.create(opts)), not on theSimpleBox/CodeBoxwrappers —SimpleBoxexposesinfo()but notmetrics()(AttributeError: 'SimpleBox' object has no attribute 'metrics'). Use the native box for metrics. On the native box,exec(command, args_list)returns anExecution;await execution.wait()yields anExecResultcarrying onlyexit_code/error_message(stdout/stderr stream off theExecution).info()is still synchronous;metrics()is async.
How do I see runtime-wide metrics (e.g. how many boxes are running)?
The field isnum_running_boxes (not active_boxes).
How do I set an execution timeout?
The parameter name differs by layer:Networking
Do boxes have internet access?
Yes, by default. Outbound HTTP/HTTPS, DNS, and arbitrary TCP/UDP work out of the box.Can I restrict which hosts a box can reach?
Yes, viaNetworkSpec. The default is “enabled with an empty egress allowlist”, which permits general egress. To lock it down, list allowed hosts.
Can two boxes talk to each other directly?
No. Boxes are isolated. Share data through host volumes, expose a port and connect through the host, or use an external service (Redis/DB) both can reach.Troubleshooting
TypeError: 'str' object cannot be cast as 'bool' when mounting a volume
A volume’s third element is the boolean read_only; the strings "ro"/"rw" are CLI-only and raise TypeError here. See Volumes.
The CLI is the only place that uses :ro/:rw strings (-v host:box:ro); that is the CLI parser, not the SDK API.
AttributeError: module 'boxlite' has no attribute 'AdvancedBoxOptions'
AdvancedBoxOptions lives in the boxlite.boxlite submodule, not the top level — see Inject secrets and harden a box.
SecurityOptions (with presets development()/standard()/maximum()) is at the top level; only AdvancedBoxOptions lives in boxlite.boxlite.
AttributeError on memory_usage_bytes / active_boxes / box.info().status
These names changed (or never existed). Use the real ones:
await box.info() raises / behaves oddly
info() is synchronous. Do not await it. Same for the Node info() getter (use the async getInfo() if you want a Promise).
A failing command did not raise an exception
exec() does not raise on a non-zero exit code — it returns a result with exit_code != 0 (Python) / exitCode !== 0 (Node). Check it yourself. Truly broken invocations behave differently:
- A missing command or image pull failure surfaces as a builtin
RuntimeError(Python) or a bareError(Node) — not aBoxliteErrorsubclass. Catch the standard exception too.
Wrong package name on Node
The npm package is@boxlite-ai/boxlite. import { Boxlite } from "boxlite" or from "@boxlite/sdk" will fail — both the package name and the class name are wrong. The runtime class is JsBoxlite; for everyday use prefer the SimpleBox / CodeBox wrappers.
”Image pull failed” / network errors during startup
First runs pull the image and can take 5-30s; transient network issues surface as aRuntimeError. Retry, verify the image reference (python:slim, not python/slim), and authenticate for private registries.
”Timeout waiting for guest ready” on Linux / WSL2
Your shell cannot open/dev/kvm (often root:kvm mode 660 and your user not in the kvm group):
Ubuntu 24.04: box only starts with sudo
Ubuntu 24.04 restricts unprivileged user namespaces via AppArmor but doesn’t ship the bwrap-userns-restrict profile (Ubuntu 25.04+ does). Diagnose and pick a fix:
Environment requirement: no virtualization available
BoxLite needs hardware virtualization. On Linux that means KVM; on macOS the built-in virtualization stack (no/dev/kvm required); on Windows, WSL2 with KVM. Without it, box startup fails — the exception is catchable and your process stays alive, but the box cannot run.
Getting Help
If this page did not answer your question, the project is developed in the open on GitHub:- GitHub Issues — bug reports and feature requests.
- GitHub Discussions — questions and community support.
- Re-read this FAQ for an existing answer.
- Search existing issues and discussions — your question may already be answered.
- Reproduce with debug logging enabled:
RUST_LOG=debug python your_script.py. - Include the following in your report:
- BoxLite version:
python -c "import boxlite; print(boxlite.__version__)". - Platform:
uname -a(and Python/Node version where relevant). - A minimal reproduction and the full error message / stack trace.
- BoxLite version:

