A Guide to Native Windows Deployment for AI Agents: From Environment Checks to Stable Operation

    This guide is designed for individual developers and small teams looking to deploy AI agents natively on Windows 10 and Windows 11. It covers essential steps including pre-run hardware and system checks, directory planning, secure installation script review, model service configuration, and step-by-step functional verification to ensure stable operation.

    I. Target Audience & Prerequisites

    This article is intended for individual developers and small teams using AI agents on Windows 10 or Windows 11. All commands are executed in PowerShell, and paths are based on the current user directory (%USERPROFILE%), such as C:\Users\John.

    This guide does not describe the installation details of a specific version. Installation commands, version numbers, and configuration field names should be based on the project’s official release page and documentation. In this text, agent represents the startup command written by the installer, and <...> represents placeholders that need to be replaced.

    The following table compares three deployment methods to help you determine whether native Windows deployment is appropriate:

    Dimension Native Windows WSL2 Container (Docker Desktop)
    Extra Components None Linux distribution & virtualization platform Container runtime & virtualization platform
    File Location Windows file system Linux file system, cross-system access may be slower Requires directory mount configuration
    Debugging Difficulty Low, configuration and logs are directly visible Medium Medium to High
    Main Risks Differences between Windows versions High resource consumption Image source and mount permissions require auditing

    If the AI agent relies on tools that only run on Linux, native deployment may not be suitable. It is recommended to confirm tool requirements first.

    II. Pre-Run Checks

    2.1 Check System and Hardware

    Execute the following commands in sequence to confirm your system version and architecture:

    1. Get-ComputerInfo -Property WindowsProductName, WindowsVersion, OsArchitecture
    2. $PSVersionTable.PSVersion

    In the output of the first command, OsArchitecture should be 64-bit. The second command should display version 5.1 or higher. If the installer requires a newer PowerShell version, refer to its documentation.

    Check available memory:

    1. Get-CimInstance Win32_OperatingSystem | Select-Object @{n='TotalGB';e={[math]::Round($_.TotalVisibleMemorySize/1MB,1)}}

    Check disk space:

    1. Get-PSDrive -PSProvider FileSystem | Select-Object Name, @{n='FreeGB';e={[math]::Round($_.Free/1GB,1)}}

    Basic requirements are as follows:

    • 64-bit Windows system;
    • PowerShell 5.1 or above;
    • At least a dual-core processor;
    • 4GB or more RAM recommended;
    • At least 2GB of free space on the installation drive for dependencies, logs, and backups. The official minimum footprint might only be a few hundred megabytes, but logs and backups grow quickly;
    • Network access to the model service endpoint and software package download sources.

    If the model is called via a remote API, the local machine only runs the agent’s control program and typically does not need to handle the model inference workload.

    2.2 Directory Planning

    It is recommended to place all data in a dedicated directory with the following structure:

    1. %USERPROFILE%\agent-home\
    2. config\ # Configuration files
    3. data\ # Memory and session data
    4. logs\ # Runtime logs
    5. workspace\ # Files accessible by the agent
    6. backup\ # Backup copies

    Create the directories using the following command:

    1. "config","data","logs","workspace","backup" | ForEach-Object {
    2. New-Item -ItemType Directory -Path "$env:USERPROFILE\agent-home\$_" -Force | Out-Null
    3. }

    Note the following when planning your directories:

    • Avoid using OneDrive, desktop sync folders, or temporary cleanup directories, as these locations may overwrite or delete files;
    • If your username contains spaces, enclose the path in double quotes;
    • Do not place the installation directory in C:\Program Files or other locations that require administrator privileges;
    • Do not share the same configuration and data directories across multiple versions.

    Test if the directory is writable with normal user privileges:

    1. Set-Content -Path "$env:USERPROFILE\agent-home\data\write-test.txt" -Value "ok"
    2. Get-Content "$env:USERPROFILE\agent-home\data\write-test.txt"
    3. Remove-Item "$env:USERPROFILE\agent-home\data\write-test.txt"

    The expected output is ok. If you receive an access denied error, change the directory rather than elevating privileges.

    III. Installation and Health Check

    3.1 Choose a Terminal

    You can use Windows Terminal, PowerShell 7, or Windows PowerShell 5.1. Open the terminal as a normal user; do not run it as an administrator.

    3.2 Obtain and Review the Installation Script

    Find the current version’s installation command and checksum (SHA256) on the project’s official release page. Do not reuse commands from older versions, and never run scripts from unknown sources directly.

    It is recommended to download the script first, review it, and then execute it. Download the script:

    1. Invoke-WebRequest -Uri "<official-install-script-url>" -OutFile "$env:USERPROFILE\Downloads\agent-install.ps1"

    View the beginning of the script and search for suspicious operations:

    1. Get-Content "$env:USERPROFILE\Downloads\agent-install.ps1" | Select-Object -First 80
    2. Select-String -Path "$env:USERPROFILE\Downloads\agent-install.ps1" -Pattern "HKCU|HKLM|Register-ScheduledTask|Invoke-Expression|iex|Set-ItemProperty"

    Focus on the following during your review:

    • Whether it modifies the registry or user environment variables;
    • Whether it creates startup items or scheduled tasks;
    • Whether it downloads files from unknown domains;
    • Whether the default installation directory meets your expectations.

    Verify the file hash:

    1. Get-FileHash "$env:USERPROFILE\Downloads\agent-install.ps1" -Algorithm SHA256

    The output Hash must match the value published on the release page. If the release page does not provide a checksum, note that you are relying solely on source trustworthiness.

    Execute the script once confirmed. If the script is blocked from running, check the execution policy first:

    1. Get-ExecutionPolicy -List

    After confirming the script source is trusted and the hash matches, you can unblock the downloaded file:

    1. Unblock-File -Path "$env:USERPROFILE\Downloads\agent-install.ps1"
    2. & "$env:USERPROFILE\Downloads\agent-install.ps1"

    Do not set the execution policy to Unrestricted to bypass errors, and do not disable Windows security features.

    The installer output varies by version but generally looks something like this:

    1. [1/6] Checking OS and architecture ... Done
    2. [2/6] Preparing script runtime ... Done
    3. [3/6] Creating isolated virtual environment ... Done
    4. [4/6] Installing core dependencies ... Done
    5. [5/6] Initializing config and data directories ... Done
    6. [6/6] Health check ... Passed

    Record the installation path from the installer output. After installation, check if the startup items meet expectations:

    1. Get-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
    2. Get-ScheduledTask | Where-Object { $_.TaskName -like "*agent*" }

    If unrecognized startup items appear, stop and investigate before deciding whether to keep them.

    3.3 Post-Installation Basic Check

    Confirm that the startup command has been added to the PATH:

    1. Get-Command agent -ErrorAction SilentlyContinue

    The output should display the full path to the command. If there is no output, close and reopen the terminal. If there is still no result, check whether the directory output by the installer is in the user’s Path environment variable.

    IV. Model Service and Configuration

    4.1 Configuration File

    This article uses %USERPROFILE%\agent-home\config\agent.env as an example; the actual path depends on the installer output. The configuration file uses a Key=Value format, one per line:

    1. MODEL_ENDPOINT=https://your-model-gateway.example.com/v1
    2. MODEL_NAME=your-model-name
    3. REQUEST_TIMEOUT=60
    4. MAX_CONTEXT_TOKENS=8192
    5. ENABLE_TOOL_CALLING=false
    6. LOG_LEVEL=INFO
    7. DATA_DIR=C:\Users\<username>\agent-home\data

    The access token is not written to this file. It is provided via a user environment variable, see Section 4.3.

    During initial configuration, it is recommended to keep ENABLE_TOOL_CALLING as false until basic dialogue works successfully.

    4.2 Field Meanings

    Field Meaning Suggested Initial Value Common Errors
    MODEL_ENDPOINT Base URL of the model service Provided by the service provider Missing https:// or trailing slash
    MODEL_NAME Model identifier Exact match with provider’s list Case sensitivity mismatch
    MODEL_TOKEN Access credential Provided via environment variable Written to config file and accidentally synced or committed
    REQUEST_TIMEOUT Request timeout in seconds 60 Set too low, causing long tasks to be interrupted prematurely
    MAX_CONTEXT_TOKENS Context length limit Set according to model documentation Exceeding model limit returns a 400 error
    ENABLE_TOOL_CALLING Tool calling switch false initially Enabled and executing high-privilege tools without testing first
    LOG_LEVEL Log level INFO DEBUG might log request contents; change back to INFO after troubleshooting

    4.3 Set Access Token

    To prevent the token from appearing in command history, it is recommended to set it via the GUI:

    1. Press Win + R, type sysdm.cpl, and press Enter;
    2. Go to the “Advanced” tab and click “Environment Variables”;
    3. Under “User variables”, create a new variable named MODEL_TOKEN and enter the token as the value;
    4. Close and reopen the terminal.

    Check if the variable exists without displaying the token content:

    1. if ($env:MODEL_TOKEN) { "Set, length $($env:MODEL_TOKEN.Length)" } else { "Not set" }

    The expected output is Set, length followed by a number. Do not use Write-Host or echo to output the token, and do not paste the token into chat logs or screenshots.

    4.4 Minimal Connectivity Test

    Before starting the agent, test the model service directly first. The following example assumes the service is compatible with the OpenAI-style /models endpoint. If the service uses a different path, refer to the provider’s documentation.

    1. $headers = @{ Authorization = "Bearer $env:MODEL_TOKEN" }
    2. Invoke-RestMethod -Uri "$env:MODEL_ENDPOINT/models" -Headers $headers -TimeoutSec 30

    On success, the returned result should contain the model identifier specified in MODEL_NAME. If it fails, troubleshoot as follows:

    • 401 Unauthorized: The token is invalid or expired. Check if you accidentally copied extra spaces;
    • 404 Not Found: The URL path is incorrect. Verify MODEL_ENDPOINT;
    • Timeout: Check the network. Extract the hostname first, then test the port:
    1. Test-NetConnection -ComputerName ([uri]$env:MODEL_ENDPOINT).Host -Port 443

    If TcpTestSucceeded is True, the network is reachable. If you are on a corporate network, you may also need to check your system proxy settings.

    V. First Startup and Feature Verification

    Verification must be performed sequentially. If a step fails, do not proceed to the next step, and do not modify tool permissions to “trial and error”.

    5.1 Startup and Basic Dialogue

    Start the agent and specify the configuration file:

    1. agent --config "$env:USERPROFILE\agent-home\config\agent.env"

    Refer to the version documentation for startup parameters. On a normal startup, the logs will look similar to this:

    1. INFO config loaded: agent-home\config\agent.env
    2. INFO model endpoint reachable
    3. INFO agent ready

    Once in the dialogue, send a simple question, such as:

    1. Introduce yourself in one sentence.

    As long as the terminal returns a non-empty text response, the test passes.

    If it fails, check the logs. For this step, only look at recent records:

    1. Get-Content "$env:USERPROFILE\agent-home\logs\agent.log" -Tail 50
    2. Select-String -Path "$env:USERPROFILE\agent-home\logs\agent.log" -Pattern "ERROR|WARN"

    Common keywords include ConfigError (configuration read failure), AuthenticationError or 401 (token issue), and TimeoutError (timeout). Refer to Section 7 for corresponding solutions.

    5.2 Session Memory Test

    For the memory test, only use non-sensitive test information. Enter the following in the dialogue:

    1. Please remember: my test code is blue-42.

    Exit the session, restart the agent, and then ask:

    1. What is my test code?

    If the response contains blue-42, it indicates that cross-session memory is working properly.

    If it did not remember, check the following in order:

    1. Whether the data directory is writable (refer to the write test in Section 2.2);
    2. Whether the memory or persistence-related switch in the configuration is enabled;
    3. Whether both launches used the same DATA_DIR.

    Check the most recently modified files in the data directory:

    1. Get-ChildItem "$env:USERPROFILE\agent-home\data" | Sort-Object LastWriteTime -Descending | Select-Object -First 5

    After a conversation, files with a newer modification time should appear in the directory.

    Do not feed ID numbers, bank card information, or keys to the memory module. After the test, if you need to delete the test data, back up the data directory first before deleting.

    5.3 Tool Calling Test (Read-Only File Tools)

    Tool testing should start with read-only operations. First, prepare a test file:

    1. New-Item -ItemType Directory -Path "$env:USERPROFILE\agent-home\workspace\docs" -Force | Out-Null
    2. Set-Content -Path "$env:USERPROFILE\agent-home\workspace\docs\notes.txt" -Value "This is a test note." -Encoding UTF8

    Change ENABLE_TOOL_CALLING to true in agent.env. Then edit the tool configuration file to enable only the read-only file tool and restrict accessible directories:

    1. tools:
    2. read_text_file:
    3. enabled: true
    4. mode: read_only
    5. allowed_dirs:
    6. - C:\Users\<username>\agent-home\workspace\docs
    7. max_file_size_kb: 512
    8. require_confirmation: false
    9. write_file:
    10. enabled: false

    Field meanings are as follows:

    • allowed_dirs is a whitelist and must be an absolute path. The agent can only access files under this directory;
    • `mode: