This feature is currently in private preview. During the preview, the Agent Drive feature is only available in the
us-was-1 region. Both your drive and your sandbox must be created in this region. Drive size is not configurable at the moment. A quotas system for drive storage is coming soon. Request access.- A drive can be attached to an already-running sandbox at any mount path, without needing to recreate the sandbox.
- Multiple sandboxes can mount the same drive simultaneously with full read-write access.
- A specific subdirectory of a drive can be mounted using
drivePath(instead of mounting the entire drive). - Drives scale automatically with no fixed capacity limits. Pre-provisioning or run-time resizing is not required.
Use cases
Some examples of use cases are:- Passing data or files from one sandbox to another directly, without needing intermediary storage or services
- Storing tool call outputs and context histories for use in other agents
- Sharing common datasets across agents
- Creating a shared filesystem cache of package dependencies to speed up future agent/sandbox deployments
Create a drive
Learn more about authentication on Blaxel
Learn more about authentication on Blaxel
The Blaxel SDK requires two environment variables to authenticate:When developing locally, you can also log in to your workspace with Blaxel CLI (as shown above). This allows you to run Blaxel SDK functions that will automatically connect to your workspace without additional setup. When you deploy on Blaxel, authentication is handled automatically — no environment variables needed.
You can create an API key from the Blaxel console. Your workspace name is visible in the URL when you log in to the console (e.g.
app.blaxel.ai/{workspace}).Set them as environment variables or add them to a .env file at the root of your project:name and region. You can also optionally specify the display name and labels for the drive.
createIfNotExists() to retrieve an existing drive or create a new one if it doesn’t exist:
Mount a drive to a sandbox
Mount a drive to a running sandbox by specifying thedriveName, the mountPath (where the drive will appear in the sandbox’s filesystem), and optionally the drivePath (a subdirectory within the drive to mount).
/mnt/data inside the sandbox will be stored on the drive and persist even after the sandbox is deleted.
Mount a subdirectory
You can mount a specific subdirectory of a drive rather than its root. This is useful when a single drive contains multiple project directories:drivePath / drive_path controls the subtree visible to the sandbox. When combined with drive permissions, you can restrict a workload to a specific subfolder of a drive using the path field in a permission rule.Mount a drive as read-only
You can mount a drive in read-only mode:When drive permissions are configured with
mode: "read", read-only access is enforced both at the FUSE mount level and at the storage server level. The workload’s identity token is validated against the permission rules, preventing unauthorized remounting in read-write mode.Access a drive over S3
Every drive also exposes an S3-compatible HTTP endpoint, so you can read and write its contents directly from any S3 client, such as the AWS CLI, boto3, or the AWS SDK for JavaScript, without mounting the drive into a sandbox first. Requests must use SigV4 signing and path-style addressing (the bucket in the path, not the hostname). Credentials are a service account’s API key:AWS_ACCESS_KEY_ID is the API key’s record ID and AWS_SECRET_ACCESS_KEY is its raw secret value — not the service account’s OAuth client ID/secret pair. Personal API keys and OAuth tokens are not supported for S3 access.
API keys created before S3 support was added may not work for SigV4 signing and will return
InvalidAccessKeyId. If you hit this error, create a new API key for the service account (or rotate the existing one) and use the new credentials.Find a drive’s S3 endpoint and bucket
The endpoint is returned in the drive’s state ass3Url, in the form {endpoint}/{bucket}:
s3Url; the rest of the URL is the endpoint to pass to your S3 client.
The Blaxel CLI does not currently expose the S3 endpoint via
bl drive get. Use the TypeScript or Python SDK to retrieve it until CLI support is added.Use the AWS CLI
Export the service account’s API key as AWS-style credentials, then use standardaws s3 commands with --endpoint-url and --region set to the drive’s endpoint and region:
List mounted drives
List all drives currently mounted to a sandbox:List all drives
To retrieve all drives in your workspace, use the built-in SDK pagination helper functions.Pagination is recommended for list operations because retrieving all available resources in a single request is slow and resource-intensive, and therefore does not scale well.
data array and a meta object:
meta.nextCursor as cursor on the next request and repeat until meta.hasMore is false:
Get drive details
Retrieve details about a specific drive:CLI
Unmount a drive
Unmount a drive from a running sandbox by specifying the mount path:Delete a drive
Full example
The following example creates a drive, creates a sandbox from a custom sandbox image using its image ID, mounts the drive, writes a file to the mounted path, and reads it back:Drive permissions
Restrict which sandboxes, agents, or jobs can access a drive.
Sandboxes overview
Learn about sandbox lifecycle and configuration.
