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.

Source: src/cwsandbox/_defaults.py:66
class SandboxDefaults(container_image: str = DEFAULT_CONTAINER_IMAGE, command: str = DEFAULT_COMMAND, args: tuple[str, ...] = DEFAULT_ARGS, base_url: str = DEFAULT_BASE_URL, request_timeout_seconds: float = DEFAULT_REQUEST_TIMEOUT_SECONDS, max_lifetime_seconds: float | None = DEFAULT_MAX_LIFETIME_SECONDS, temp_dir: str = DEFAULT_TEMP_DIR, tags: tuple[str, ...] = tuple(), profile_ids: tuple[str, ...] | None = None, runner_ids: tuple[str, ...] | None = None, resources: dict[str, Any] | None = None, network: NetworkOptions | None = None, secrets: tuple[Secret, ...] | None = None, environment_variables: dict[str, str] = dict(), annotations: dict[str, str] = dict())
Immutable configuration defaults for sandbox creation. All fields have sensible defaults. Override only what you need. There are two separate timeout concepts:
  • request_timeout_seconds: How long to wait for API responses (client-side)
  • max_lifetime_seconds: How long the sandbox runs before auto-termination (server-side)
If not set, the backend controls the default lifetime. Tags enable filtering and organizing sandboxes. They are propagated to the backend and can be used to query sandboxes by tag. Attributes
  • container_image (str) : Docker image for the sandbox container. Default: DEFAULT_CONTAINER_IMAGE.
  • command (str) : Entrypoint command to run. Default: DEFAULT_COMMAND.
  • args (tuple[str, ...]) : Arguments passed to the command. Default: DEFAULT_ARGS.
  • base_url (str) : CWSandbox API endpoint URL. Default: DEFAULT_BASE_URL.
  • request_timeout_seconds (float) : Client-side HTTP timeout in seconds. Default: DEFAULT_REQUEST_TIMEOUT_SECONDS.
  • max_lifetime_seconds (float | None) : Server-side sandbox lifetime limit in seconds. None lets the backend control the default. Default: DEFAULT_MAX_LIFETIME_SECONDS.
  • temp_dir (str) : Temp directory path inside the sandbox. Default: DEFAULT_TEMP_DIR.
  • tags (tuple[str, ...]) : Tags for filtering and organizing sandboxes. Default: field(default_factory=tuple).
  • profile_ids (tuple[str, ...] | None) : Restrict to specific profile IDs.
  • runner_ids (tuple[str, ...] | None) : Restrict to specific runner IDs.
  • resources (dict[str, Any] | None) : Resource requests (CPU, memory, GPU) as a dict.
  • network (NetworkOptions | None) : Network configuration via NetworkOptions.
  • secrets (tuple[Secret, ...] | None) : Secrets to inject as environment variables.
  • environment_variables (dict[str, str]) : Environment variables injected into the sandbox. Default: field(default_factory=dict).
  • annotations (dict[str, str]) : Kubernetes pod annotations (key-value string pairs). Merged with per-sandbox annotations; explicit values override defaults. Use for non-sensitive metadata only. Default: field(default_factory=dict).

Methods

merge_tags

merge_tags(additional: list[str] | None) -> list[str]
Combine default tags with additional tags. Tags from both sources are included. Order is: defaults first, then additional tags appended.

merge_environment_variables

merge_environment_variables(additional: dict[str, str] | None) -> dict[str, str]
Combine default environment variables with additional ones. Additional environment variables override defaults with the same key.

merge_annotations

merge_annotations(additional: dict[str, str] | None) -> dict[str, str]
Combine default annotations with additional ones. Additional annotations override defaults with the same key.

with_overrides

with_overrides(**kwargs: Any = {}) -> SandboxDefaults
Create new defaults with some values overridden.

from_dict

from_dict(d: Mapping[str, Any] | None) -> SandboxDefaults
Build SandboxDefaults from a mapping, coercing nested fields. Accepts plain dicts or OmegaConf DictConfig objects. Unknown keys are silently ignored so callers can pass a config section that may contain extra fields. Coercions applied:
  • network dict -> NetworkOptions
  • secrets list of dicts -> tuple of Secret
  • args, tags, profile_ids, runner_ids lists -> tuples
  • resources, environment_variables -> plain dict
Last modified on May 1, 2026