Skip to main content

Deploy Module

The Deploy module provides utilities for deploying PraisonAI agents as APIs and services.

Installation

pip install "praisonai[os]"

Quick Start

from praisonaiagents import Agent

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant."
)

# Deploy as HTTP API
agent.launch(path="/ask", port=8000)

CLI Deployment

# Deploy with CLI
praisonai --deploy

# Deploy with specific port
praisonai --deploy --port 8080

Deployment Options

Single Agent

from praisonaiagents import Agent

agent = Agent(instructions="You are helpful.")
agent.launch(
    path="/agent",
    port=8000,
    host="0.0.0.0"
)

Multiple Agents

from praisonaiagents import Agent, AgentTeam

agents = AgentTeam(agents=[
    Agent(name="Research", instructions="Research topics"),
    Agent(name="Writer", instructions="Write content")
])

agents.launch(path="/team", port=8000)

MCP Server

from praisonaiagents import Agent

agent = Agent(instructions="You are helpful.")
agent.launch(port=8080, protocol="mcp")

Configuration

Environment Variables

VariableDescription
PRAISONAI_PORTDefault port (8000)
PRAISONAI_HOSTDefault host (0.0.0.0)
PRAISONAI_API_KEYAPI key for authentication

Launch Options

agent.launch(
    path="/endpoint",      # URL path
    port=8000,             # Port number
    host="0.0.0.0",        # Bind address
    debug=False,           # Debug mode
    cors_origins=["*"],    # CORS settings
    api_key="secret",      # Authentication
    protocol="http"        # http or mcp
)

Docker Deployment

FROM python:3.11-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
EXPOSE 8000

CMD ["python", "agent.py"]

Cloud Deployment

See deployment guides:

See Also