CoreWeave Serverless sandboxes are in public preview.
Prerequisites
Before you begin, you need the following:- A W&B API key. These examples select W&B authentication. For other credentials, see Choose a credential.
- A Meta API key with access to Muse Code.
- A public repository URL the sandbox can clone. Private repositories require Git credentials inside the sandbox.
- Python 3.11 or later with
uv, or Node.js 22 or later withnpm.
[WANDB-API-KEY] with your W&B API key and [META-API-KEY] with your Meta API key:
Install the Sandbox client
Choose a language and prepare a local project:- Python
- TypeScript
Run a task in the sandbox
Save the script for your language using the filename shown. Each script creates a serverless sandbox with a 30-minute maximum lifetime and performs these steps:- Installs Muse Code with Meta’s installer.
- Clones your repository into the
/workspace/projectdirectory. - Runs
muse execto build and test a sparkline CLI that renders numbers as a small chart. - Runs the generated CLI independently, checks its output, and saves the
sparkline.mjsfile locally. - Stops the sandbox in a
finallyblock, including when setup or execution fails.
muse --version after installation.
The example uses --yolo to disable Muse Code’s approval prompts and operating system (OS) sandbox and trust the workspace for this run. CoreWeave supplies the outer sandbox. Muse can access files, credentials, and network destinations available inside that sandbox. Use a repository you trust and provide only the credentials the task needs. For more information, see Muse Code permissions.
- Python
- TypeScript
run_muse.py
[REPOSITORY-URL] with your public repository URL, then run the script:
- Python
- TypeScript
sparkline.mjs file in your local project directory, then stops the sandbox. If the file already exists locally, the script overwrites it. The output check runs independently of Muse’s own test and verifies this example’s input. For a larger task, replace it with tests for your requirements.
These examples don’t configure persistent storage. Copy the files you need out of the sandbox before the finally block runs. See file operations and file system snapshots.
Troubleshoot
Use these checks to resolve common issues:- If sandbox creation fails, check your W&B key and authentication settings.
- If Muse Code reports an authentication error, check
META_API_KEYand your Meta account setup. The sandbox credential doesn’t authenticate model requests. - If installation, cloning, or model requests fail, check outbound access to Meta and your Git host. These examples use serverless placement. To use your own CoreWeave Kubernetes Service (CKS) cluster, switch to a CoreWeave API access token and the client settings in Configure CKS placement and policy. Confirm that the runner’s policy grants egress to those destinations.
- If a larger task times out, adjust the command timeout and sandbox lifetime before running it. The 30-minute lifetime includes startup and installation. See command timeouts and sandbox lifecycle.
Next steps
For more information, see these guides:- Interactive shells and TTY covers terminal access for interactive agents.
- Run agents on CoreWeave sandboxes compares agent integrations and workspace options.
- Meta’s sandboxed execution cookbook demonstrates a reproduce, fix, and verify workflow with a custom tool loop in Docker.
- Muse Code documentation covers agent configuration and other CLI workflows.