# Deploy

> Deploy PraisonAI agents to cloud, Docker, or as local servers

Source: https://praison.ai/docs/deploy/index/
PraisonAI offers two deployment approaches: **Deploy to Cloud/Docker** using `praisonai deploy` CLI, or **Run as a Server** locally using Python SDK.

## Choose Your Path

  - [Deploy to Cloud](https://praison.ai#deploy-to-cloud): Deploy agents to AWS, Azure, GCP, or Docker
  - [Run as Server](https://praison.ai#run-as-server): Start HTTP, MCP, A2A, or AGUI servers locally

---

## Deploy to Cloud

Use `praisonai deploy` to deploy agents to cloud providers or Docker containers.

> **Warning:** The auto-generated `api.py` (produced by `praisonai deploy run --type api`) imports `bleach` to sanitise markdown output before returning it as HTML. Install it alongside `praisonai`:
> 
> ```bash
pip install praisonai bleach
```
> 
> Without `bleach`, the generated server fails at startup with `ModuleNotFoundError: No module named 'bleach'`.

  
### Local API

```bash
pip install praisonai bleach
praisonai deploy run --type api
# As of 4.6.34, requires bearer token by default
# See API Server Authentication guide
```

  
### Docker

```bash
praisonai deploy run --type docker
```

  
### AWS

```bash
praisonai deploy run --type cloud --provider aws
```

  
### GCP

```bash
praisonai deploy run --type cloud --provider gcp
```

  
### Azure

```bash
praisonai deploy run --type cloud --provider azure
```

### Cloud Deployment Pages

| Target | Description | Guide |
|--------|-------------|-------|
| **API Server** | Local FastAPI server for development | [API Guide](./cli/api) · [Auth Guide](/features/api-server-auth) |
| **Docker** | Containerized deployment | [Docker Guide](./cli/docker) |
| **AWS** | Deploy to AWS ECS/Fargate | [AWS Guide](./cli/aws) |
| **Azure** | Deploy to Azure Container Apps | [Azure Guide](./cli/azure) |
| **GCP** | Deploy to Google Cloud Run | [GCP Guide](./cli/gcp) |

### Deploy CLI Commands

| Command | Description |
|---------|-------------|
| `praisonai deploy run` | Execute deployment |
| `praisonai deploy init` | Generate agents.yaml with deploy config |
| `praisonai deploy doctor` | Check deployment readiness |
| `praisonai deploy status` | View deployment status |
| `praisonai deploy destroy` | Remove deployment |

- [Deploy CLI Reference](https://praison.ai/docs/deploy/cli/index/): Complete guide to all `praisonai deploy` commands and options

### New Deploy Surfaces

Local stacks, cloud providers, Kubernetes charts, and one-command scaffolding.

  - [Docker Compose Stack](https://praison.ai/docs/features/compose-stack/): Local API + Postgres with `praisonai deploy compose up`
  - [Deploy Templates](https://praison.ai/docs/features/create-templates/): Scaffold projects with `praisonai deploy create`
  - [Deploy to Fly.io](https://praison.ai/docs/features/fly/): One-command Fly.io deploy
  - [Deploy to Railway](https://praison.ai/docs/features/railway/): One-command Railway deploy
  - [Deploy to Render](https://praison.ai/docs/features/render/): One-command Render deploy
  - [Helm CLI Wrapper](https://praison.ai/docs/features/helm-cli/): `praisonai deploy helm --chart gateway|agents-api`
  - [Helm Chart — Agents API](https://praison.ai/docs/features/helm-chart-agents-api/): Agents API + Postgres on Kubernetes

---

## Run as Server

Start agents as servers locally using Python SDK or CLI.

```mermaid
flowchart LR
    subgraph CLI["praisonai serve"]
        A[agents] --> HTTP["HTTP :8000"]
        G[gateway] --> WS["WebSocket :8765"]
        M[mcp] --> MCP["MCP :8080"]
        U[ui] --> UI["Chainlit :8082"]
        R[recipe] --> REC["HTTP :8765"]
        UN[unified] --> ALL["All-in-One :8765"]
    end
    
    style CLI fill:#189AB4,color:#fff
    style HTTP fill:#8B0000,color:#fff
    style WS fill:#8B0000,color:#fff
    style MCP fill:#8B0000,color:#fff
    style UI fill:#8B0000,color:#fff
    style REC fill:#8B0000,color:#fff
    style ALL fill:#8B0000,color:#fff
```

  
### HTTP Server

```python
from praisonaiagents import Agent

agent = Agent(instructions="You are helpful")
agent.launch(port=8000)
```

  
### MCP Server

```python
from praisonaiagents import ToolsMCPServer

server = ToolsMCPServer(name="my-tools")
server.run(transport="sse", port=8080)
```

  
### CLI

```bash
praisonai serve agents --port 8000
```

### All Serve Commands

> **Note:** All server commands are now unified under `praisonai serve <type>`. 
> Run `praisonai serve` to see all available options.

Use `praisonai serve <type>` to start any server. All options in one place:

| Command | Protocol | Default Port | Description |
|---------|----------|--------------|-------------|
| `praisonai serve agents` | HTTP | 8000 | Agents as HTTP REST API |
| `praisonai serve gateway` | WebSocket | 8765 | Multi-agent real-time coordination |
| `praisonai serve mcp` | STDIO/SSE | 8080 | MCP server for Claude/Cursor |
| `praisonai serve acp` | STDIO | - | Agent Client Protocol for IDEs |
| `praisonai serve lsp` | STDIO | - | Language Server Protocol |
| `praisonai serve ui` | HTTP | 8082 | Chainlit web interface |
| `praisonai serve rag` | HTTP | 9000 | RAG query server |
| `praisonai serve registry` | HTTP | 7777 | Package registry server |
| `praisonai serve docs` | HTTP | 3000 | Documentation preview |
| `praisonai serve scheduler` | Background | - | Job scheduler daemon |
| `praisonai serve recipe` | HTTP | 8765 | Recipe runner server |
| `praisonai serve a2a` | JSON-RPC | 8082 | Agent-to-Agent protocol |
| `praisonai serve a2u` | SSE | 8002 | Agent-to-User event stream |
| `praisonai serve unified` | HTTP/SSE | 8765 | Agents API + A2A + A2U combined |
| `praisonai serve openai` | HTTP/SSE | 8765 | OpenAI API compatibility layer |

- [Unified Serve Reference](https://praison.ai/docs/deploy/servers/serve/): Complete guide to all `praisonai serve` commands and options

> **Warning:** `praisonai serve agents` **and** `praisonai serve unified` refuse a non-localhost bind (`--host 0.0.0.0`) unless an API key is set — both drive tool-invocation routes, so they exit with `SystemExit` when neither `--api-key` nor `PRAISONAI_SERVE_API_KEY` is present. Localhost binds need no key. See [Agents Server → Security](./servers/agents#security) and [Unified Server → Security](./servers/unified#security).

### Server Type Guides

| Server | Use Case | Guide |
|--------|----------|-------|
| **Unified Serve** | All serve commands in one place | [Serve Commands](./servers/serve) |
| **Agents** | HTTP REST API for single/multi-agent systems | [Agents Server](./servers/agents) |
| **Gateway** | WebSocket multi-agent real-time coordination | [Gateway Server](./servers/gateway) |
| **MCP** | Expose tools to Claude Desktop, Cursor | [MCP Server](./servers/tools-mcp) |
| **A2A** | Agent-to-Agent protocol communication | [A2A Server](./servers/a2a) |
| **AGUI** | CopilotKit frontend integration | [AGUI Server](./servers/agui) |

---

## API Reference

Documentation for all server endpoints.

| API | Protocol | Reference |
|-----|----------|-----------|
| **Agents API** | HTTP REST | [Endpoints](./api/agents-api) |
| **MCP API** | MCP Protocol | [Endpoints](./api/mcp-api) |
| **A2A API** | JSON-RPC | [Endpoints](./api/a2a-api) |
| **AGUI API** | SSE Streaming | [Endpoints](./api/agui-api) |

---

## Quick Decision Guide

| I want to... | Use |
|--------------|-----|
| Test locally | `praisonai deploy run --type api` or `agent.launch()` (auto-generated API server prints bearer token on each startup) |
| Deploy to production | `praisonai deploy run --type cloud --provider <aws/gcp/azure>` |
| Containerize my agent | `praisonai deploy run --type docker` |
| Integrate with Claude Desktop | [Tools MCP Server](./servers/tools-mcp) |
| Build a chat UI | [AGUI Server](./servers/agui) with CopilotKit |
| Connect agents together | [A2A Server](./servers/a2a) |
