Skip to main content

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.

Pass configuration options directly to Sandbox.run():
from cwsandbox import Sandbox

with Sandbox.run(
    container_image="python:3.11",
    max_lifetime_seconds=300,
    tags=["my-app"],
) as sandbox:
    sandbox.exec(["python", "--version"]).result()

Resources

Use ResourceOptions to configure CPU and memory requests and limits:
from cwsandbox import ResourceOptions, Sandbox

with Sandbox.run(
    resources=ResourceOptions(
        requests={"cpu": "1", "memory": "1Gi"},
        limits={"cpu": "2", "memory": "2Gi"},
    ),
) as sandbox:
    sandbox.exec(["python", "compute.py"]).result()
Uses Kubernetes resource syntax:
ResourceFormatExamples
CPUCores or millicores"1", "2", "500m" (0.5 CPU)
MemoryBytes with unit suffix"512Mi", "1Gi", "2Gi"

Mounted files

Pre-populate files at sandbox startup:
with Sandbox.run(
    mounted_files=[
        {"path": "/app/config.json", "content": '{"debug": true}'},
        {"path": "/app/script.py", "content": "print('hello')"},
    ]
) as sandbox:
    sandbox.exec(["python", "/app/script.py"]).result()
Mounted files are read-only. Use write_file() for files that need modification.
For reusable configuration across multiple sandboxes, use SandboxDefaults. See the sandbox configuration guide for all ResourceOptions fields, GPU resources, QoS classes, and config-library interop.
Last modified on April 21, 2026