Skip to main content
Sandboxed agents keep the agent loop local while optionally running tools in secure sandboxes.
The user asks the agent to run code; tool calls execute in E2B or Docker sandboxes instead of on the host.
Not sure where the loop and the tools run? Run print(agent.where_does_it_run()) — see Where Your Agent Runs.
E2B/Docker execution now runs through the standalone praisonai-sandbox package under the hood — no user-visible change. The SandboxedAgent/SandboxedAgentConfig API is untouched. As of PR #4092, the vendor compute providers also live in that package (same names, same behaviour; old praisonai.integrations.compute.* imports still work through a shim).

Quick Start

1

Basic Usage

Local loop, local tools - simplest configuration.
2

With Tool Sandboxing

Local loop, tools run in E2B sandbox for security.

How It Works


Configuration Options

SandboxedAgentConfig Reference

Full configuration options for sandboxed agents

Essential Configuration


Common Patterns

Secure Development Environment

Local Development (No Sandbox)

Multi-Provider Flexibility


Best Practices

Always use sandboxing when running untrusted code or installing packages:
  • Use local execution for trusted environments and faster iteration
  • Use sandbox for production or when handling user-generated code
  • Consider model choice: gpt-4o-mini for speed, claude-sonnet-4-6 for complex tasks
LocalManagedAgent and SandboxedAgent are the same class:
  • SandboxedAgent: Agent loop stays local, only tools may be sandboxed
  • Managed Runtime: Entire agent loop runs remotely (see Managed Runtime Protocol)
packages={"pip": [...]} accepts PEP 508 requirement specifiers only. Pip options with a leading dash are rejected: --upgrade, --pre, -r requirements.txt, -e ./pkg. An invalid entry raises:
Rewrite options as plain specifiers:
write_file accepts bytes and no longer truncates content that contains an EOF line.
Binary bytes round-trip exactly, and a line reading EOF inside the content no longer cuts the file short — every byte reaches the target.
Requires base64 on the sandbox image’s $PATH — present on every stock PraisonAI compute image (Docker, E2B, Modal, Daytona, Novita, Fly.io). Bring-your-own minimal images must include it.
Two SandboxedAgent instances with different API keys stay isolated in the same process.
PraisonAI passes api_key and base_url directly to the inner agent, so credentials never leak into os.environ or a spawned subprocess.

Managed Runtime Protocol

Remote agent runtime for full managed execution

Sandbox

Core SDK sandbox execution on agents