Skip to main content
The gateway now ships in the praisonai-bot package. praisonai serve gateway still works exactly as documented here; for a standalone install see praisonai-bot Migration.
Deploy the PraisonAI Gateway on Windows with multiple Telegram bots, proper encoding, and production-ready configuration.
The user runs the gateway on Windows; deployment settings handle paths, services, and encoding.

How It Works

Deployment Steps

Quick Start

1

Install Dependencies

Install Python dependencies with both extras required for gateway:
Why both extras are needed:Without [api] you’ll get:
2

Configure Windows UTF-8

Mandatory for Windows gateway deployments:
Why this is required:Without UTF-8 configuration, you’ll see encoding errors:
This often appears after API failures (OpenAI 429 quota exceeded). Fix billing first, then encoding.
3

Create Gateway Configuration

Create gateway.yaml:
Create .env file:
4

Start Gateway

Launch the gateway with configuration:
Expected output:

Windows-Specific Configuration

Environment Variables

Windows PowerShell environment setup:

UTF-8 Encoding Setup

Three ways to configure UTF-8 on Windows:
Recommended approach - works for current session.

Windows Service Installation

For production deployment as Windows service:

Multi-Channel Windows Setup

Hermes-Style Workforce Example

Complete gateway.yaml for 3-bot Hermes workforce:
Matching .env file:

Creating Multiple Telegram Bots

Important: Each channel needs its own Telegram bot token.
  1. Create CFO Bot:
    • Message @BotFather
    • /newbot
    • Name: “CFO Assistant Bot”
    • Username: “your_company_cfo_bot”
    • Save token as TELEGRAM_CFO_TOKEN
  2. Create Ops Bot:
    • /newbot (same BotFather)
    • Name: “Operations Assistant Bot”
    • Username: “your_company_ops_bot”
    • Save token as TELEGRAM_OPS_TOKEN
  3. Create Content Bot:
    • /newbot (same BotFather)
    • Name: “Content Assistant Bot”
    • Username: “your_company_content_bot”
    • Save token as TELEGRAM_CONTENT_TOKEN
Never reuse tokens - each bot must be separate.

Health Monitoring

Health Check Commands

Monitor gateway status:
Expected healthy response:

Process Management

Check running gateway processes:

Security Configuration

User Access Control

Configure allowed users to prevent unauthorized access:
.env configuration:
If you leave TELEGRAM_ALLOWED_USERS empty, you must also set unknown_user_policy: "allow" for the bot to reply to anyone (since PR #1885). For production, set TELEGRAM_ALLOWED_USERS to your user IDs and leave unknown_user_policy at the default "deny".
Security caveat: Current gateway Telegram polling path may not enforce allowlist until PraisonAI security fix ships. Verify access control after update.

Token Security

Secure token storage on Windows:

Troubleshooting Windows Issues

Common Windows Errors

Symptoms:
Causes:
  1. Missing UTF-8 environment configuration
  2. OpenAI API failure (429 quota) + encoding issue
Solutions:
Symptoms:
Cause: On Windows, os.kill(pid, 0) can raise SystemError. From PraisonAI ≥ v4.6.141 the message is advisory only — the /health probe still runs and shows the real gateway status.
This line replaces Gateway PID lock: … / Port …: … when the check fails, and the /health probe still runs so you still see the real status. The gateway is running when Gateway Status: healthy follows.
Solution:
See Windows: gateway status shows PID lock status: Unavailable and PraisonAI #2844 / PR #2849 for the underlying cause.
Error:
Solution:
Symptoms:
  • Bot works initially, then stops mid-session
  • Log shows: Conflict: terminated by other getUpdates request
  • Health check still shows "running": true
Cause: Duplicate gateway processes polling same tokenSolution:
Symptoms:
  • Telegram typing indicator disappears after 5 seconds
  • Reply comes 20-30 seconds later
  • No error messages
Explanation: This is normal behavior for RAG + LLM processing.User guidelines:
  • Do not send duplicate messages during wait
  • Do not restart gateway during response window
  • Typing indicator renewal fix is pending in PraisonAI

Windows-Specific Debugging

Enable detailed logging:
Check Windows firewall:

Performance Optimization

Windows Resource Configuration

Optimize for Windows deployment:
PowerShell performance script:

Production Deployment

Windows Server Configuration

For production Windows Server deployment:
IIS reverse proxy (optional):

Best Practices

Create monitoring task:
Enable application logging:
For development, consider WSL:
This avoids Windows-specific encoding issues during development.

Gateway Overview

Architecture and concepts

Multi-Channel Telegram

Hermes workforce pattern