BoxLite as a local, embedded MicroVM SandboxClient for the OpenAI Agents SDK.
Project description
boxlite-openai-agents
A local, embedded sandbox backend for the OpenAI Agents SDK. Drop it into your existing
Runnersetup — your agents now execute code, write files, and run shells inside a real hardware-isolated MicroVM running on the same machine as your Python process.
Why this exists
If you're already using the OpenAI Agents SDK, you've seen this pattern:
run_config=RunConfig(sandbox=SandboxRunConfig(client=SomeHostedSandbox()))
Every first-wave sandbox provider behind that interface is a hosted SaaS (or a separate daemon you have to install and keep running). That's fine for prototypes — but it leaks your prompts, code, and intermediate artifacts to a third party, charges per-second, adds 100–400 ms of network latency to every tool call, and makes air-gapped or regulated deployments impossible.
boxlite-openai-agents is a drop-in SandboxClient that runs the agent's compute inside your own process on a KVM (Linux) or Hypervisor.framework (macOS) MicroVM. No Docker Desktop, no daemon, no remote round-trip. Snapshots and forks come from native QCOW2 copy-on-write — so a Runner.run_sync(...) that previously rebuilt environment state on every turn now resumes from a saved disk image in milliseconds.
The package implements the upstream SandboxClient / SandboxSession / SnapshotBase protocols 1:1 on top of the public boxlite Python SDK. Your Runner, Agent, tools, handoffs, and tracing code keep working unchanged.
When to reach for this
- Code-interpreter-style agents that write, edit, and run files across many tool calls — local IO is faster than any RPC sandbox.
- Long-running / branching agent runs where you want to fork from a known-good state (e.g. evaluator harnesses, multi-candidate code generation, replay-based debugging).
- Air-gapped / on-prem / regulated deployments where prompts and code can't leave the host.
- CI and offline tests for agents — no hosted-sandbox account, no rate limit, no flaky network.
Install
pip install boxlite-openai-agents
Requires openai-agents>=0.14,<0.16, boxlite>=0.8.2, Python 3.10+. On Linux you need /dev/kvm; on macOS Apple Silicon you need Hypervisor.framework (default, no setup).
Quickstart
from agents import Runner
from agents.run import RunConfig
from agents.sandbox import SandboxAgent, SandboxRunConfig
from boxlite_openai_agents import BoxLiteSandboxClient, BoxLiteSandboxClientOptions
agent = SandboxAgent(name="local-coder", instructions="You are a careful engineer.")
result = Runner.run_sync(
agent,
"Write fizzbuzz.py and run it.",
run_config=RunConfig(
sandbox=SandboxRunConfig(
client=BoxLiteSandboxClient(),
options=BoxLiteSandboxClientOptions(image="python:3.12-slim"),
),
),
)
print(result.final_output)
That's it — the agent loop, tool routing, and tracing all work exactly as documented in the OpenAI Agents SDK. Only the sandbox backend changed.
⚠️ Production runbook — three things to get right before you ship
Most BoxLite incidents in the wild come from one of these three. Read this section before you go to prod.
1. Non-OpenAI LLMs require capabilities=[Shell()]
SandboxAgent defaults to Capabilities.default(), which includes a hosted apply_patch tool. The OpenAI Chat Completions API used by every non-OpenAI provider (DeepSeek, Qwen, self-hosted vLLM, OpenRouter, ...) rejects hosted tools outright with UserError: Hosted tools are not supported with the ChatCompletions API.
from agents.sandbox.capabilities import Shell
agent = SandboxAgent(
name="...",
instructions="...",
capabilities=[Shell()], # ← required for non-OpenAI providers
model=OpenAIChatCompletionsModel(...),
)
2. egress_allowlist=() is deny-all — pip install and git clone will fail until you opt in
The default is intentional (BoxLite's whole point is no surprises out the network boundary). The first time your agent tries pip install pandas and it hangs, this is why.
options=BoxLiteSandboxClientOptions(
image="python:3.12-slim",
egress_allowlist=(
"pypi.org",
"files.pythonhosted.org",
"github.com",
"raw.githubusercontent.com",
# add your private registries / package mirrors here
),
)
For truly air-gapped workloads, leave this empty and pre-bake the dependencies into your OCI image.
3. Disable SDK tracing in air-gapped deployments
The OpenAI Agents SDK exports traces to api.openai.com by default. If you bought BoxLite for data-residency reasons, this silently undermines that promise. Turn it off explicitly, or wire in a local OpenTelemetry exporter:
from agents import set_tracing_disabled
set_tracing_disabled(True)
# or, for self-hosted observability:
# from agents.tracing import add_trace_processor
# add_trace_processor(YourLocalOTLPExporter())
Capabilities
| Capability | Default | Notes |
|---|---|---|
| Embedded library, no daemon | ✅ | Pure pip install; no Docker, no service to run. |
| KVM / HVF hardware isolation | ✅ | Independent guest kernel per SandboxSession. |
| Native QCOW2 CoW snapshot | ✅ | Wired into persist_workspace() / resume() — fork an agent state in milliseconds. |
| Air-gapped / offline | ✅ | Default egress_allowlist=[] blocks all outbound network from the guest. |
| Tracing-compatible | ✅ | Standard OpenAI Agents SDK traces (per-tool spans, latency) work unchanged. |
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boxlite_openai_agents-0.1.0.tar.gz.
File metadata
- Download URL: boxlite_openai_agents-0.1.0.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50af6dad3dd5fcbdbe1cddf002c186e5433bd1aa0907a35075718b36c481e050
|
|
| MD5 |
3624fb0075ac238e2630b4b4085ef708
|
|
| BLAKE2b-256 |
a196eaf67c56e782a954972ea24272f3bd401be35eb64ca0f8fb30034543fbbb
|
Provenance
The following attestation bundles were made for boxlite_openai_agents-0.1.0.tar.gz:
Publisher:
publish.yml on boxlite-ai/boxlite_openai_agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boxlite_openai_agents-0.1.0.tar.gz -
Subject digest:
50af6dad3dd5fcbdbe1cddf002c186e5433bd1aa0907a35075718b36c481e050 - Sigstore transparency entry: 1396971198
- Sigstore integration time:
-
Permalink:
boxlite-ai/boxlite_openai_agents@4f05daffc03573bf9e33fa69d3918d9f3be615e6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/boxlite-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4f05daffc03573bf9e33fa69d3918d9f3be615e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boxlite_openai_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: boxlite_openai_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c725a15e96c01c69c24e62872d32fd061d8c5c77f3422677165cb909add35440
|
|
| MD5 |
9d848590b55f9578d502675ed819c6ac
|
|
| BLAKE2b-256 |
ae7fd88603b4ef3ed097efb324ef9e8ef0b326d6e7c8db22810595aad57d8a7f
|
Provenance
The following attestation bundles were made for boxlite_openai_agents-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on boxlite-ai/boxlite_openai_agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boxlite_openai_agents-0.1.0-py3-none-any.whl -
Subject digest:
c725a15e96c01c69c24e62872d32fd061d8c5c77f3422677165cb909add35440 - Sigstore transparency entry: 1396971207
- Sigstore integration time:
-
Permalink:
boxlite-ai/boxlite_openai_agents@4f05daffc03573bf9e33fa69d3918d9f3be615e6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/boxlite-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4f05daffc03573bf9e33fa69d3918d9f3be615e6 -
Trigger Event:
push
-
Statement type: