Complete Guide to Deploying an AI Agent Framework Locally
This guide walks through deploying an open-source AI agent framework on a Windows PC. It covers setting up a Linux environment with WSL, installing Node.js through a version manager, installing the framework and its daemon, connecting a messaging platform bot, and configuring a large language model. It also lists common troubleshooting steps.
As large language models continue to mature, more developers want to run a customizable, extensible AI agent framework on their own machines. Such a framework can handle tasks like automated question answering, message processing, and task orchestration. This guide uses a typical open-source agent framework as an example and walks through the full deployment process from scratch, helping readers set up the environment and complete basic configuration on a Windows PC.
1. Overall Deployment Architecture
Before starting, it helps to understand the overall architecture. An agent framework usually runs as a Node.js service on the server side and exposes its functions through a “gateway” process. Through a plugin mechanism, it can also connect to instant messaging platforms, such as common bot open platforms. It forwards chat messages to a configured large language model for processing, then sends the replies back to the user.
The full process breaks down into five stages:
- Prepare a Linux runtime environment. On Windows, the Windows Subsystem for Linux (WSL) is recommended.
- Install the Node.js runtime with a version manager, so you can switch between versions easily.
- Install the agent framework and its daemon.
- Create a bot on the messaging platform and connect it as a channel.
- Configure the large language model connection, then activate and verify the service.
Each stage is covered below.
2. Stage 1: Set Up the Linux Subsystem
Most agent frameworks run primarily on Linux. Windows users can use the built-in Linux subsystem feature to get an isolated, lightweight Linux environment quickly, without installing virtualization software.
Steps:
- Press
Win + R, typecmd, and open the Command Prompt. - Run the subsystem installation command provided by the system. This step downloads the required components. Depending on your network, it may take several to more than ten minutes.
- After installation, list the Linux distributions the system supports. When choosing one:
- For stability, choose a long-term support (LTS) Ubuntu release, such as the 24.04 LTS series.
- For a lighter footprint, choose a minimal distribution such as Debian.
- If the installer asks for a restart, restart your computer. Otherwise, later installation steps will fail.
- After the restart, install the distribution you selected. On first launch, you will be asked to set a Linux username and password. The password does not display as you type, which is normal. When setup finishes, you will see a command prompt in the form
user@localhost.
Common issues:
- If the subsystem installation fails with a virtualization error, open the BIOS and confirm that CPU virtualization support is enabled.
- The subsystem files are stored on the C drive by default. If disk space is limited, you can move the installation to another drive.
3. Stage 2: Install Node.js with a Version Manager
The agent framework requires a specific Node.js version, typically 22 or later. Installing Node.js directly at the system level makes it hard to manage multiple versions, so this guide uses a Node version manager. A version manager lets you switch freely between Node.js versions. It installs entirely within your user directory, so it needs no administrator rights, which avoids permission problems.
Installation steps:
- Download the official install script for the version manager, then run it with the shell. The script places the program in a hidden folder in your home directory.
- After installation, load the version manager into your current shell session. The core logic is to set the root directory of the version manager, then load its main script and its command completion script. The example below shows the structure:
export NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Add these lines to ~/.bashrc so they load automatically each time you open a terminal. This saves you from loading them manually every time.
- Verify the installation by running the version command. If it prints a version number, the version manager loaded successfully.
- Install Node.js 22 with the version manager:
nvm install 22
After installation, set 22 as the default version. Then check node -v and npm -v to confirm that both the runtime and the package manager work.
Tip: If downloads are slow, configure a package mirror closer to your location to speed up Node.js binary downloads.
4. Stage 3: Install the Agent Framework
After Node.js is ready, install the framework globally with its bundled package manager:
npm install -g <framework-package-name>@latest
After a global install, the framework’s command-line tool is registered in your system PATH, so you can call it from any directory. Run the version command afterward to verify the installation.
Next, run the framework’s initialization wizard, which typically includes an optional parameter for installing the daemon:
<framework-command> onboard --install-daemon
The wizard asks a series of questions, such as which model provider to use, which working directory to set, and whether to start automatically at boot.
Practical advice: If you have not decided on a model provider yet, you can skip most prompts or accept the defaults. Then complete the settings later by editing the core configuration file. This speeds up the first deployment considerably. The daemon option runs the framework as a resident service, so it keeps running after you close the terminal.
5. Stage 4: Create a Messaging Bot and Connect a Channel
The value of an agent lies in being reachable, and connecting to an instant messaging platform is the most common way to use one. The general process is:
- Open the developer portal of your chosen platform and log in by scanning a QR code.
- Follow the prompts to create a bot application. Major platforms typically let one account create several bots, for example up to five. Each bot can be bound to a different agent instance, so you can separate purposes such as customer support, scheduling, or knowledge base assistance.
- After you create the bot, the platform issues a pair of credentials: an application ID and an application secret. These are the core credentials for channel setup. Keep them safe, and never commit them to a public code repository.
- On the platform, add the bot as a contact. This is usually done through an option such as “scan to chat.” Adding it lets you test the bot right after deployment.
Back in the terminal, connect the channel in three steps:
# Step 1: Install the bot plugin for the platform<framework-command> plugins install <platform-plugin-package-name>@latest# Step 2: Add a messaging channel and enter the credentials issued by the platform<framework-command> channels add --channel <channel-name> --token "<app-id>:<app-secret>"# Step 3: Restart the gateway so the configuration takes effect<framework-command> gateway restart
The key point is restarting the gateway. The framework loads channel configuration when the gateway starts, so you must restart it after adding or changing a channel. Beginners often miss this step.
6. Stage 5: Configure the Model and Verify the Service
The framework’s core configuration file is usually in a hidden directory in your home folder, such as ~/.openclaw/, and it uses JSON format. You can locate and edit it like this:
cd ~/.openclawlsvim openclaw.json
Add the model connection details to the configuration file. These typically include the model service base URL, the API key, and the model name. If you use a cloud model service, create an API key in that provider’s console and enter it here. If you run inference locally, enter the address of the compatible API endpoint that your local inference service exposes.
Editing notes:
- JSON is very sensitive to commas and quotation marks. After editing, check the syntax with a JSON validator.
- API keys are sensitive. Set the configuration file permissions so that only the current user can read and write it.
- After changing the configuration, restart the gateway process.
When everything is configured, open your messaging app and send a test message to the bot. If you receive a model-generated reply within a few seconds, the full path (messaging platform, gateway, channel plugin, model service, and back) is working.
7. Common Troubleshooting
- Subsystem installation fails or hangs: Check your network connection, confirm that virtualization is enabled, and confirm that your Windows version meets the subsystem requirements.
- Version manager command not found: The environment variables are not loaded. Check that the lines were added to your shell configuration file, then reopen the terminal.
- Permission error during global npm install: Node.js is usually installed in a system directory in this case. Using the Node.js version installed through the version manager avoids the error.
- Bot does not respond: Check in this order: gateway logs, channel configuration, then model API key. Start with the error messages in the gateway runtime log.
- Abnormal model replies: Confirm that the model name in the configuration file exactly matches the name the provider uses, including capitalization.
8. Summary
This guide followed a clear sequence: runtime environment, Node.js, framework, messaging channel, and model configuration. It covered the full process of deploying an open-source AI agent framework on Windows. Two lessons are worth remembering. First, a Node version manager greatly reduces the cost of maintaining your environment. Second, any change to a channel or model configuration requires restarting the gateway to take effect. With this workflow, readers can apply the same approach to other similar frameworks and move on to more advanced topics, such as managing multiple bots, developing plugins, and orchestrating scheduled tasks.
