GITHUB_ORG in the image registry examples with your GitHub Container Registry organization or user name.
To apply an example, follow Update a policy. Read the current policy and its etag together, then prepare the complete policy document and submit it with the etag from that read. Replacing the root policy clears any omitted groups, so retain every setting you want to preserve.
GPU data science cluster
A cluster for long-lived per-user work with generous compute and GPU Nodes. Its default egress grant covers all IPv4 destinations except the instance metadata address169.254.169.254/32. This range includes private IPv4 addresses and can support dataset and package downloads where routing and destination access permit.
policy.json
maxGpuCount value of 2 permits up to 2 GPUs per container, but doesn’t raise your organization’s GPUs-per-sandbox limit. Before requesting 2 GPUs, confirm that your organization has a limit of at least 2. See GPUs per sandbox.
This policy sets cw-kata-qemu as the default CPU runtime class and permits explicit runtime class pins only for cw-kata-qemu. For GPU sandboxes, leave runtime_class and defaultGpuRuntimeClass unset. Use it with the supported CoreWeave Kubernetes Service (CKS) GPU configuration described in Run a GPU sandbox. GPU sandboxes in that configuration use runc without virtualization and must run only trusted code. Kata-based GPU runtime classes aren’t supported on customer CKS clusters.
Shared agent cluster with allowlisted egress
A multi-tenant cluster for agent workloads. The policy permits requests to two classless inter-domain routing (CIDR) ranges on TCP port443. It also permits requests for egress to other sandboxes in the organization. Only the first CIDR grant applies by default.
policy.json
spec.network.egress list and spec.network.denyEgress unset or false, a sandbox inherits only 140.82.112.0/20 on TCP port 443. An explicit list can include both allowed ranges and the same-organization tenant rule as needed. Explicit rules replace the defaults entirely, so include every required grant in that list, including the first CIDR range if you need it. Platform DNS and storage access are granted separately.
Ephemeral CI cluster
Short-lived, small, and narrow. Sandboxes exist for the length of a test run.policy.json
max_lifetime_seconds on the create request.
VM-isolated execution with no default egress
This policy requires virtual machine (VM) isolation, forbids GPU requests, and supplies no default egress rules. It blocks outbound DNS traffic on UDP/TCP port53, but permits sandboxes to declare other egress because allowedEgress is empty.
policy.json
allowedImages pins one image rather than a registry, so a sandbox can’t select an arbitrary image from a trusted registry.
Internal worker cluster
A policy for long-running background workers with same-organization egress by default. Workers can explicitly request additional egress for third-party API calls.policy.json
10.0.0.0/8 and the instance metadata address 169.254.169.254/32. It still includes the private ranges 172.16.0.0/12 and 192.168.0.0/16. These exclusions narrow only the CIDR rule. The tenant rule separately permits requests for same-organization egress.
With an omitted or empty spec.network.egress list and spec.network.denyEgress unset or false, workers inherit only the same-organization destination grant. To call a third-party API, request its destination CIDRs with the required ports in that egress list. To also initiate connections to sibling sandboxes, include TENANT_SCOPE_SAME_ORG in the same list. Explicit rules replace the defaults entirely. The Curated egress template shows both rule types. Platform DNS and storage access are granted separately.
This example sets egress only. To constrain inbound access to
CUSTOM-visibility ports, add allowedIngress and, if needed, defaultIngress. See Constrain network access.Pin admin defaults with the base layer
Any of the previous policies can also carry abase fragment with admin attachments inherited by sandboxes on the runner. This variant retains the internal worker policy’s network constraints and adds a Node selector, a pull Secret for the private registry, and a cost-attribution label. The same egress defaults, IPv4 exclusions, and explicit request requirements apply.
policy.json
base fragment is a Kubernetes Pod-specification subset, and unknown keys are rejected. Both base and constraints use camelCase keys in this JSON example. It accepts scheduling and runtime configuration only: nodeSelector, tolerations, imagePullSecrets, volumes, topologySpreadConstraints, hostAliases, DNS settings, a single containers entry limited to name, env, envFrom, volumeMounts, and volumeDevices, and Pod labels and annotations. Security-sensitive fields are rejected: securityContext, runtimeClassName, initContainers, affinity, host namespaces, hostPath volumes, non-default ServiceAccounts, and namespace, which stays runner-owned. Typed concerns such as lifetime, images, and egress belong in constraints, not in base.
On a CKS cluster, template attachments specialize this fragment per template:
imagePullSecretsandtolerationsare unioned and deduplicated.- Other lists append.
nodeSelector, Pod label, and Pod annotation map keys are overridden per key.- Same-name conflicts reject the create.
base, see the base layer.
Vary the posture across clusters
Because a policy belongs to a cluster, different postures are different clusters rather than different documents on one cluster. A team that needs both an open data science environment and a locked-down execution environment runs two clusters and gives each the matching policy. To vary one dimension by region, apply the same policy to each cluster with the region-specific values changed. No shared or inherited policy document exists, so keep the source of truth in version control and apply it per cluster.See also
For related guidance, see the following pages:- Configure a sandbox policy: every constraint group, with the fields used in these examples.
- Policies overview: how a sandbox resolves against a policy.
- Agentic RL training: reward functions and multi-turn agent rollouts, with working Python.
- Deploy and manage a runner: the rest of the runner configuration.