> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 複数のサンドボックス

> 共有デフォルトを持つセッションを使用した複数 CoreWeave サンドボックスインスタンスの管理方法に関するチュートリアル

これらの例では、`CWSANDBOX_API_KEY` に設定した CoreWeave API アクセストークンを使用します。Forge APIキーによる認証については、[はじめに](/ja/products/sandboxes/get-started) を参照してください。CKS の要件については、[配置モード](/ja/products/sandboxes/placement) を参照してください。

This example shows how to run multiple CoreWeave sandboxes in parallel using a session. A session applies shared デフォルト across the sandboxes and cleans them up automatically when the ブロック exits. Use this pattern to coordinate work across several sandboxes without managing each lifecycle individually.

Sessions manage multiple sandboxes with shared デフォルト and automatic cleanup:

```python theme={"system"}
from cwsandbox import Sandbox, SandboxDefaults

defaults = SandboxDefaults(container_image="python:3.11", tags=("my-app",))

with Sandbox.session(defaults) as session:
    sb1 = session.sandbox()
    sb2 = session.sandbox()

    p1 = sb1.exec(["echo", "one"])
    p2 = sb2.exec(["echo", "two"])

    print(p1.result().stdout, p2.result().stdout)
# すべてのサンドボックスがクリーンアップされました
```

サンドボックスプール、取り込みパターン、およびライフサイクル管理については、[Sessions ガイド](/ja/products/sandboxes/client/guides/sessions) を参照してください。
