Deploy an AI Agent Runtime on Windows Using WSL: A Complete Setup Guide

    This guide walks through deploying a complete AI agent runtime on Windows by leveraging the Windows Subsystem for Linux (WSL). It covers enabling WSL, installing an Ubuntu distribution, setting up Node.js with nvm, registering a bot application on an open platform, installing the agent framework and messaging channel, running onboarding with a background daemon, and configuring model access. It also includes troubleshooting tips and security best practices for credentials and configuration files.

    1. Why Deploy on Windows Through WSL

    Many AI agent frameworks, agent runtimes, and Node.js ecosystem tools are designed for Linux first. Running them directly on Windows often leads to issues such as path separator differences, incompatible shell scripts, and failed native module builds. A common approach is to enable the built-in Linux subsystem on Windows and run a full Linux distribution on top of the Windows kernel. This preserves the Windows desktop experience while maintaining compatibility with the Linux ecosystem.

    This approach offers three key benefits:

    • Environment isolation, so the host system stays clean.
    • Dependency consistency with production servers.
    • Easy rollback by quickly rebuilding the instance when something breaks.

    2. Install WSL and a Linux Distribution

    Press Win+R, type cmd, and press Enter to open a terminal. Run the command to enable the Linux subsystem. This step downloads and registers the Linux kernel components, so be patient on slow networks and do not interrupt the process.

    Restart your computer afterward so the kernel components take effect. Once restarted, open a terminal again and install a specific Linux distribution, such as Ubuntu 24.04. The first launch starts an initialization flow that asks you to set a username and password. When it finishes, the prompt changes to the user@localhost format, which means the Linux environment is ready.

    At this stage, it is recommended to update the package sources to ensure smooth dependency installation later:

    1. sudo apt update && sudo apt upgrade -y

    3. Install the Node.js Runtime With a Version Manager

    AI agent frameworks usually require a recent Node.js version (generally major version 22 or later). Manual installation can easily cause version conflicts, so a Node version manager (nvm) is recommended. It lets multiple Node versions coexist on the same machine and switch between them as needed.

    Install it with:

    1. wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash

    After the install script finishes, nvm is not automatically loaded into the current shell, so you need to add the environment variables manually:

    1. export NVM_DIR="$HOME/.nvm"
    2. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    3. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

    Then install the required version:

    1. nvm install 22
    2. nvm use 22

    Verify the installation with node -v and npm -v.

    4. Create an Application on the Bot Open Platform

    While the runtime is installing, you can open a browser in parallel and visit the open platform of a messaging service. Log in by scanning the official app’s QR code. The platform usually allows creating multiple bot applications, and each application can be bound to a different agent instance for scenario isolation.

    After creation, the platform shows onboarding instructions that include credentials such as the AppID and AppSecret. Be sure to click “Scan to Chat” to add the bot to your own account; otherwise, message sending and receiving cannot be verified later. These credentials are sensitive, so do not commit them to a code repository or share them publicly.

    5. Install the Agent Framework and Connect the Channel

    Back in the terminal, install the agent framework globally with npm:

    1. npm install -g openclaw@latest

    After installation, follow the platform instructions to install the plugin, bind the channel, and restart the gateway:

    1. # Install the messaging bot plugin
    2. openclaw plugins install @sliverp/qqbot@latest
    3. # Add a channel (replace with your actual credentials)
    4. openclaw channels add --channel qqbot --token "your AppID:your AppSecret"
    5. # Restart the gateway to apply the configuration
    6. openclaw gateway restart

    6. Onboarding and Daemon Setup

    Run the onboarding command to complete the basic configuration:

    1. openclaw onboard --install-daemon

    The onboarding process asks about options such as the model provider and API endpoint. If you have not decided yet, you can skip them and fill them in later in the configuration file. The --install-daemon flag registers the gateway as a background daemon so the service keeps running after the terminal is closed.

    7. Core Configuration File and Model Access

    The configuration file is located in the .openclaw folder under your home directory:

    1. cd ~/.openclaw
    2. ls
    3. vim openclaw.json

    Add the model information to the configuration file, typically including the model name, endpoint, and API key fields. If you are not familiar with vim, press i to enter insert mode, then press Esc and type :wq to save and exit after editing.

    Example configuration (illustrative):

    1. {
    2. "models": [
    3. {
    4. "name": "default",
    5. "endpoint": "https://your-endpoint/v1",
    6. "apiKey": "your-key"
    7. }
    8. ]
    9. }

    8. Common Issues and Best Practices

    1. Slow subsystem download: switch networks or retry later, and avoid repeated interruptions.
    2. nvm command not found: confirm the environment variables are added to ~/.bashrc and reload the shell.
    3. Bot not responding: check whether the channel credentials are correct, whether the bot was added via QR scan, and whether the gateway was restarted.
    4. Security: inject credentials such as the AppSecret through environment variables, and set configuration file permissions to owner-only read (chmod 600).
    5. For later cloud deployment, the same configuration can be migrated to a container platform or cloud host, with logging and monitoring/alerting added for observability.

    Following these steps, you can set up a complete AI agent runtime on Windows and lay the groundwork for multi-agent expansion and model switching later.