Runtime Environment
Give a sandbox, scaling group, or function a Chalk identity so code inside it can call Chalk APIs without a client ID or secret.
A Chalk workload identity applies to sandboxes,
scaling groups, and functions.
Each one receives an identity only when you set chalk_identity=True from the SDK, or pass
--chalk-identity from the scaling group CLI.
With chalk_identity=True, Chalk mounts a Chalk token into the container and sets
CHALK_WEB_IDENTITY_TOKEN_FILE, CHALK_API_SERVER, and CHALK_ENVIRONMENT. ChalkClient and
chalkcompute read these variables, so code in the container can call Chalk APIs without a client
ID or secret.
A sandbox:
from chalkcompute import Image, Sandbox
sandbox = Sandbox(image=Image.debian_slim(), chalk_identity=True).run()
result = sandbox.exec("sh", "-c", "echo $CHALK_WEB_IDENTITY_TOKEN_FILE")
print(result.stdout_text) # /var/run/secrets/chalk/identity-token
sandbox.terminate()
A scaling group:
import chalkcompute
img = chalkcompute.Image.debian_slim("3.12").entrypoint(
["python", "-m", "http.server", "8080"]
)
sg = chalkcompute.ScalingGroup(
image=img,
name="hello-api",
port=8080,
chalk_identity=True,
).deploy()
A function takes the same argument, @chalkcompute.function(chalk_identity=True), and passes it
to the scaling group it runs on.
Chalk workload identities are OIDC-compliant. If your organization runs services that accept federated tokens (e.g. an internal model registry or a secrets manager), you can configure them to trust the Chalk identity provider directly. This lets a workload authenticate to your infrastructure without static credentials:
sub claim to an appropriate role or policy.No secrets need to be injected into the workload’s environment.