This document explains how to deploy a custom agent on Compute Nest and covers the purpose, configuration, and key considerations for each deployment option.
What you can do with a custom agent
You can specify the source of your application (a Git repository, an OSS archive, or a container image), define how it starts and stops, and configure environment variables, Model Studio (Bailian) models and API keys, optional MCPs, Skills, and application connection bindings. After deployment, you can interact with the agent through a web UI or API calls.
Go to the Compute Nest console and create an agent under Agent Deployment > Agent Selection.

Prerequisites
The Compute Nest platform only provides the agent's runtime environment. You must write the agent code yourself.
The official examples use Google ADK. For optimal compatibility, we recommend structuring your project similarly.
Connections for features like memory and sandboxes are injected through environment variables. You can read them in your code using
os.getenv(). For more information, see Connection Usage Instructions.
Development notes:
The ECS instance includes Docker, Python 3.12, Google ADK, and google-adk-redis.
We recommend building your application's container image based on the following public base image:
compute-nest-registry.cn-hangzhou.cr.aliyuncs.com/computenest/agentscope-adk-base-py312:latestTo integrate agent connections (such as MCP, knowledge base, and memory), use the computenest-agent-integrations development library.
For examples of project structure and code implementation, refer to the official examples in the Agent Marketplace.
Deployment page parameters
When creating an agent, first select a deployment method: ECS edition or container cluster edition. Then, configure the parameters for each section. The following explanations follow the order of the options on the console page.
Application information
Parameter | Description |
Application name | The name of the agent application being deployed. You can use the default name. |
Group name | The group name for the deployed agent application. You can use the default name. |
Agent configuration
Source file type
Source file type: Choose the source for your application: Git repository, OSS file, or container image. The parameters that follow change based on this selection.
Source type availability varies by deployment edition:
Source type | ECS edition | Container cluster edition |
Container image (recommended) | ||
Git repository | ||
OSS file |
Container image
Parameter | Description |
ACR region | The region where the image is located. |
ACR type | Personal Edition / Enterprise Edition |
Repository name | The image repository. |
Image version | The tag to deploy. |
Intranet pull | For Enterprise Edition, VPCs must be connected. |
The image is automatically pulled to the ECS instance during deployment before the script is executed. You do not need to run docker pull in the script.
We recommend building your image based on the official public ADK base image.
FROM compute-nest-registry.cn-hangzhou.cr.aliyuncs.com/computenest/agentscope-adk-base-py312:latest
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["bash", "docker-entrypoint.sh"] # StartGit repository (ECS edition only)
Parameter | Description |
Platform | GitHub, Gitee |
Owner/organization | The owner of the repository. |
Repository name/branch | The location of the code. |
The code is automatically downloaded to code_deploy_application/. You do not need to run git clone.
OSS file (ECS edition only)
Parameter | Description |
OSS region/bucket/file path | The location of the deployment package. |
Intranet download | The ECS instance and OSS bucket must be in the same region. |
The file is automatically downloaded to the working directory. If it is a compressed archive, you must unzip it in the application startup script.
Working directory and scripts
ECS edition:
Parameter | Description |
Working directory | An absolute path. The default is |
Application startup script | A shell script to start the agent. |
Application stop script | A shell script to stop the agent. |
Before each startup, the platform first runs the stop script to clean up the previous version.
Example application startup script (ADK Docker):
set -euo pipefail
IMAGE=<Your_ACR_image_address>
docker run -d \
--name my-agent \
--restart unless-stopped \
--network host \
-e DASHSCOPE_API_KEY \
-e DASHSCOPE_MODEL_NAME \
${SESSION_REDIS_URL:+-e SESSION_REDIS_URL} \
-e PORT=8000 \
"$IMAGE"Example application stop script:
docker rm -f compute_nest_agent 2>/dev/null || trueContainer cluster edition: You do not need to configure start and stop scripts because K8s automatically manages the Pod lifecycle by using the image's CMD/ENTRYPOINT as the startup entry point.
Deployment resources
ECS edition:
Billing method: pay-as-you-go/subscription
Instance type: The default is
ecs.u1-c1m2.largeSystem disk: ESSD, default 40 GiB
Public bandwidth: Default 5–10 Mbps
Pre-installed: Docker, Python 3.12, and Google ADK
Container cluster edition:
Cluster option: New ACS/New ACK/Existing cluster
Default: New ACS (Serverless, no node management required)
For ACK, you need to configure: Worker instance type, number of nodes, and network plug-in.
For both editions, the Web UI and API are accessible on port 8000.
Environment variable configuration
Parameter | Environment Variable | Description |
Model Studio (Bailian) API key |
| Required. |
Model selection |
| Automatically injected after selection on the deployment page. |
Service port |
| Default is 8000. |
Custom environment variables | — | User-defined key-value pairs. |
ECS edition: Environment variables are written to the host machine and passed to the container by using -e VAR_NAME in the startup script.
Container cluster edition: Environment variables are injected into Pods through the app-config ConfigMap and are read directly in your code by using os.getenv().
Network configuration
ECS edition: Select the availability zone, VPC (new or existing), vSwitch, and CIDR block as prompted on the page.
Container cluster edition: You must select an existing VPC and vSwitch. Creating a new VPC is not supported.
The connection and the agent must be in the same VPC to communicate over the private network.
Model configuration
Parameter | Description |
Model selection | Select the model you want to use from the dropdown list. |
Model Studio (Bailian) API key | Required. Enter the API key obtained from Model Studio (Bailian). This is used to call the model service. |
Tool configuration
Parameter | Description |
Application connection | Bind services such as sandbox, session management, knowledge base, memory, and more. |
Model Studio (Bailian) MCP | Select Enable MCP, then choose the required tools. |
Skills | After you enable Skills, select a Skill space and the Skill to install. The installation directory is |
Application connections
Session connections persist the context of multi-turn conversations and correspond to Redis instances. To use them, you must first create an instance in the Redis Console and then create a connection in Agent Deployment > Connection Management. For more information, see Connection Usage Instructions.
ECS edition: Optional. If you create a new VPC, the list does not display session connections, and you can use the built-in local Redis. If you select an existing VPC, the list displays only connections that are in the same network as the VPC, and you can bind them as needed.
Container cluster edition: Required. You must select an existing VPC and bind a session management connection that is in the same network as the VPC.
For the ECS edition, session connection options are not displayed when you opt to create a new VPC. This is because the VPC does not exist at configuration time, preventing the platform from matching it to the Redis network.
MCP configuration
Deployment method | Configuration method |
ECS edition | The platform writes the original JSON content to |
Container cluster edition | The platform writes the Base64-encoded JSON to the |
Example MCP JSON format:
{
"mcpServers": {
"WebSearch": {
"type": "streamableHttp",
"baseUrl": "https://dashscope.aliyuncs.com/api/v1/mcps/WebSearch/mcp",
"headers": {
"Authorization": "Bearer ${DASHSCOPE_API_KEY}"
}
}
}
}${DASHSCOPE_API_KEY} is a placeholder that is replaced with the actual API Key by the platform during deployment.
Example code for reading the configuration:
The ECS edition reads from a file. The container cluster edition reads from MCP_JSON and decodes the content by using Base64.
import base64
import json
import os
from pathlib import Path
def load_mcp_config() -> dict:
if raw := os.getenv("MCP_JSON"):
return json.loads(base64.b64decode(raw).decode("utf-8"))
path = Path(os.getenv("MCP_CONFIG_PATH", "/root/mcp_config.json"))
return json.loads(path.read_text(encoding="utf-8"))During debugging, you can run echo "$MCP_JSON" | base64 -d to view the decoded JSON.
The baseUrl for each MCP is subject to the value displayed in the Model Studio (Bailian) console. You must enable the corresponding MCP capability in Model Studio (Bailian) before use. For more information, see Connection Guide.Skill configuration
Deployment method | Configuration method |
ECS edition | During deployment, enable Enable Skills and select the Skill space and the Skill to install. The platform automatically installs it to |
Container cluster edition | Same as above. The Skill is installed via an Init Container and mounted to |
The code can read installed Skill files from /root/skills for the Agent to load on demand.
After deployment
Output | ECS edition | Container cluster edition |
Web UI + API (:8000) | ||
Code Debugging (:8080) | (Code Server) | (Code Server) |
Remote Connection (Workbench) |
The ADK service provides both a Web UI and the /run_sse API on port 8000. OpenAPI documentation: http://<IP>:8000/docs.
Next steps (optional)
Actions | Path |
Change image/code | Deployment artifacts > New deployment artifact > Publish deployment artifact |
Modify environment variables | Parameter modification > Release management > Publish deployment artifact |
Bind a connection | Agent management > Bind > Release management > Publish deployment artifact |
Change MCP | Agent management > MCP > Change |
Change Skills | Agent management > Skills > Change |
FAQ
ECS
Symptom | What to check |
Git pull fails | GitHub access from the Chinese mainland can be unstable. Switch platforms or select an overseas region. |
OSS download fails | Check if the region and intranet options match. |
Image pull fails | Check if the ACR and ECS networks can communicate. |
Docker run error | Check |
Container cluster edition
Symptom | What to check |
Image pull fails | For ACR Enterprise Edition, you need to configure VPC access control. |
Pod CrashLoopBackOff | Use the |
Pod Pending | Insufficient cluster resources or scheduling constraints. |
General
Symptom | What to check |
Model authentication fails | Verify that the Model Studio (Bailian) API key is correct. |
MCP 401 | Confirm that the corresponding MCP is enabled in Model Studio (Bailian). |
Connection binding does not take effect | Changes take effect only after you redeploy from Release management. |
Session is not persistent | Whether a session management link is bound and whether the startup command passes the |
Web UI cannot be opened | Check if the deployment is successful. The initial startup may be slow. Make sure that port |