Deploy OpenClaw in DSW

更新时间:
复制 MD 格式

OpenClaw is an AI agent framework that supports direct operating system control, persistent memory, and scheduled proactive pushes. You can interact with it through various methods, such as a Web UI and DingTalk, and it features a rich, built-in Skills ecosystem. PAI-DSW provides an automated installation script that you can use to quickly deploy OpenClaw and choose either Model Studio or PAI-EAS as your large language model (LLM) service provider.

Overview

Why choose PAI-DSW

Deploying OpenClaw on DSW integrates AI computing power with OpenClaw's agent capabilities and provides the following advantages:

  • Out-of-the-box and fully managed

  • Elastic computing power that scales on demand

  • Seamless integration with the Alibaba Cloud ecosystem

  • Secure access that prevents service exposure

  • Allows OpenClaw to run directly alongside your computing power

OpenClaw, your computing resources, training tasks, and file storage run in the same environment. This allows OpenClaw to directly read and write files, monitor GPU status, and execute scripts, which enables "intelligent cloud development" capabilities.

OpenClaw access methods

After you deploy OpenClaw, you can interact with it using the following methods:

  1. Open the Web UI directly through the DSW Gateway (recommended): No extra configuration is needed. After the script runs, it automatically provides a clickable access link. You can log on with your Alibaba Cloud account to open the Web UI directly in your browser.

  2. Access through DingTalk (optional): You can create a robot in enterprise DingTalk to use OpenClaw anytime and anywhere through DingTalk chat.

  3. Access the Web UI through a local SSH tunnel (optional): After you establish an SSH tunnel, you can access the OpenClaw Web UI in your local browser.

Access method comparison:

Access method

DSW Gateway (recommended)

DingTalk access

Local SSH tunnel

Configuration difficulty

No configuration needed

Simple

Medium

Access convenience

Click link to open

Anytime, anywhere

Requires tunnel to be maintained

Team collaboration

Single user

Supports multiple users

Single user

Mobile support

Browser access

Native support

Inconvenient

Message history

Web UI saves

DingTalk saves

Web UI saves

Scenarios

Quick experience, development and debugging

Daily office work, team collaboration

Special network environments

Suggestions:

  • New users: We recommend using the DSW Gateway. It is an out-of-the-box solution that requires no configuration.

  • Team use: We recommend configuring DingTalk access. It supports multi-user sharing and mobile access.

  • Developers: We recommend using the DSW Gateway for daily tasks and enabling SSH tunnels for special requirements.

You can use all three methods simultaneously and configure them as needed.

Quick Start

This section describes how to quickly deploy OpenClaw in DSW and access the Web UI using the DSW Gateway.

Step 1: Create and configure a DSW instance

  1. Log on to the PAI console. In the upper-left corner, select a region. Then, click Activate. After you activate the service, the system automatically creates a default workspace.

  2. In the left navigation pane, click Workspaces to enter the workspace you want to manage.

  3. In the navigation pane on the left, choose Model Training > Data Science Workshop (DSW) > Create an instance..

  4. Configure the following key parameters:

    • Instance Name: For example, openclaw-test.

    • Resource Type: Select Public Resources.

    • Instance Type: We recommend using ecs.g9i.xlarge (4 vCPU, 16 GiB). You can also select a GPU instance type based on your requirements.

    • Image config: Deploying OpenClaw has no image restrictions. You can select an image based on your requirements. If you do not have a preference, we recommend that you select the Alibaba Cloud Image: modelscope:1.34.0-pytorch2.3.1tensorflow2.16.1-gpu-py311-cu121-ubuntu22.04. This image comes pre-installed with basic environments, such as Python and Git.

  5. Click OK to create the instance. Wait for the instance status to change to Running.

Step 2: One-click deployment of OpenClaw

  1. On the DSW instance list page, find the instance and click Open in the Actions column. This opens the DSW environment.

  2. Click Terminal to open the terminal. Then, run the following command to download and run the automated installation script.

    curl -fsSL https://pai-dsw-ai-machine.oss-cn-beijing.aliyuncs.com/agent/openclaw/openclaw_installer_dsw.sh -o openclaw_installer_dsw.sh && bash openclaw_installer_dsw.sh

    The installation process starts:

    image

  3. Select the recommended installation version: 2026.3.8.

    image

  4. Select to skip the channel configuration.

    image

  5. Select a model provider. You can choose large language models from Model Studio or large language model services deployed in PAI-EAS.image

    Model Studio model services

    1. Configure the Model Studio base URL. The default URL is for the Model Studio Coding Plan. For a regular Model Studio account, enter https://dashscope.aliyuncs.com/compatible-mode/v1.

      image

    2. Configure the Model Studio API key. Copy and paste the Model Studio API key.

    3. Select an AI model based on your requirements.

    4. Configure the Gateway port. You can use the default value.

    EAS model services

    1. Deploy a large language model (LLM) with one click from the Model Gallery, for example, Qwen3.5-397B-A17B. For more information, see Quick Start: Deploy, fine-tune, and evaluate Qwen3 series models.

    2. After the service is deployed, go to the service details page to obtain the Internet Endpoint and Token.

      image.png

      Then, configure them in the script.

      ◆ Configure the EAS service
      
        Note: Obtain the base endpoint and Token from the PAI-EAS console.
        Example base endpoint: http://16********.cn-hangzhou.pai-eas.aliyuncs.com/api/predict/test
        Note: Enter only the base endpoint (without /v1). The script automatically appends /v1.
      
      ◆ EAS base endpoint: http://16xxxxxxxx.cn-hangzhou.pai-eas.aliyuncs.com/api/predict/test
      ◆ EAS Token [visible input]: your-eas-token-here
    3. Configure tool calling. The script asks whether to disable tool calling:

      ◆ Tool calling configuration
        Tip: If the --enable-auto-tool-choice parameter is not enabled for the EAS service,
             a 400 error will occur. In this case, you need to disable tool calling.
      
      ◆ Disable tool calling?
        [1] ○ No - Enable tool calling (Recommended. Requires EAS server-side support.)
        [2] ○ Yes - Disable tool calling (For cases where the server-side is not configured.)

      Suggestions:

      • If the EAS server-side supports tool calling, select No.

      • If you are unsure or if you encounter a 400 error, select Yes.

  6. Complete the configuration.

Step 3: Access the Web UI through DSW Gateway

After the script runs and the Gateway starts, the terminal automatically displays the access information:

image

Click the access link. DSW automatically forwards requests through the built-in Gateway proxy, and your browser opens the OpenClaw Web UI.

Note: The 127.0.0.1 in the link is the local address within the DSW instance. The DSW Gateway proxy mechanism securely exposes the service to logged-on Alibaba Cloud users. No manual port mapping configuration is required.

In the upper-right corner of the Web UI, check the service status:

  • Health: OK indicates that the service is running as expected.

  • Gateway: Connected indicates that the Gateway connection is normal.

You can then use the dialog box to chat with OpenClaw.

image

For more information about OpenClaw application scenario practices in DSW, see Application Scenario Practices.

Access OpenClaw through DingTalk (optional)

Step 1: Create a DingTalk application

For more information, see the Official Documentation on the DingTalk developer platform.

  1. Create an internal DingTalk application. Log on to the DingTalk Developer Console. Choose Application Development > DingTalk Application > Create Application.

    image

    Enter the application information:

    • Application Name: For example, OpenClaw Assistant

    • Application Description: AI intelligent office assistant

    • Application Logo: Upload the application icon

  2. Configure robot capabilities. Go to the application details page. Click Application Capabilities > Add Application Capability and select Robot. Then, configure the robot information and publish it.

    • Robot Name: For example, OpenClaw Assistant

    • Robot Introduction: An AI intelligent assistant that helps you handle daily office tasks

    • Message Receiving Mode: Stream mode. Note: You must select Stream mode. Otherwise, messages cannot be received.

  3. Activate permissions. In the navigation pane on the left, click Permission Management. Activate the following permissions. For more information, see dingtalk-openclaw-connector:

    • Card.Streaming.Write

    • Card.Instance.Write

    • qyapi_robot_sendmsg

    image.png

  4. Publish the application. Go to the Version Management and Publishing page. Click Create New Version. Enter the version information and click Save. Then, click Confirm Publish. In the DingTalk client, you can search for and add the robot to a group chat or private chat.

    image

  5. Obtain application credentials. In the navigation pane on the left of the application details page, click Credentials and Basic Information to obtain the following credentials:

    • Client ID (AppKey): The unique identity of the application.

    • Client Secret (AppSecret): The application's key.

Step 2: Configure the OpenClaw channel

Return to the DSW instance terminal. Run the following command to restart the wizard script and configure the DingTalk channel:

bash openclaw_installer_dsw.sh

Select Channel Plugin.

◆ Select an operation
  (Use the up/down arrow keys to navigate | Enter a number to select directly | Press Enter to confirm)
  [1] ○ Install OpenClaw (Installation)  — Complete installation process
  [2] ○ Upgrade OpenClaw (Upgrade)       — Upgrade to the latest version
  [3] ○ Update configuration (Configuration)      — Reconfigure (overwrites existing configuration)
  [4] ○ Model configuration (Models)             — Update only model configuration (other configurations are retained)
  [5] ● Channel plug-ins (Channels)           — Manage channel plug-ins (other configurations are retained)
  [6] ○ Gateway management (Gateway)        — Start, stop, or restart
  [7] ○ View status (Status)             — Display installation status
  [8] ○ Diagnose and repair (Repair)             — Diagnose and fix issues
  [9] ○ Uninstall OpenClaw (Uninstallation)     — Uninstall OpenClaw
  [10] ○ Exit (Exit)

In the Channel Plugin configuration, select Add DingTalk Channel.

The DingTalk plugin installs automatically. Provide the application credentials that you just configured to complete the setup.

The default DingTalk plugin is dingtalk-openclaw-connector.

Step 3: Test the DingTalk robot

  1. In the DingTalk client, search for your robot name.

  2. Send a message to test the robot.

Access the Web UI through a local SSH tunnel (optional)

Step 1: Configure DSW SSH parameters

On the DSW instance configuration page, configure the virtual private cloud (VPC), SSH key, public network access port (for example, 3000), Internet NAT gateway, and Elastic IP Address (EIP). For more information, see Remote Connection: Direct SSH Connection. The network topology is shown in the following figure:

image.png

Step 2: Start the Gateway service

After the configuration script runs in DSW, the Gateway starts. The system automatically generates a security token, which is stored in ~/.openclaw/openclaw.json. To query the Gateway token later, you can use the following command to retrieve the `openclaw.json` file:

cat ~/.openclaw/openclaw.json

Step 3: Establish an SSH tunnel

In your local computer's terminal, run the following command:

# Establish an SSH tunnel
ssh -N -L 18789:0.0.0.0:18789 -p 3000 root@<DSW public IP address>

Parameter description:

  • -N: Does not execute remote commands and only establishes the tunnel.

  • -L 18789:0.0.0.0:18789: Maps local port 18789 to remote port 18789.

  • -p 3000: The SSH connection port, which is the DSW public network port.

  • root@<DSW public IP address>: The public IP address of the DSW instance.

Success indicators:

  • The command runs without errors.

  • The terminal remains connected and does not return to the command prompt.

Keep the tunnel running:

  • macOS/Linux: You can keep the command running directly in the terminal window or use screen or tmux for management.

  • Windows: You can run the command in PowerShell or configure the tunnel using an SSH client, such as PuTTY.

Step 4: Access the Web UI

In your local browser, go to the following address:

http://localhost:18789/?token=<YourGatewayToken>

Application Scenario Practices

Basic scenarios

Scenario 1: Daily Q&A and code assistant

Please create an ipynb file in /mnt/workspace to implement house price prediction using public data from Kaggle.

Scenario 2: Intelligent file search

Please help me find all Markdown files in the DSW instance that contain the keyword "report"

Scenario 3: Follow message subscription

Every day at 9 a.m., send me the latest AI industry news.

image.png

Training scenarios

The core value of using DSW with OpenClaw in GPU training scenarios is as follows:

  • Proactive monitoring: You do not need to constantly monitor your tasks. OpenClaw can proactively detect issues and notify you.

  • Remote operation: You do not need to be at your computer. You can perform all operations through DingTalk chat.

  • Intelligent Memory: Automatically organizes experiment records so that you can query historical data at any time.

Scenario 1: Task status query

You can query the status at any time on DingTalk or the web page.

How is the GPU utilization of the training task I just executed?

image.png

Scenario 2: Task status monitoring and alerting

  • User pain point: When running long-duration training tasks, such as LLM fine-tuning, on DSW, training can fail overnight without the user's knowledge. This results in idle GPUs that waste resources, and users may only realize the failure the next morning.

  • Solution: You can use OpenClaw to regularly check the status of the GPU or other required metrics. If an anomaly is detected, OpenClaw sends an alert through DingTalk. You can configure scheduled tasks from the command line or issue instructions through chat.

openclaw cron add \
  --name "GPU Training Monitoring" \
  --cron "*/15 * * * *" \
  --tz "Asia/Shanghai" \
  --session isolated \
  --message "Follow these steps to check the GPU training status:

1. Run the command: python gpu_monitor.py
2. If 'HEARTBEAT_OK' is returned, it means everything is normal and no further action is required.
3. If an abnormal report is returned, do the following:
   - Send the full report to me via DingTalk.
   - Analyze the possible causes mentioned in the report.
   - Provide suggested solutions.

Note: Notify me only if an abnormality is detected." \
  --announce

image

Scenario 3: Automatic archiving of experiment data

  • User pain point: A challenging part of algorithm experiments is organizing the experiment records. After each training session, users must manually record hyperparameters, result metrics, conclusions, and improvement directions.

  • Solution: You can use OpenClaw's memory mechanism and scheduled tasks to automate the process of recording experiments.

Execute the experiment log archiving task every night at 10 PM:
1. Run the archiving script:
   python /gpu-training-tester/experiment_archiver.py
2. If 'HEARTBEAT_OK' is returned, it means there are no new experiments today, and no action is needed.
3. If experiment records are returned, please:
   - Append the records to /mnt/workspace/experiment_log.md
   - Remember these experiment results (using the memory feature)
   - Send a summary to DingTalk
Remember: When I query historical experiments later, you should be able to retrieve this information from memory.

image.png

After the task is complete, the `/mnt/workspace/experiment_log.md` file is automatically maintained:

## Experiment Records

### 2026-03-02

| Experiment | Model | Learning Rate | Epochs | Final Loss | Accuracy | Status | Duration |
|----------|--------|----------------|--------|------------|----------|--------|----------|
| exp_20260302_143015 | qwen-7b | 2e-5 | 3 | 0.0234 | 92.1% | Completed | 0:31:32 |
| exp_20260302_161522 | qwen-7b | 5e-5 | 3 | - | - | OOM | 0:04:23 |

### 2026-03-01

| Experiment | Model | Learning Rate | Epochs | Final Loss | Accuracy | Status | Duration |
|----------|--------|----------------|--------|------------|----------|--------|----------|
| exp_20260301_091523 | qwen-7b | 1e-5 | 5 | 0.0312 | 91.8% | Completed | 2 h 28 m |
| exp_20260301_141035 | qwen-14b | 1e-5 | 5 | - | - | OOM | 12 m |

Users can open the file in JupyterLab to view it. They can also ask OpenClaw to provide task comparisons and experiment data at any time.

Appendix

A. OpenClaw configuration file

To easily view the OpenClaw configuration directory in the Jupyter or WebIDE directory tree, you can create a symbolic link in the DSW Terminal:

# Link the OpenClaw configuration directory to the working directory
ln -s ~/.openclaw /mnt/workspace/openclaw_config

B. Query Gateway Token

To query the current Gateway token, run the following command:

cat ~/.openclaw/openclaw.json