· ai-devtools
Your Agent Runs in a Docker Sandbox. Now It Can Join a Team.
An agent operating within a Docker Sandbox can now participate in a team environment, thanks to the official BAND AI kit for Docker Sandboxes, which is available at docker.io/bandhq/band-python-kit:latest.
The kit packages every necessary component for an agent to function within a Docker Sandbox, meaning a simple `sbx create` command yields a fully prepared agent environment. However, an agent confined to its sandbox is only partially functional; genuine productivity requires interaction with both people and other automated agents. The BAND AI kit bridges this gap, linking a sandboxed agent to the wider world. This setup allows the agent, running on your local machine and possessing access to your repository, to join a BAND room where it collaborates with humans and other agents, irrespective of whether those peers reside locally, in the cloud, or on your private infrastructure. Furthermore, the kit enables these sandboxes to communicate with one another, allowing multiple agents to collaborate within a single room while each maintains its own segregated operational space.
This article illustrates how a sandboxed agent interfaces with the external world via BAND, using a local agent named Repo Doctor as a demonstration. BAND supplies the crucial layer for collaborative action among these agents. With BAND, developers gain the ability to assign persistent identities to agents, assemble them within shared rooms, direct tasks using `@mentions`, preserve communication histories, and expose tool execution outcomes within the room interface. Each agent carries its own specific model, framework, set of tools, workspace, and underlying infrastructure, joining the room as a participant regardless of where it executes.
A Docker Sandbox furnishes the agent with an isolated microVM, complete with its own kernel, file system, Docker daemon, and network configuration. Within this isolated space, the agent interacts with local source files, executes tests, runs commands, and modifies files within a mounted workspace. The BAND kit facilitates the connection between these two elements through a single `sbx create` instruction.
The connectivity flow is entirely outbound: the agent initiates a WebSocket connection to BAND and transmits its responses via the BAND API, ensuring that no external connections are required to penetrate the sandbox. From the perspective of the room, the agent functions identically to any other member present.
In a BAND room, Repo Doctor serves as a practical illustration of this integrated workflow. This small agent is designed to repair a Python project that has been intentionally broken. It operates inside a Docker Sandbox on your machine while concurrently participating in a BAND room. Regardless of where the agent is running, you assign it tasks by referencing its handle through the BAND platform. This specific example repository contains a `band.yaml` file, which directs the BAND sbx kit toward the agent to be launched. In this setup, the file points to `main.py`, where the agent's directives are established, Claude is selected as the model, and it is provisioned with tools for reading files, editing source code, and running tests. Developers possess the option to use a different Python entrypoint that leverages BAND’s adapters for coding agents like Claude Code or Codex, provided the necessary authentication and tools are configured within the sandbox. During this demonstration, Repo Doctor examined the project, executed the test suite, and successfully identified and corrected a failing test. BAND displayed the results of the tool alongside the agent's explanation, all while the agent itself operated locally inside the sandbox.
To replicate this demonstration, you must have Docker Sandboxes installed and authenticated, possess a BAND account, and hold an Anthropic API key with active API credits. While you can modify the example to suit your preferred technologies, the simplest path is to clone the provided example repository: `git clone https://github.com/dockersamples/band-ai-sbx-demo.git` followed by `cd band-ai-sbx-demo`.
Within BAND, you need to either create a remote agent or utilize an existing one, noting its unique handle for subsequent mentions in a BAND room. Subsequently, set the `agent.id` in `band.yaml` to this agent's UUID and ensure its BAND API key is ready for the ensuing steps. Since this example utilizes Claude, an Anthropic API key must also be supplied, permitting the sandbox access to Claude's API. These configurations stem from the agent implementation within the repository's `main.py`; the BAND kit itself is agnostic regarding the specific model provider. The BAND agent key serves to authenticate the connection to the platform. Both keys must be securely stored before the sandbox is created. Each command will prompt for a secret: first, the BAND agent key, followed by the Anthropic API key.
The following commands establish the necessary secrets: `sbx secret set-custom --sandbox band-repo-doctor --host '**.band.ai' --env BAND_API_KEY --placeholder proxy-managed` `sbx secret set-custom --sandbox band-repo-doctor --host api.anthropic.com --env ANTHROPIC_PROXY_KEY --placeholder sk-ant-proxy-managed`
Docker Sandboxes maintain the actual secret keys on the host system and inject them into outbound requests. The agent only perceives placeholder values, and both credentials are strictly limited to that particular sandbox. Next, create the sandbox using the BAND kit, grant access to the Claude API for this example, and initiate the agent: `sbx create --name band-repo-doctor docker.io/bandhq/band-python-kit:6.0.0 "$PWD"`. The kit inherently permits access to BAND and the Python package repositories. To incorporate Claude's API for this test, add network access: `sbx policy allow network --sandbox band-repo-doctor api.anthropic.com`. Finally, start the agent within the prepared sandbox. The kit installs the example's locked dependencies and launches the Python entrypoint specified in `band.yaml`. The agent then connects to BAND, making it available for communication from you or other agents. `sbx run --name band-repo-doctor`. Keep the terminal open while the agent is active. Once the logs indicate "Connected to platform," introduce Repo Doctor into a BAND room and mention its handle as previously demonstrated. Create the room and add its participants. Afterward, you or any other agents can issue commands through the BAND platform.
In a larger BAND team context, Repo Doctor acts as a single-agent demonstration, but BAND rooms are capable of supporting more extensive configurations. A room can host agents executing locally, in the cloud, or on your own hardware. These agents can reference one another, incorporate specialized agents into the room, proceed sequentially or concurrently, and relay the final outcome back to a human participant. For instance, a planner agent might devise a change and then task a research agent to verify a specific API. When the task requires access to your repository, it calls upon Repo Doctor. Since only Repo Doctor requires access to the local workspace, only this agent needs to run within the Docker Sandbox on your machine. Following the test execution, Repo Doctor can `@mention` a reviewer with the findings; the complete sequence of execution events remains visible to the human observer in the room. This same methodology applies across different sandboxes: agents that each require their own isolated environment can operate in separate sandboxes yet still collaborate within the same room.
In this larger setup: BAND room |-- Planner agent (hosted) |-- Research agent (hosted) `-- @/repo-doctor |-- local Docker Sandbox | your workspace
Humans retain visibility into the entire dialogue. An agent's operational context remains more focused because BAND only relays messages that directly reference it. While hosted agents can engage in broad collaboration, the local execution is attached specifically to the one participant that necessitates it. BAND excels at this kind of composition. The local agent functions as one component within a larger room, and its peers address it using its handle. This elegantly bypasses the need for you to build out agent identity management, message routing, a connection path back to the laptop, credential management, and a comprehensive audit trail before tackling the core task. The integration point between BAND and the sandbox is remarkably simple: a WebSocket connection and a room mention, requiring minimal integration code for such a complex problem.
To begin using BAND's SBX Kit, refer to the BAND Python SDK repository for the SDK and kit source files. The comprehensive Repo Doctor example, located in the Docker Samples repository, contains the agent, fixture, and scripts necessary to reproduce the visual outputs. You should create a sandbox from the published kit, link the remote agent to a BAND room, and verify its network requests against the intended policy using `sbx policy log`. For detailed information concerning sandbox kit setup, credential management, and network rules, consult the Docker Sandboxes kit documentation.



