Update an environment
Changes any mix of the environment’s settings in one atomic write and creates its next revision. The body is a merge patch: an omitted setting keeps its current value. This is how you deploy, scale, and change variables.
What happens to running instances depends on what changed. A change to the image, weights,
CPU or memory, extra_args, or variables replaces the instances by deployment_strategy.
A change to instances alone adds or removes instances and replaces none. A change to the
accelerator list replaces only the instances that move to another configuration. A write
that changes nothing creates no revision and returns the environment as it was.
The result must be complete: it needs an image, instances, and
resources.accelerators ([] is CPU). Otherwise the write returns 409 failed_precondition with reason environment_incomplete and lists missing_fields.
Writes to one environment apply in order, and the last write wins. Send If-Match with
the ETag you read to refuse a stale write with 412 etag_mismatch. After a 500 or a
lost response, read the environment before you retry: the write may have landed.
Requires the account_admin or developer role and Serve access. All environments of an
account share its per-region accelerator quota.
Authorizations
A Reactor API key (rk_...), sent as Authorization: Bearer rk_.... Keep it on a server.
Headers
The ETag of your last read, a revision number in quotes. If the environment's newest revision differs, the write is 412 etag_mismatch and nothing is written. A weak tag, a list, or * is 400.
"\"3\""
Path Parameters
The project's ID, a UUID. It is not the model's ID.
The environment's ID (a UUID) or its name, such as production. A name matches only a live environment; a deleted environment is reachable by its ID only.
Body
A merge patch of the environment's settings. Read-only fields (id, project_id,
name, revision, created_at, deleted_at, public, node_selector) are accepted
only with their current values, so you can send back an object you read.
The image to run. Send tag, ref, both (they must name the same image), or digest
alone. A tag is a model image tag, or a release of the model; a tag wins over a release
of the same name. A 12 to 64 character lowercase hex tag that no tag has names the image
whose digest it starts. A digest is sha256:<64 hex> or a 12+ character hex prefix. A
ref, a digest, or such a hex tag runs the image with no release.
A weight set of the project, by sha256:<64 hex> set digest, a weights tag, a release
whose bundle is a weight set, or a 12+ character hex prefix. null clears the pin.
Omitted keeps the current pin. A string needs weight sets enabled for your account.
A merge patch. An absent key keeps its value.
The full list. [] clears it.
The full declaration. It replaces the current one.
A merge patch by name. An entry replaces the stored entry whole; null removes it; an absent name keeps it and its pin.
How replaced instances roll. Applies to this write only; never inherited.
ROLLING, REPLACE_ALL End live sessions on replaced instances after the replacement. Needs REPLACE_ALL. Applies to this write only.
Response
The environment after the write. revision names the new revision, or the same one when nothing changed.
The environment's ID. It is neither the project's nor the model's ID.
The current image. For production, the deployed release's image. Null for another environment before its first revision.
The pinned weights. Null when none are pinned.
What each instance gets.
Extra arguments passed to the model container.
Read-only.
The current revision. Null before the first revision.
When true, any authenticated caller can open sessions on production. It grants no read. Read-only for customers.
When the environment was deleted. A deleted environment takes no writes.
Variables keyed by name. Names use letters, digits, _, -, and ., with no leading
digit. Reserved names such as MODEL_NAME and any REACTOR_ name are refused.