Prerequisites
Before you begin, you need the following:- W&B APIキー。これらのサンプルでは W&B 認証を使用します。
- Muse Code へのアクセス権がある Meta APIキー。
- サンドボックスからクローンできる公開リポジトリの URL。プライベートリポジトリを使用する場合は、サンドボックス内に Git の認証情報が必要です。
- Python 3.11 以降と
uv、または Node.js 22 以降とnpm。
[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 ホストへのアウトバウンドアクセスを確認してください。
- 規模の大きいタスクがタイムアウトする場合は、実行前にコマンドのタイムアウトとサンドボックスのライフタイムを調整してください。30 分のライフタイムには、起動とインストールにかかる時間も含まれます。詳しくはコマンドのタイムアウトおよびサンドボックスのライフサイクルを参照してください。
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.