Skip to main content
Use praisonai-sandbox when you only need sandboxed execution — no gateway, no CLI wrapper — or when you want the sandbox backends on a slim install. It’s a standalone Tier‑2 package extracted from the praisonai wrapper, so agents keep the same sandbox=True behaviour with a much smaller dependency tree.
Standalone praisonai-sandbox still guards built-in provider names against pip-plugin shadowing — the vendored PluginRegistry fallback carries the same check since PR #4184. See Plugin Precedence.
The user asks the agent to run code; the sandbox package executes it in an isolated backend and returns the result.

Quick Start

1

Run an agent with the default backend

The subprocess backend ships in the base install — nothing else to configure:
2

Pick a specific backend

Choose a backend with SandboxConfig:
3

Install the slim package and optional backends

4

List available backends

Each backend reports available or unavailable based on whether its optional dependency is installed.
The standalone praisonai-sandbox console script currently exposes --help and backends. To run code or open an interactive shell, use the wrapper CLI — praisonai sandbox run / praisonai sandbox shell (see Sandbox CLI).
The slim install is not less safe: its vendored PluginRegistry fallback enforces the same built-in guard, so a pip package publishing docker cannot replace the built-in (PR #4184). See Plugin Precedence.

Do I Need to Install It Directly?

Most users never install praisonai-sandbox on its own — the full wrapper already bundles it.

Backends Included

Every backend is selectable by name through praisonaiagents.sandbox.SandboxManager — the same registry the wrapper uses.
Only subprocess ships in the base praisonai-sandbox install. Every other backend — including sandlock — requires its matching extra. This differs from the full praisonai wrapper, where subprocess and sandlock are both built in.

Install Matrix

Base install pulls the core dependencies; each backend is an optional extra.

Compute providers live here too

As of PR #4092, the seven vendor compute providers that tools_run_on= / run_in= / run_on= reach also live in this package — next to the sandbox backends they share a vendor with. You never import them by hand. Name the vendor on the agent and the provider resolves from praisonai_sandbox.compute:
That single install is all you need — no full praisonai wrapper. The two protocol stacks stay separate — a sandbox backend and a compute provider for the same vendor (docker, e2b, modal, daytona) are still two different classes. PR #4092 only co-locates them; it does not merge them.

Which install do I actually need?

Reaching a vendor used to pull vastly different dependency trees. run_in="e2b" resolved 58 packages via praisonai-sandbox[e2b]; tools_run_on="e2b" resolved 143 through the praisonai wrapper. After PR #4092 both spellings reach the same provider through the same slim package.

Import paths

Old praisonai.integrations.compute.* imports still work through sys.modules module aliases — the same module object is reachable from both paths.
The shims are sys.modules module aliases, not from … import X re-exports. Both paths point at the same module object, so monkeypatching a module-level name through either path lands on the real module — tests that patch via the old import keep working unchanged.

Use the Backends Directly

Import a backend class straight from the package when you want the isolated runtime without an Agent:

Platform support

praisonai-sandbox runs on Linux, macOS, and Windows — the subprocess backend enforces different isolation on each, and the cloud backends (Docker, E2B, Modal, Daytona, Novita, SSH) behave identically everywhere.
On Windows, the built-in subprocess backend enforces fewer platform limits than on POSIX. Use docker or a cloud backend when running untrusted code. See the main sandbox page for the full capability matrix and PR #3224 for background.

Every backend is lazy-loaded — importing one never imports the others.

Backward Compatibility

The old praisonai.sandbox import path still works through shims.
Use praisonai_sandbox in new code; the shim keeps existing scripts running unchanged.

How It Fits with SandboxManager

SandboxManager stays the entry point — agents reach backends through the registry, never by importing them directly. The agents layer uses praisonaiagents._sandbox_bridge for registry-only dispatch, so it never imports sandbox backends at module load.

Console Script

The package ships a praisonai-sandbox console script for listing available backends.
The user-facing CLI remains praisonai sandbox … — this console script lists backends and points you at the Python API and the wrapper command.

Validating your install

Run the single-command smoke suite from a repo checkout to confirm every backend you have installed is wired up correctly.
The runner prints a PASS / FAIL / SKIP table and exits 0 when every required check passes. No API keys are needed for the subprocess path; Docker is optional and is skipped gracefully when the daemon or base image is unavailable.
The e2e-validation/ bundle ships with the source repository, not the published wheel. Run these commands from a checkout of MervinPraison/PraisonAI under src/praisonai-sandbox/, not from a pip installed environment.
Set PRAISONAI_SANDBOX_E2E_DOCKER_TIMEOUT (seconds, default 180) to raise the bound on the optional Docker check for slow networks:
See MANUAL-E2E-GUIDE.md for step-by-step manual validation of each backend path.

Best Practices

The base package is intentionally slim. Add [docker], [e2b], [modal], [ssh], [sandlock], [daytona], or [novita] extras individually instead of [all] to keep the dependency tree small.
daytona needs DAYTONA_API_KEY (and optional DAYTONA_API_URL); novita needs NOVITA_API_KEY; e2b and modal need their own provider credentials. Selecting a backend without its credentials fails fast.
Import from praisonai_sandbox in new code. The praisonai.sandbox shim stays for existing scripts.
pip install praisonai bundles praisonai-sandbox — install the standalone package only for minimal, sandbox-only environments.
Keep using SandboxManager and sandbox=True on agents. Backends resolve through the registry, so where they live is an internal detail.
Run praisonai-sandbox backends in CI to confirm the expected backend is installed before a pipeline depends on it.
Run python e2e-validation/run_e2e.py from src/praisonai-sandbox/ to smoke every backend you’ve installed. It’s the fastest way to catch a broken Docker daemon or a missing extra before an agent hits it in production. See the Validating your install section above.
The standalone script lists backends; the praisonai sandbox run / shell commands execute code and open REPLs with full flag support.

Sandbox Backends

All eight backends, the registry, and backend selection guide

Sandbox CLI

praisonai sandbox run, shell, and backends commands

Sandboxed Agent

Local agent loop with tool sandboxing

praisonai-sandbox SDK

Package overview and public API surface