exec, read, write, edit, glob, grep) that all operate inside the container, with the workspace directory bind-mounted from the host.
Create sandbox tools
Define the agent
Stream activity
Invoke the agent and stream text deltas and tool calls in real time.How it works
sandboxTools()creates six tools that operate inside a Docker container- The container is created lazily on first use and reused across tool calls
- The host
workspacedirectory is bind-mounted into the container at/workspace - The agent can write files, run commands, and search the codebase — all isolated from your host system
- On shutdown,
tools.cleanup()removes the container
Run it
Docker must be installed and running. The container image (
node:20-slim) will be pulled automatically on first run.