Update Environment

Updated at:

Uses partial update semantics: fields included in the request are updated, while omitted fields retain their original values. Active sessions use the snapshot bound at creation time; new sessions use the updated environment.

Prerequisites

Endpoint and authentication are configured. See Overview and authentication.

Endpoint

POST/environments/{environment_id}

Semantics

Uses partial update semantics: fields included in the request body are updated, while omitted fields retain their original values. Active sessions bound to this environment use the snapshot from binding time and are not affected by the update; new sessions use the updated environment.

  • config.type is immutable; passing a different value will cause an error.
  • config.packages is replaced as a whole when provided (including sub-keys apt, pip, etc.); unlisted packages will be removed.
  • metadata is replaced as a whole when provided; key-level merging is not performed.

Path parameters

environment_idstringRequired

Environment ID, format env_<ULID>

Request body

namestringOptional

Environment name; omitted fields retain their original values

descriptionstringOptional

Environment description; omitted fields retain their original values

scopestringOptional

Scope. organization: visible to and reusable by all workspace members; omitted fields retain their original values

config.typestringOptional

cloud cloud container. Immutable after creation

config.packagesobjectOptional

Preinstalled dependencies grouped by package manager. Replaced as a whole when provided

config.networkingobjectOptional

Network policy object with the structure {"type": "unrestricted"}. Replaced as a whole when provided

metadataobjectOptional

Custom business key-value pairs. Replaced as a whole when provided; key-level merging is not performed

Request example

curl -X POST "$AGENTSTUDIO_URL/environments/env_xxx" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "data-sandbox",
    "description": "Data analysis sandbox (updated)",
    "scope": "organization",
    "metadata": {"team": "infra"},
    "config": {
      "type": "cloud",
      "packages": {"apt": ["ffmpeg"], "pip": ["pandas", "numpy", "scikit-learn"]},
      "networking": {"type": "unrestricted"}
    }
  }'
env = client.environments.update(
    "env_xxx",
    name="data-sandbox",
    description="Data analysis sandbox (updated)",
    config={
        "type": "cloud",
        "networking": {"type": "unrestricted"},
        "packages": {"apt": ["ffmpeg"], "pip": ["pandas", "numpy", "scikit-learn"]},
    },
    metadata={"team": "infra"},
)
Environment u = client.environments().update("env_xxx",
    EnvironmentUpdateParam.builder()
        .name("data-sandbox")
        .description("Data analysis sandbox (updated)")
        .build());

Response fields

idstring

Environment ID

typestring

Fixed value environment

namestring

Environment name

descriptionstring

Environment description

scopestring

Scope. organization: visible to and reusable by all workspace members

configobject

Complete runtime configuration. Contains the following sub-fields:

config properties

typestring

cloud cloud container

packagesobject

Preinstalled dependencies grouped by package manager. Keys are apt / pip / npm; values are package name arrays

packages properties

aptarray<string>

Debian/Ubuntu package names

piparray<string>

Python package names

npmarray<string>

Node.js package names

networkingobject

Network policy object with the structure {"type": "unrestricted"}

networking properties

typestring

Currently only unrestricted

metadataobject

Custom business key-value pairs that do not affect runtime behavior

archived_atstring | null

Archive time; null when not archived

created_atstring

Creation time (ISO 8601)

updated_atstring

Last update time (ISO 8601)

request_idstring

Unique identifier for this request

Response example

{
  "id": "env_xxx",
  "type": "environment",
  "name": "data-sandbox",
  "description": "Data analysis sandbox (updated)",
  "config": {
    "type": "cloud",
    "packages": {"apt": ["ffmpeg"], "pip": ["pandas", "numpy", "scikit-learn"]},
    "networking": {"type": "unrestricted"}
  },
  "metadata": {"team": "infra"},
  "scope": "organization",
  "archived_at": null,
  "created_at": "2026-06-16T12:45:34+08:00",
  "updated_at": "2026-06-16T12:52:31+08:00",
  "request_id": "xxx"
}

The response is the updated Environment object. Fields are as follows: