A runtime environment defines the execution sandbox for tool calls. Create and manage environments on the Environments page in the console. An environment can be reused across multiple sessions.
Types
Type | Description |
Cloud | A sandbox container managed by Model Studio, ready to use out of the box. Once created, it can be bound to sessions |
Configuration Fields
On the Environments page, click Add Environment and fill in the following fields:
Field | Required | Mutable | Description |
Name | Yes | Yes | Unique identifier within the workspace |
Description | No | Yes | Description of the environment purpose |
Hosting type | No | No |
|
Packages | No | Yes | Declared by package manager ( |
Network policy | No | Yes |
|
Scope | No | Yes |
|
Metadata | No | Yes | Custom key-value pairs (corresponds to the |
When creating an environment via the API, specify the sandbox type and packages. For complete parameters and response fields, see Create an environment.
curl -X POST "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/environments" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "data-sandbox",
"description": "Data analysis sandbox",
"config": {
"type": "cloud",
"packages": {
"apt": ["ffmpeg"],
"pip": ["pandas", "numpy", "matplotlib"]
},
"networking": {"type": "unrestricted"}
}
}'env = client.environments.create(
name="data-sandbox",
config={
"type": "cloud",
"networking": {"type": "unrestricted"},
"packages": {
"apt": ["ffmpeg"],
"pip": ["pandas", "numpy", "matplotlib"],
},
},
description="Data analysis sandbox",
)Environment env = client.environments().create(EnvironmentCreateParam.builder()
.name("data-sandbox")
.description("Data analysis sandbox")
.build());Supported Package Managers
Packages are declared using the following package managers:
apt: System packages, for example ffmpeg
pip: Python packages, for example pandas, numpy
npm: Node.js packages
Archive and Delete
Environments support two operations: archive and delete.
Archive: The environment is retained but hidden from the list by default. Sessions already bound to it remain functional.
Delete: Hard delete. The environment configuration is permanently removed and cannot be recovered. Use archive instead if you want to preserve the configuration.
To archive an environment via the API, see Archive Environment.
curl -X POST "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/environments/env_xxx/archive" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"client.environments.archive("env_xxx")client.environments().archive("env_xxx");To delete an environment via the API, see Delete Environment.
curl -X DELETE "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/environments/env_xxx" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"client.environments.delete("env_xxx")client.environments().delete("env_xxx");