Prerequisites
Before you begin, you need the following:- W&B API 키. 이 예시에서는 W&B 인증을 사용합니다.
- Muse Code 액세스 권한이 있는 Meta API 키.
- 샌드박스에서 클론할 수 있는 공개 저장소 URL. 비공개 저장소를 사용하려면 샌드박스 안에 Git 자격 증명이 있어야 합니다.
uv가 설치된 Python 3.11 이상 또는npm이 설치된 Node.js 22 이상.
[WANDB-API-KEY]는 W&B API 키로, [META-API-KEY]는 Meta API 키로 바꾸세요.
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.
이 예시에서는 영구 저장소를 설정하지 않습니다. finally 블록이 실행되기 전에 필요한 파일을 샌드박스 밖으로 복사하세요. 자세한 내용은 파일 오퍼레이션 및 파일 시스템 스냅샷을 참조하세요.
Troubleshoot
Use these checks to resolve common issues:- 샌드박스 생성에 실패하면 W&B 키와 인증 설정을 확인하세요.
- Muse Code에서 인증 오류가 발생하면
META_API_KEY와 Meta 계정 설정을 확인하세요. 샌드박스 자격 증명은 모델 요청 인증에 사용되지 않습니다. - 설치, 클론 또는 모델 요청에 실패하면 Meta와 Git 호스트로의 아웃바운드 액세스를 확인하세요.
- 규모가 큰 작업에서 시간 초과가 발생하면 실행 전에 명령 timeout과 샌드박스 수명을 조정하세요. 30분의 수명에는 시작 및 설치 시간이 포함됩니다. 자세한 내용은 명령 timeout 및 샌드박스 라이프사이클을 참조하세요.
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.