Skip to main content
Windows SDK setup for PraisonAI with virtual environments, environment variables, and UTF-8 configurations tailored for non-developers.
The user sends a message from Windows; the agent responds once the SDK environment is configured.

Quick Start

1

Python Installation & Virtual Environment

Install Python 3.10+ from python.org (recommended over Windows Store version for fewer PATH issues):
If you get execution policy errors, run:
2

Basic Agent Setup

Create a simple agent to verify installation:
3

Environment Variables Configuration

Create a .env file in your working directory:
Load and use environment variables:
4

Sandbox on Windows

Agent(sandbox=True) runs on Windows out of the box using the subprocess backend, but with weaker isolation than POSIX — for untrusted code, use docker or a cloud backend.
What applies on Windows:
  • ../ and absolute-path traversal protection is fully enforced
  • ✅ Static code safety pre-checks (check_code_safety) run normally
  • setrlimit memory / process / file-descriptor limits are not enforced
  • ❌ Process-group kill on timeout is unavailable — only the leader is killed
  • ⚠️ Symlink escape protection only triggers when symlink creation is permitted (Developer Mode / SeCreateSymbolicLinkPrivilege)
See /docs/features/sandbox#resource-limits-in-practice for the full capability matrix.To harden a Windows sandbox, switch backends — see Sandbox Backends.
5

CLI Sessions on Windows

The praisonai session commands now work on Windows out of the box — sessions are persisted to %USERPROFILE%\.praison\sessions\ using msvcrt-based file locking.
This functionality was fixed in PR #1837. Prior releases failed with ModuleNotFoundError: No module named 'fcntl' on Windows when these subcommands were invoked.
6

Running the MCP host on Windows

Serve your agents to Claude Desktop or Cursor over STDIO — supported on Windows, including Python 3.13:
Python 3.13 is supported. Earlier praisonai-mcp releases crashed on Windows with OSError: [WinError 6] The handle is invalid; the STDIO transport now reads stdin on a dedicated thread, so it works under the ProactorEventLoop.Point your MCP client at the command:
See MCP STDIO Server Transport for the reliability guarantees.

How It Works


Prerequisites

Python Installation

  • Python 3.10+ from python.org (recommended)
  • Avoid Windows Store Python for fewer PATH conflicts
  • Git for Windows with proper line endings: git config --global core.autocrlf true

IDE Configuration

Point your IDE to the virtual environment Python interpreter:
  • VS Code: Select .venv\Scripts\python.exe as interpreter
  • Cursor: Use Command Palette > Python: Select Interpreter

Virtual Environment Management

PowerShell Commands

Execution Policy Issues

If activation fails with execution policy errors:

Environment Variables

.env File Location

  • Working Directory: Place .env in your project root
  • Current Directory: load_dotenv() reads from os.getcwd()
  • Multiple Files: Use single .env file to avoid conflicts

Precedence and Loading

PYTHONPATH Configuration

For monorepo or src layouts, use session-scoped variables:
Warning: Avoid persistent PYTHONPATH via setx as it affects other projects.

Environment Variable Security


Unicode and Encoding

File Encoding Issues

Save all Python files as UTF-8 to prevent character encoding errors:
  • VS Code: Check status bar, ensure “UTF-8”
  • Notepad++: Encoding menu > “UTF-8”
  • Windows Notepad: Save As > Encoding: UTF-8

Common Encoding Error

Python Script Encoding

Add encoding declaration to Python files:

Networking and Firewall

Windows Defender Prompts

When running agents with network access:
  • Allow access when Windows Defender prompts
  • Add exception for Python.exe in Windows Security

Port Conflicts

Check for port conflicts when running multiple agents:

Localhost vs External Access


OpenClaw Integration

Subprocess Configuration

Use absolute paths for reliable subprocess execution:

Virtual Environment in Subprocesses

Ensure subprocesses use the same virtual environment:

Common Patterns

Development Workflow

Multi-Agent Windows Setup


Best Practices

  • Always activate virtual environment before installing packages
  • Use py -3.12 -m venv instead of python -m venv for version specificity
  • Keep virtual environments in project directories (.venv)
  • Add .venv/ to your .gitignore file
  • Document Python version requirements in README.md
  • Use .env files for development, proper secret management for production
  • Never commit .env files to version control (add to .gitignore)
  • Use session-scoped variables for temporary testing
  • Rotate API keys regularly and update .env files
  • Consider using Azure Key Vault or similar for production deployments
  • Always save Python files as UTF-8 encoding
  • Use pathlib.Path for cross-platform path handling
  • Use forward slashes in Python strings: "data/file.txt"
  • Test with non-ASCII characters in file names and content
  • Set Git to handle line endings: git config core.autocrlf true
  • Allow Python.exe through Windows Firewall for network features
  • Use localhost (127.0.0.1) for development, specific IPs for production
  • Check for port conflicts with netstat before starting services
  • Consider Windows network profiles (Public/Private/Domain)
  • Test connectivity with different antivirus software

Troubleshooting


Skills Documentation

Learn about Windows-compatible skills and UTF-8 handling

MCP Integration

Model Context Protocol setup for Windows environments