Skip to main content
Run all your bots from one command. The Gateway Server manages multiple bot connections and routes messages to the right AI agent.

Quick Start

1

Install PraisonAI

pip install praisonai
2

Create gateway.yaml

Create a gateway.yaml file in your project:
gateway:
  host: "127.0.0.1"
  port: 8765

agents:
  personal:
    instructions: "You are a helpful personal assistant"
    model: gpt-4o-mini
    tools:
      - internet_search
      - get_current_time
    reflection: true
  support:
    instructions: "You are a customer support agent"
    model: gpt-4o
    role: "Customer Support Specialist"
    goal: "Resolve customer issues quickly and accurately"
    backstory: "Expert in troubleshooting and customer care"
    tools:
      - internet_search
    tool_choice: auto
    allow_delegation: false

channels:
  telegram:
    token: ${TELEGRAM_BOT_TOKEN}
    routes:
      dm: personal
      group: support
      default: personal
  discord:
    token: ${DISCORD_BOT_TOKEN}
    routes:
      default: personal
3

Set Environment Variables

export TELEGRAM_BOT_TOKEN=your_telegram_token
export DISCORD_BOT_TOKEN=your_discord_token
export OPENAI_API_KEY=your_openai_key
4

Start the Gateway

praisonai gateway start --config gateway.yaml
All bots start together. Messages are routed to the correct agent automatically.

Supported Channels

Telegram

Full support for DMs, groups, commands, voice, and media.

Discord

Guild channels, DMs, slash commands, and embeds.

Slack

Socket Mode, channels, DMs, slash commands, and threads.

WhatsApp

Cloud API and Web mode. DMs, groups, media support.

Configuration Reference

Gateway Section

FieldTypeDefaultDescription
hoststring127.0.0.1Address to bind the gateway server
portinteger8765Port for the WebSocket server

Agents Section

Each agent is defined by a unique ID and its configuration:
agents:
  my_agent_id:
    instructions: "Your system prompt here"
    model: gpt-4o-mini
    memory: true
    tools:
      - internet_search
      - get_current_time
    reflection: true
    role: "Research Analyst"
    goal: "Find accurate information"
    backstory: "Expert researcher"
    tool_choice: auto
    allow_delegation: false
FieldTypeDefaultDescription
instructionsstring""System prompt for the agent
modelstringNoneLLM model (e.g., gpt-4o-mini, gpt-4o)
memorybooleanfalseEnable conversation memory
toolslist[]Tool names resolved via ToolResolver
reflectionbooleantrueEnable self-reflection / interactive mode
rolestringNoneAgent role (CrewAI-style)
goalstringNoneAgent goal (CrewAI-style)
backstorystringNoneAgent backstory (CrewAI-style)
tool_choicestringNoneauto, required, or none
allow_delegationbooleanfalseAllow task delegation to other agents

Channels Section

Each channel maps to a bot platform:
channels:
  telegram:
    token: ${TELEGRAM_BOT_TOKEN}    # Environment variable
    routes:
      dm: personal                   # DMs → personal agent
      group: support                 # Groups → support agent
      default: personal              # Fallback agent
Use ${ENV_VAR_NAME} syntax in token fields. The gateway automatically reads from your environment variables.

CLI Commands

praisonai gateway start --config gateway.yaml

Python Usage

from praisonai.gateway import WebSocketGateway

# Load gateway config, agents, and channels from YAML
gateway = WebSocketGateway.from_config_file("gateway.yaml")

import asyncio
asyncio.run(gateway.start())
from_config_file() automatically resolves ${ENV_VAR} syntax in your YAML, creates agents with tools, and configures channel bots.
The gateway exposes a health endpoint at http://host:port/health:
curl http://127.0.0.1:8765/health
Returns:
{
  "status": "healthy",
  "uptime": 120.5,
  "agents": 2,
  "sessions": 3,
  "clients": 1
}
You can still run a single bot without the gateway:
praisonai bot telegram --token $TELEGRAM_BOT_TOKEN
This starts just one bot connected to a single agent — no gateway needed.
Never commit bot tokens to version control. Always use environment variables or a .env file.