Docker Sandbox (sbx) Kit
The Docker Sandbox (sbx) kit runs a locked Python workspace inside a Docker Sandbox microVM. Its included example is a deterministic, non-agent echo bot: it repeats each Band message without a model or reasoning loop. Replace the example entrypoint with any runnable Python agent.
If you already have runnable Python agent code, complete the sandbox setup first, then follow Replace the Echo Bot with an Agent to connect it.
The published Docker image is named bandhq/band-python-kit-image. The kit installs no dependencies into your host environment, synchronizes the workspace’s committed uv.lock, and starts the configured entrypoint whenever the sandbox starts.
This guide pins kit, image, and Band SDK version 3.1.1, tested with sbx v0.43.0, and does not use the current band-sdk 6.0.1: no kit for it is published on Docker Hub. As of 2026-10-23 the bandhq/band-python-kit tags are 3.1.1-r2 and 3, 5.0.0 and 5, and 6.0.0, 6, and latest. The 3.1.1 kits use an older experimental schema that sbx v0.42.1 and v0.43.0 reject, and sbx kit inspect on v0.43.0 rejects the 6.0.0 and latest kits as a newer artifact format. The current published image is the 5.0.0 kit, a schema v2 kit for bandhq/band-python-kit-image:5.0.0 that pins band-sdk 5.0.0; sbx kit inspect reads it on v0.43.0, but this guide has not been run against it. The kit spec.yaml in the band-sdk-v5.1.0 source uses the same schema and validates on v0.43.0, but its image is the build-time placeholder band-python-kit:local, which no published image provides. Prepare the Compatible Kit Specification runs the same digest-pinned 3.1.1 image through a local schema v1 specification that v0.43.0 accepts.
Which Sandbox Setup to Use
Pin published versions, review each network policy, and validate the setup before you use production credentials.
How It Works
The sandbox contains two Python environments:
- The kit environment runs the launcher and reports configuration or startup failures.
- The workspace environment contains only the dependencies selected by your
uv.lock.
The launcher reads band.yaml, creates the workspace environment outside the mounted workspace, and replaces itself with the configured entrypoint. Signals from sbx stop therefore reach your process directly.
Prerequisites
- macOS. This guide’s credential storage and recovery steps use the macOS Keychain (
security) and Terminal.app; they do not apply on Linux, where Docker Sandboxes uses a different secret-storage backend. - Docker Desktop and Docker Sandboxes (
sbx), tested with v0.43.0 uvon the host- Exactly one Band credential path:
- New Band identity: A user API key that can register an agent. On Band Cloud, user API keys require the Enterprise plan; on other plans, registration returns
403withplan_required. Without Enterprise, create the agent in the web app and use the existing identity path. - Existing Band identity: The existing agent ID and agent API key
- New Band identity: A user API key that can register an agent. On Band Cloud, user API keys require the Enterprise plan; on other plans, registration returns
Set Up Docker Sandboxes
Both credential paths need these steps.
Install Docker Sandboxes
The next two commands install the Docker Sandboxes CLI with Homebrew, then authenticate sbx with Docker so it can pull kits and manage local sandboxes.
Do not continue until sbx login succeeds. On macOS, Docker stores the sbx sign-in credential in the system Keychain. --password-stdin changes how login receives a credential, but does not change where Docker stores it.
Initialize Docker’s Global Network Policy
Docker requires a one-time global network policy before the first sandbox can start.
First, check whether a policy already exists:
If Docker reports that the global network policy has not been initialized, initialize its recommended balanced policy:
Do not reset an existing policy. Continue only when sbx policy ls lists the current policy.
Prepare the Compatible Kit Specification
Docker changed its experimental schema after the 3.1.1 kit was published. The commands below download the immutable release specification, declare it as schema v1 for current sbx, replace its build-time image placeholder with the published digest-pinned image, then validate the result. The local specification contains no credentials.
Validation should report VALID. v0.43.0 also warns that caps is deprecated under schema v1; this warning is expected for the compatibility copy. Stop on any validation error. Inspection must show the 3.1.1 image with the BAND_KIT_IMAGE_DIGEST digest.
Next, choose one path. If you already created the agent in Band, do not run band-kit provision. Skip to Existing Band Identity: Create Only the Sandbox.
New Band Identity: Self-Registration
Verify macOS Keychain Access
Agent registration returns its API key once, but band-kit provision must store that key in Docker’s secret store afterward. Verify Keychain writes before registering anything.
The first command unlocks your login Keychain and may prompt for your macOS password. The next command writes a harmless test value under a temporary sandbox scope, which forces the same Keychain write used during provisioning. The final command removes that test value.
Continue only when both test commands succeed. If macOS displays Keychain Not Found, choose Cancel, not Reset To Defaults, then follow Keychain Not Found during preflight.
Register the Band Identity and Store Its Key
Do not create an agent in Band before this step. Create only a user API key in Band settings. Prefer a key limited to agent registration, and keep it out of source control.
The commands below put the user key in the current shell, then use uvx to run the band-kit executable supplied by band-sdk==3.1.1 in an isolated tool environment. --no-create registers the identity, writes the non-secret ID to band.yaml, and stores the generated agent API key in Docker’s host-side secret store without invoking the incompatible published OCI kit.
Registration and local secret storage are separate operations. If storage fails after registration, the CLI prints the agent API key once. Do not rerun provisioning, paste that key into chat or an issue, or close the terminal before following Recover from a Keychain failure.
A successful run prints the new Band agent UUID and returns to the shell prompt.
Start and Attach to the Docker Sandbox
The local compatibility specification uses the same published 3.1.1 image as the OCI kit. sbx v0.43.0 automatically stops a sandbox created with sbx create after it becomes idle. Run and attach instead, then keep this terminal open while the agent should receive messages.
If an earlier command already reported agent.id=<uuid>, secret present, skip registration and run this command. The existing Band identity and secret remain valid.
The sandbox is ready when Docker finishes any image-pull and VM-startup work, then displays root@my-band-agent inside the attached sandbox. Continue with Verify the Echo Bot.
Existing Band Identity: Create Only the Sandbox
Use this path instead of self-registration when the agent already exists in Band. Do not run band-kit provision. If you do not have the agent yet, create it and save its ID and API Key by following the Quickstart.
Set the Agent ID
In $HOME/my-band-agent/band.yaml, replace replace-with-agent-id with the agent’s ID. Leave entrypoint: main.py as it is:
Store the Key and Start the Sandbox
The commands below read the agent API key without displaying it or saving it in shell history, pipe it to Docker’s secret store under the my-band-agent sandbox scope, remove it from the shell, and run the compatible kit specification. Keep this terminal open while the agent should receive messages.
BAND_API_KEY must belong to the UUID in band.yaml. Do not create the sandbox unless secret storage succeeds. If Keychain writes fail on macOS, stop and follow No file-backed Keychain bypass on macOS.
The sandbox is ready when the attached terminal displays root@my-band-agent.
Verify the Echo Bot
Keep the attached terminal open. In a second host terminal, verify that Docker started the sandbox and its background agent process:
sbx ls must show my-band-agent with status running. The startup log should include Launching customer entrypoint for main.py and no later error. A running sandbox confirms that Docker started the environment. The echo reply confirms that the agent also connected to Band.
In Band, add the agent to a room, then send a new message after the sandbox is running. With self-registration, the agent is My Sandbox Echo:
The non-agent echo bot sends an echo: reply containing the received message from inside the sandbox.
After this smoke test passes, follow Replace the Echo Bot with an Agent to replace the starter with your own runnable Python agent.
Recover from a Keychain Failure
The preflight exposes Docker secret-storage failures before agent registration. A failed preflight does not create a Band identity. If provisioning had already registered an identity before storage failed, keep its printed key private. On macOS, recovery cannot continue until both sbx login and the Keychain preflight succeed.
Keychain Not Found During Preflight
Choose Cancel in the dialog. Do not choose Reset To Defaults as a troubleshooting shortcut. Apple states that resetting the default Keychain deletes all passwords stored in it and requires logging out and back in.
The next three commands only inspect your user Keychain configuration. They print the default Keychain, the Keychain search list, and whether the expected login Keychain can be opened. They do not change or delete Keychain data.
If those commands identify the login Keychain, restart the Docker Sandboxes daemon as your logged-in user. The commands below stop any user-owned daemon, then start a fresh one with the current desktop user’s Keychain context. Do not run them with sudo.
Run the preflight again from Terminal.app in an active macOS desktop session. Avoid SSH, sudo, and background launch contexts. Docker has confirmed that a locked Keychain in an SSH session prevents sbx from reading credentials in docker/sbx-releases#486, and a root-started daemon caused a separate macOS credential-store failure in docker/sbx-releases#77.
If the dialog still appears, do not register an agent. The following command generates Docker diagnostics as a local GitHub issue report. Review it for sensitive paths or values before sharing it on the Docker Sandboxes issue tracker.
No File-Backed Keychain Bypass on macOS
Docker documents that macOS stores both literal values and dynamic secret sources in the system Keychain. --command and --ref change how Docker resolves a secret, but their source configuration still uses Docker’s Keychain-backed secret store. sbx login --password-stdin also persists the resulting Docker credential in Keychain.
Docker’s automatic file-backed secret store is available only on Linux when no Secret Service is running. It is not a macOS fallback. If sbx login fails while saving credentials, stop. Repair Docker’s Keychain access or run the sandbox from a supported Linux host before continuing. Do not run band-kit provision, because it can register a Band identity before the local Docker operation fails.
If an earlier version of this guide caused you to save a still-private key at ~/.config/band/my-band-agent-api-key, leave the mode-600 file in place until Keychain access is repaired. Do not print or paste its contents. After sbx login and the Keychain preflight both succeed, the commands below import that key into Docker’s secret store.
Continue only when sbx secret set-custom succeeds. The next commands delete the plaintext file, remove its path from the shell, then start and attach to the sandbox.
Provisioning Failed, Key Still Private
Do not rerun band-kit provision. The failed command already registered the Band identity and wrote its ID to band.yaml.
The commands below unlock your login Keychain, read the printed agent key without displaying it or saving it in shell history, pipe it to sbx using the current --sandbox syntax, and remove it from the shell. The final command starts and attaches to the sandbox that provisioning did not reach.
If Keychain storage fails again, keep the key private and stop. Do not create the sandbox until sbx secret set-custom succeeds.
The Key Is Lost or Exposed
Treat a key copied into chat, an issue, or shared logs as exposed. Do not inject it into the sandbox.
- Delete the orphaned identity from Band. You can use Band’s agent management interface or the
DELETE /api/v1/me/agents/{id}endpoint. - Restore
agent.id: replace-with-agent-idin the starter’sband.yaml. - Complete the Keychain preflight.
- Run self-registration again. Use a new
--agent-nameif the orphaned identity could not be deleted.
An orphaned identity still counts against your plan’s agent limit until you delete it.
Credential Custody
The echo bot starter uses credentials.source: proxy-managed.
The real Band key does not enter the VM. The SDK sends the sentinel in the normal authentication field, and the proxy replaces it only for the configured Band host.
After sbx login succeeds, a plaintext workspace env file can bypass proxy-managed agent-secret storage, but it stores the real credential in both the mounted workspace and the VM. It does not bypass Docker authentication. Use it only when proxy injection is unavailable. The annotated band.yaml shows the required acknowledgement and file path.
Replace the Echo Bot with an Agent
The starter’s main.py uses a deterministic echo adapter and no model. Replace it with any runnable Python agent. Keep agent.entrypoint in band.yaml pointed at the file that starts your process.
For a Band framework adapter:
- Replace the echo adapter in
main.py, or replace the file and updateagent.entrypoint. - Add the matching
band-sdkextra and any application dependencies topyproject.toml. - Store each provider credential on the host.
- Allow only the network hosts the agent needs.
- Regenerate and commit
uv.lock.
For example, the first command below stores an Anthropic key in Docker’s host-side secret store. The second permits this sandbox to reach Anthropic. The third resolves the workspace dependencies and updates uv.lock.
After changing dependencies, stop and restart the sandbox. This makes the kit launcher synchronize the updated lockfile before it executes your entrypoint:
Network Access
The kit’s baseline allows Band Cloud plus pypi.org and files.pythonhosted.org, which are required to synchronize locked dependencies in a fresh sandbox. LLM providers, source-control hosts, custom APIs, and non-production Band deployments require explicit per-sandbox rules.
The following commands allow only OpenAI’s API and GitHub for my-band-agent. Add a host only when the code inside that sandbox needs it:
Kit rules are part of the effective sandbox policy, not a complete statement of everything reachable. A selected base policy or organization governance can add, restrict, or override access.
The next command displays allowed and blocked requests for this sandbox so you can identify the exact host behind a failed network call:
Troubleshooting
Source Reference
- Docker Sandbox (
sbx) kit release source - Non-agent echo bot workspace
- Docker Sandbox kits
- Docker
sbx secret set-customCLI reference - Docker Sandbox credential storage