This document explains how to develop, upload, and deploy high-code application APIs from scratch using AgentScope-AI.
Environment Setup
The Python development environment requires python >= 3.10.
To upload and deploy Python code to Alibaba Cloud Bailian and install the required AgentScope-AI dependencies for uploading code packages to Alibaba Cloud Bailian:
Development Guidelines
The Python backend program must expose a GET /health endpoint. If this endpoint is unreachable, Bailian will consider the service startup as failed.
main.py.
The default path for the chat interface is /process. Refer to the Agent API Protocol Specification for protocol details.
Reference implementation package: mcp_server_with_chat.zip.
Application Observability Integration
By using the @trace decorator provided by the agentscope-runtime package, logs are automatically reported and execution durations are measured.
Example decorator for LLM function calls:
AgentScope-runtime.
When uploading a pre-built .whl package using AgentScope-AI, add the --telemetry enable flag to activate observability.
Application Upload
Obtain and configure the following environment variables (Linux example shown):
- Obtain your Alibaba Cloud AccessKey (AK and SK) for authentication during package upload.
- (Optional) Obtain your Alibaba Cloud Bailian Workspace ID (starts with
llm-) to specify the Bailian workspace where the high-code application will be deployed. If not set, the default workspace is used.
AgentScope-AI to upload your built .whl package and automatically deploy it to Alibaba Cloud Bailian.
The --telemetry enable flag enables observability capabilities and must be used alongside AgentScope’s Tracing module during application development.
Application Testing
We recommend navigating to Alibaba Cloud Bailian → Application Management, then testing your application and reviewing build, deployment, and invocation logs on the application detail page.
Application Updates
When updating a high-code application, use the AgentScope-AI update command to re-upload the .whl package. Upon successful upload, the application is automatically updated and redeployed.
Go to Alibaba Cloud Bailian → Application Management, and copy the application ID.
Locally, run the following command to upload your updated local .whl package:
After the update, the application is rebuilt and redeployed.
Frequently Asked Questions
Minimal RAM Account Permissions
To grant minimal permissions to a RAM account for high-code application usage, create a custom permission policy based on the following rules:
How to Troubleshoot Upload Failures?
- Verify that your Alibaba Cloud AK/SK and Bailian Workspace ID belong to the same Alibaba Cloud account.
- Ensure you have previously deployed a high-code application via the Bailian console — doing so guides you through enabling required Alibaba Cloud permissions and resources.
-
Try using a clean
python >= 3.10environment — e.g., create an isolated virtual environment using Python’svenv: Create environment:Activate environment: -
If upload fails with error
"RAM user is not assigned to any workspace in Bailian", contact the Alibaba Cloud root account owner to perform the following:- In the RAM console, assign the
AliyunBailianDataFullAccesspermission to the RAM user (sub-account). - In the Bailian account management page, grant the RAM user Agent – Operation permissions for the specific workspace.
- In the RAM console, assign the
Why Does the Console Show “Deploying…” Indefinitely (>5 Minutes) or Report Deployment Failure?
- The
GET /healthendpoint of your Python backend is unreachable, causing Bailian to treat startup as failed. - The Python backend entry file is not named
main.py.
How to Avoid Build Failures Caused by Dependency Updates?
In requirements.txt, use == to pin dependency versions — avoid range constraints like >=, which may pull inconsistent versions across builds and cause behavioral drift or failures.
Examples:
pip freeze to export exact versions currently installed: