Deploy Module
Deployment utilities for PraisonAI agents
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 8080Deployment Options
Single Agent
from praisonaiagents import Agent
agent = Agent(instructions="You are helpful.")
agent.launch(
path="/agent",
port=8000,
host="127.0.0.1" # loopback default; set "0.0.0.0" to expose (requires a token)
)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
| Variable | Description |
|---|---|
PRAISONAI_PORT | Default port (8000) |
PRAISONAI_HOST | Default host (127.0.0.1) |
PRAISONAI_LAUNCH_AUTH_TOKEN | Bearer token required by .launch() when set; auto-generated on non-loopback bind |
PRAISONAI_API_KEY | API key for authentication |
Launch Options
agent.launch(
path="/endpoint", # URL path
port=8000, # Port number
host="127.0.0.1", # Bind address (loopback default; "0.0.0.0" to expose, requires a token)
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
- Agent Launch API – HTTP API reference
- MCP Server API – MCP API reference
- CLI Module – Command-line interface