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.

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)

Managed Runtime Protocol

Remote agent runtime for full managed execution

Sandbox

Core SDK sandbox execution on agents