Platform CLI

Start the PraisonAI platform server from command line

Start the PraisonAI platform server with python -m praisonai_platform for local development and production deployment.

Start the PraisonAI platform server with python -m praisonai_platform for local development and production deployment.

python
from praisonaiagents import Agent

agent = Agent(name="dev-assistant", instructions="Run the local platform server.")
agent.start("Start the platform on port 8000 for local testing.")

The user runs python -m praisonai_platform; the CLI boots the API server for development or production.

Diagram

Platform CLI

📋 CLI Command

🚀 Server Start

✅ Running Platform

Quick Start

  1. Basic Usage

    Start the platform server with default settings:

    bash
    python -m praisonai_platform

    This starts the server on http://127.0.0.1:8000 (localhost only) with automatic reload disabled. Set PLATFORM_HOST=0.0.0.0 or pass --host 0.0.0.0 to listen on all interfaces.

  2. Development Mode

    Start with auto-reload for development:

    bash
    python -m praisonai_platform --port 9000 --reload

    This enables automatic restart when code changes are detected.


How It Works

Diagram
PlatformUvicornCLIPlatformUvicornCLIStart serverLoad create_app()FastAPI appServer running
ComponentPurpose
CLI Entry Pointpython -m praisonai_platform command
UvicornASGI server with factory mode
Platform AppFastAPI application with routes

Environment Variables

Env VarDefaultDescription
PLATFORM_HOST127.0.0.1Default bind address; overridden by --host flag if both are set

Configuration Options

CLI Arguments

Command line flags and options

CLI Arguments

FlagTypeDefaultDescription
--hoststr"127.0.0.1" (or $PLATFORM_HOST)Server bind address
--portint8000Server port number
--reloadboolFalseEnable auto-reload on changes

Common Patterns

Production Deployment

bash
# Bind to specific host and port
python -m praisonai_platform --host 127.0.0.1 --port 8080

Development Server

bash
# Auto-reload with custom port
python -m praisonai_platform --port 9000 --reload

Docker Container

bash
# Bind to all interfaces for container access
python -m praisonai_platform --host 0.0.0.0 --port 8000

Best Practices

Use auto-reload for development only

The --reload flag monitors file changes and restarts the server automatically. Only use this during development as it adds overhead and can cause issues in production.

Use localhost binding by default

The new default --host 127.0.0.1 only accepts connections from localhost, preventing accidental exposure on public networks. Use --host 0.0.0.0 only when you specifically need remote access, preferably behind a reverse proxy like nginx.

Choose appropriate ports

Use standard ports like 8000 or 8080 for HTTP services. Ensure the port is available and not blocked by firewalls.


Related