Sandboxes is in Private Preview. Contact Baseten
to request access.
How sandbox images work
Each sandbox starts from an image, the blueprint for its environment. An image is a container image that includes:- Base environment: the operating system and language runtimes, such as Python or Node.js.
- Tools: packages and command-line tools your tasks use.
- Starting files: code, data, and configuration copied into the image.
- Defaults: the memory a new sandbox gets and the ports it exposes.
- Sandbox API server: the process that runs commands and file operations
for MCP tools. A general-purpose container image, such as
python:3.12, doesn’t include it, so a custom image adds it in its Dockerfile.
- Built-in images: ready-made environments maintained by Baseten, such as Base Image with Python. See Choose a built-in image.
- Custom images: images you build from a Dockerfile or import from a registry, versioned per team. See Create a custom image.
- Build: you upload a Dockerfile and source files, or import an existing container image from a registry.
- Version: when the build succeeds, the image gets a new version with a
tag, and its status becomes
BUILT. - Use: each sandbox you create from the image starts from a copy of that version.
Run your first command
-
Install the Baseten CLI, then run
the following command to sign in:
-
If you belong to multiple teams, choose a team
before running sandbox commands.
Run the following command to create a sandbox from the default image:
The command waits for status
DEPLOYED. -
Run the following command to print a message from inside the sandbox:
-
When you’re finished, run the following command to delete the sandbox
and permanently remove its local files:
Confirm when prompted. For unattended scripts,
--yesskips confirmation.
Access a sandbox
After you create a sandbox from an image, it’s ready for work when its status isDEPLOYED. Run commands in it with baseten sandbox exec, or open an
interactive terminal with baseten sandbox connect. To have your coding agent
work in it, let the agent run the same CLI commands.
For more information, see
Run commands in a sandbox.
Baseten permanently removes a sandbox’s local data when it deletes the
sandbox, including when the sandbox expires. Save
results outside the sandbox first.
Next steps
Manage sandboxes
Create sandboxes in the dashboard or CLI, then inspect, update, and delete them.
Preview a sandbox application
Open a running web application through a public or private HTTPS URL.
Manage sandbox images
Choose a built-in image, or create and version your own.
Create a sandbox access token
Authenticate sandbox requests and MCP connections without your API key.
Sandbox lifecycle and expiration
Track deployment status and set an expiration policy.