Skip to main content
Version 1.0.0 (2026-11-15) · on Maven Central · What’s New → Write the agent’s build-and-test loop once, then choose where it runs. Agent Sandbox gives agents, evaluation harnesses and build runners one synchronous API for running commands and creating, reading and listing workspace files. Pick a local process for development, a Docker container from an image you choose, or a remote Firecracker microVM on E2B, at construction time. The code in between does not change.
Java 21 or later. For the other backends use agent-sandbox-docker or agent-sandbox-e2b (each brings the core with it), also at 1.0.0.

What you get

One contract, three backends

Sandbox is the same interface on LocalSandbox, DockerSandbox and E2BSandbox: exec, files(), workDir() and close().

A compatibility kit you can run

AbstractSandboxTCK holds 22 contract tests for exec, environment, working directory, timeouts, output and file operations. It ships in the core test-jar, so a new backend can prove it behaves the same.

Commands are argument vectors

ExecSpec.of(...) passes arguments as given; the kit checks that no backend splits or expands them through a shell. Use shellCommand(...) when you do want a shell.

Fluent workspace files

Create, read, list, check and delete files and directories, then return to the sandbox with and() and run the build.

Results that tell you what happened

ExecResult carries the exit code, stdout, stderr and duration, with success(), mergedLog() and summary(). A timeout reaches you as a SandboxException caused by a TimeoutException.

Secrets stay out of logs

An ExecSpec prints the names of its environment variables, never their values, and LocalSandbox logs only the names of the variables you set.

Backends

LocalSandbox

Process and workspace convenience via zt-exec. It provides no security isolation and is for development and trusted commands. It is the only backend with interactive execution.

DockerSandbox

A convenient local Docker backend using Testcontainers and an image you select. It is not a hardened multi-tenant execution service.

E2BSandbox

Remote Firecracker microVM execution via E2B, with connect(sandboxId) to reattach to a running sandbox. This backend requires an E2B account and API key.
DockerSandbox has privileged access to a trusted, root-equivalent local Docker daemon. Container isolation alone is not a complete hostile-workload security boundary; add the kernel, user, and network controls required by your threat model. The image must provide bash, GNU coreutils and GNU findutils, and Docker Engine must offer API 1.44 or newer. ExecSpecCustomizer rewrites each spec before it runs on LocalSandbox and DockerSandbox; E2BSandbox does not apply customizers.

Module Structure

1.0.0 has the same API as 0.10.2. It moves Jackson to 2.22.3; Agent Sandbox has no Jackson 3 dependency.
In version 0.10.0, DockerSandbox requires an explicit caller-selected image: the no-argument constructor is removed, and DockerSandbox.builder().build() fails before Docker access unless .image(...) is set. Constructors that already take an image continue to work. The caller may use any compatible image and owns its provenance, contents, security, and update policy.

Source

GitHub

Source code at v1.0.0 — Core, Docker, and E2B modules

1.0.0 release notes

First 1.x release

Used By

  • Agent Eval — agent-judge-exec runs command-based evaluation in sandboxes; Agent Eval 1.0.0 builds against Agent Sandbox 1.0.0