Skip to main content

Cloud Sandbox Toolkits

Why cloud sandboxes?

Most “code interpreter” agents execute model-generated code locally. That’s fine for trusted personal use but a problem in production:
  • A bug or prompt injection can read your filesystem, hit your internal network, or shell-fork-bomb the process.
  • Multiple concurrent sessions step on each other’s state.
  • You can’t enforce CPU/memory/network limits cleanly across platforms.
Cloud sandboxes (E2B, Daytona, others) give each session a fresh, hardened, network-restricted VM. The agent reads/writes inside the VM, and you tear it down between sessions. Agentium ships two adapter toolkits, both implementing the same CloudSandbox interface so they’re interchangeable.

CloudSandbox interface

E2BSandboxToolkit

Requires: npm install @e2b/sdk. Get an API key at e2b.dev.

Tools exposed

E2BSandboxToolkit.getTools() returns four tools:

Direct access

toolkit.getSandbox() returns the underlying E2BSandbox if you need to call it programmatically (e.g. seed files before the first agent call):

Templates

E2B sandbox templates control which language runtimes, libs, and tools are preinstalled. Pass the template ID via template:

DaytonaSandboxToolkit

Same interface, different backend:
Requires: npm install @daytonaio/sdk. Hosted Daytona or self-hosted both work; pass baseURL for self-hosted. Tool names: sandbox_daytona_run, sandbox_daytona_shell, sandbox_daytona_write_file, sandbox_daytona_read_file.

When to use which

Compose with SandboxAgent

If you want a persistent workspace that survives across turns AND lives in a cloud VM, plug a CloudSandbox into SandboxAgent:

Lifecycle and cost

  • Sandboxes are created lazily on the first tool call.
  • They live until you call toolkit.close() (or the provider’s idle timeout fires, usually 5–10 min).
  • Always await toolkit.close() at the end of a request to free the sandbox.
  • For multi-tenant deployments, one sandbox per session is the right model. Don’t reuse across users.

Failure modes

See also