Runtime Environment
Attach key-value tags to sandboxes, scaling groups, and functions for organization and filtering.
Tags apply to sandboxes, scaling groups, and functions. A tag is an arbitrary key-value pair that you attach for organization and filtering.
From the SDK, pass a dictionary to tags. A sandbox:
from chalkcompute import Image, Sandbox
sandbox = Sandbox(
image=Image.debian_slim(),
name="tagged-sandbox",
tags={"team": "ml", "version": "2.1"},
).run()
A scaling group:
import chalkcompute
img = chalkcompute.Image.debian_slim("3.12").entrypoint(
["python", "-m", "http.server", "8080"]
)
sg = chalkcompute.ScalingGroup(
image=img,
name="my-service",
port=8080,
tags={"team": "ml", "version": "2.1"},
).deploy()
A function takes the same argument, @chalkcompute.function(tags={"team": "ml"}), and passes the
tags to the scaling group it runs on.
From the CLI, pass comma-separated key=value pairs to --tags on chalk sandbox create or
chalk scaling-group create:
$ chalk scaling-group create \
--image=my-registry/my-app:v1 \
--name=my-service \
--max-replicas=1 \
--port=8080 \
--tags="team=ml,version=2.1"
A sandbox’s tags appear under spec.tags in the output of chalk sandbox get --json:
$ chalk sandbox get --name tagged-sandbox --json
A scaling group’s tags are applied as Kubernetes labels with the prefix chalk.ai/tag-, making
them visible in standard Kubernetes tooling.