CoreWeave sandboxes are in public preview. For access, contact your CoreWeave account team, CoreWeave Support, or email support@coreweave.com.
Choose a placement mode
Placement mode decides which runners a sandbox can land on. Serverless is the default: omit the mode and the platform places the sandbox on a CoreWeave-operated pool.
You don’t have to pick one permanently. Once you’ve set up both, Spill over between modes covers falling back from one to the other when the first can’t place a sandbox.
Run a sandbox on serverless capacity
Serverless placement needs no runner and no policy of your own. You need the following:- Serverless enabled for your organization. If it isn’t, sandbox creation fails with
CWSANDBOX_SERVERLESS_NOT_ALLOWED. Contact support to request access. - A credential, either a CoreWeave API access token or a Weights & Biases API key. See Choose a credential.
Choose a credential
Serverless accepts two credentials, and which one you present decides which account the sandbox belongs to and bills to.
The credential identifies your organization on its own. No organization or cluster field appears in the request.
Two limits apply to the W&B path today:
- The Python client has no built-in W&B credential path. Its built-in auth mode reads
CWSANDBOX_API_KEYand sends it as a bearer token. To present a W&B key from Python, register your own auth mode withset_auth_mode. - W&B Dedicated customers can’t reach serverless sandboxes with the API key from their dedicated instance. Supporting it is new authorization and billing work. Until then, use a CoreWeave access token if your organization is also a CoreWeave customer, or a W&B trial account.
Serverless sandbox usage is metered while the product is in public preview, but charges aren’t posted until the product reaches general availability.
[API-ACCESS-TOKEN] with the Token Secret value:
[WANDB-API-KEY] with the key from wandb.ai/authorize:
- Python
- TypeScript
- curl
Sandbox.run() defaults to serverless placement. Pass placement_mode="serverless" to state it explicitly.Deploy sandboxes on your own CKS cluster
The rest of this page walks through the CKS path end to end. You’ll do the following:- Deploy a runner and set the policy it carries.
- Run your first sandbox from the Python client.
- Delete the runner when you’re done.
cwic) and through direct curl calls against the control plane REST API. Pick whichever fits your workflow. The wizard and from-file cwic tabs are equivalent. The from-file and curl tabs accept YAML or JSON bodies, which makes them a natural interface for CI scripts and for agents (such as Claude Code or Codex) that author runner and policy documents on your behalf.
Prerequisites
For the administrator steps, complete the following:- A CKS cluster in your CoreWeave organization, in the
STATUS_RUNNINGstate. View your clusters and their status on the Clusters page in the cloud console. Note the cluster’s zone and name. Both are reused in later steps. - The
SANDBOX_ADMINaction in Identity and Access Management (IAM), which lets you create runners and set their policy. Create or update an access policy that grants this action on the Access Policies page in the cloud console. - A CoreWeave API access token. Generate one from the Tokens page in the cloud console and copy the Token Secret value. For more information about tokens, see Manage API Access Tokens.
- cwic
- curl
Install the CoreWeave Intelligent CLI (The token is stored in your local cwic config. Subsequent cwic commands read it automatically. No environment variable is required.
cwic), then sign in with the token:- The
SANDBOX_USERIAM action, which lets you create sandboxes against the data plane. GrantingSANDBOX_ADMINalso grantsSANDBOX_USER. - A CoreWeave API access token. For more information, see Manage API Access Tokens.
- Python 3.11 or newer in the environment that runs the SDK. The Python version inside the sandbox is independent and is set by the
container_imageyou pass toSandbox.run().
Deploy a runner and set its policy
A runner is the Kubernetes workload that schedules sandbox pods on your cluster. CoreWeave operates the runner; you deploy it on a specific cluster. Every runner carries exactly one policy, and a cluster hosts at most one runner, so this policy governs every sandbox on the cluster. The policy states what sandboxes may request and what they get by default. A policy must bound sandbox lifetime. The following example policy denies all outbound network access and caps sandboxes at one hour. Adjust it for your environment: widenallowedEgress to permit specific destinations, and raise the resource ceilings as needed. For every constraint group, see Configure a sandbox policy.
Save it as policy.json:
policy.json
- Cloud console
- cwic
- curl
- Open the Clusters page in the cloud console.
- Select the cluster you want to deploy a runner on.
- In the Sandbox runner card, click Enable sandbox runner.
Pending to Ready. The runner then accepts sandbox requests.Set the policy afterward with cwic or curl, using one of the following tabs.Run your first sandbox
Wait for the runner to reach theReady state before you send sandbox requests:
-
Cloud console: Open the cluster’s Sandbox runner card and watch the status badge until it shows
Ready. -
cwic: Run
cwic sandbox runner get [RUNNER-ID]and look forINSTALLto beREADY. For a longer view, usecwic sandbox runner describe [RUNNER-ID]. -
curl: Poll the runner until
installStatusisREADY:
Ready, anyone in your organization with a CoreWeave API access token can create sandboxes against it. The remaining steps cover the researcher workflow: install the Python SDK, set an API token, and run a sandbox against the runner.
To install the SDK, run:
[API-ACCESS-TOKEN] with that value and set it as CWSANDBOX_API_KEY:
Hello! appears in the output. To target one specific runner rather than any CKS runner in your organization, pass runner_ids=["[RUNNER-ID]"] alongside placement_mode="cks".
This example does the following:
Sandbox.run()creates a sandbox and returns it inside a context manager. The sandbox tears down on context exit.exec()runs a command inside the sandbox and returns aProcessobject..result()waits for the command to complete and returns the output.
Disable the runner
When you no longer need sandboxes on the cluster, disable the runner. The runner is removed from the cluster and stops accepting sandbox requests. For a clean teardown, stop running sandboxes from the Python client before you disable the runner.- Cloud console
- cwic
- curl
- Open the cluster’s Sandbox runner card.
- Click Disable sandbox runner and confirm.
Spill over between modes
When your organization can reach both serverless capacity and a CKS runner, spillover retries sandbox creation once in the alternate mode when the first mode can’t place the request, whether because of capacity, no suitable runner, an unavailable or overloaded runner, or an unsatisfied placement constraint. It’s a Python client option, available incwsandbox 1.0.0 and later:
serverless_then_cks for the reverse order. Both directions have constraints:
cks_then_serverlessrequiresplacement_mode="cks"or an unset mode. An explicitplacement_mode="serverless"raisesValueError.serverless_then_cksrequiresplacement_mode="serverless"or an unset mode, and can’t be combined withrunner_ids.- Sandboxes created from a template accept only the default,
strict, which honorsplacement_modeand never retries.
Next steps
The following resources cover next steps:- The Python client page introduces the SDK and links into reference material.
- The Python client tutorial walks through configuration, command execution, file operations, and cleanup.
- The Python client guides cover lifecycle, streaming, RL training, SWE-bench, SUNK integration, and other advanced topics.