> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy CLI

> Deploy agents using praisonai deploy command

Deploy agents to API servers, Docker containers, or cloud providers using `praisonai deploy`.

## Quick Start

<Steps>
  <Step title="Install PraisonAI">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    pip install praisonai
    ```
  </Step>

  <Step title="Set API Key">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    export OPENAI_API_KEY="your-key"
    ```
  </Step>

  <Step title="Initialize Deploy Config">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai deploy init --file agents.yaml --type api
    ```
  </Step>

  <Step title="Deploy">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai deploy run --file agents.yaml
    ```
  </Step>
</Steps>

## Deploy Types

| Type       | Command                       | Description          |
| ---------- | ----------------------------- | -------------------- |
| **API**    | `--type api`                  | Local FastAPI server |
| **Docker** | `--type docker`               | Docker container     |
| **AWS**    | `--type cloud --provider aws` | AWS ECS/Fargate      |
| **GCP**    | `--type cloud --provider gcp` | Google Cloud Run     |

## CLI Commands

### praisonai deploy run

Execute deployment.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy run --file agents.yaml --type api
praisonai deploy run --file agents.yaml --type docker
praisonai deploy run --file agents.yaml --type cloud --provider aws
praisonai deploy run --file agents.yaml --type cloud --provider gcp
```

### praisonai deploy init

Generate sample agents.yaml with deploy configuration.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy init --file agents.yaml --type api
praisonai deploy init --file agents.yaml --type docker
praisonai deploy init --file agents.yaml --type cloud --provider aws
praisonai deploy init --file agents.yaml --type cloud --provider gcp
```

### praisonai deploy validate

Validate agents.yaml deploy configuration.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy validate --file agents.yaml
```

### praisonai deploy plan

Show deployment plan without executing.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy plan --file agents.yaml
```

### praisonai deploy status

Show deployment status.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy status --file agents.yaml
```

**Expected Output:**

```
📊 Checking deployment status...

╭─────────────────────────────────────────────────────────────────────────────╮
│                            Deployment Status                                 │
├─────────────────┬───────────────────────────────────────────────────────────┤
│ Property        │ Value                                                     │
├─────────────────┼───────────────────────────────────────────────────────────┤
│ State           │ RUNNING                                                   │
│ Service Name    │ praisonai-api                                             │
│ Provider        │ api                                                       │
│ URL             │ http://127.0.0.1:8005                                     │
│ Healthy         │ ✅ Yes                                                    │
│ Instances       │ 1/1                                                       │
╰─────────────────┴───────────────────────────────────────────────────────────╯
```

### praisonai deploy doctor

Check deployment readiness.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy doctor
praisonai deploy doctor --provider aws
praisonai deploy doctor --provider gcp
```

### praisonai deploy destroy

Destroy/delete deployment.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai deploy destroy --file agents.yaml
praisonai deploy destroy --file agents.yaml --yes  # Skip confirmation
```

## CLI Flags

| Flag           | Type   | Default       | Description                            |
| -------------- | ------ | ------------- | -------------------------------------- |
| `--file`, `-f` | string | `agents.yaml` | Path to agents.yaml                    |
| `--type`       | choice | -             | `api`, `docker`, or `cloud`            |
| `--provider`   | choice | -             | `aws`, `gcp`, `azure` (for cloud type) |
| `--background` | flag   | false         | Run in background                      |
| `--json`       | flag   | false         | Output as JSON                         |
| `--yes`        | flag   | false         | Skip confirmation prompts              |

## agents.yaml Deploy Section

Add a `deploy` section to your agents.yaml:

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
framework: praisonai
topic: helpful assistant
roles:
  assistant:
    role: Assistant
    goal: Help users
    backstory: You are helpful
    tasks:
      help_task:
        description: Answer questions
        expected_output: Helpful response

deploy:
  type: api
  api:
    host: "127.0.0.1"
    port: 8005
    workers: 1
    cors_enabled: true
    auth_enabled: false
    reload: false
```

## Deploy Configuration Options

### API Config

| Field          | Type   | Default     | Description       |
| -------------- | ------ | ----------- | ----------------- |
| `host`         | string | `127.0.0.1` | Server host       |
| `port`         | int    | `8005`      | Server port       |
| `workers`      | int    | `1`         | Worker processes  |
| `cors_enabled` | bool   | `true`      | Enable CORS       |
| `auth_enabled` | bool   | `false`     | Enable auth       |
| `auth_token`   | string | `null`      | Auth token        |
| `reload`       | bool   | `false`     | Auto-reload (dev) |

### Docker Config

| Field        | Type       | Default            | Description      |
| ------------ | ---------- | ------------------ | ---------------- |
| `image_name` | string     | `praisonai-app`    | Image name       |
| `tag`        | string     | `latest`           | Image tag        |
| `base_image` | string     | `python:3.11-slim` | Base image       |
| `expose`     | list\[int] | `[8005]`           | Ports to expose  |
| `registry`   | string     | `null`             | Registry URL     |
| `push`       | bool       | `false`            | Push to registry |

### Cloud Config

| Field           | Type   | Default | Description           |
| --------------- | ------ | ------- | --------------------- |
| `provider`      | enum   | -       | `aws`, `gcp`, `azure` |
| `region`        | string | -       | Deployment region     |
| `service_name`  | string | -       | Service name          |
| `cpu`           | string | `256`   | CPU allocation        |
| `memory`        | string | `512`   | Memory (MB)           |
| `min_instances` | int    | `1`     | Min instances         |
| `max_instances` | int    | `10`    | Max instances         |
| `env_vars`      | dict   | `null`  | Environment vars      |

## SDK Deploy Class

Deploy programmatically using Python:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai.deploy import Deploy, DeployConfig, DeployType
from praisonai.deploy.models import APIConfig

config = DeployConfig(
    type=DeployType.API,
    api=APIConfig(host="127.0.0.1", port=8005, workers=1)
)

deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()

print(f"URL: {result.url}")
```

### Deploy Methods

| Method                     | Description                                |
| -------------------------- | ------------------------------------------ |
| `deploy(background=False)` | Execute deployment                         |
| `plan()`                   | Generate deployment plan without executing |
| `status()`                 | Get current deployment status              |
| `doctor()`                 | Run health checks                          |
| `destroy(force=False)`     | Destroy/delete deployment                  |

## Troubleshooting

| Issue              | Fix                                |
| ------------------ | ---------------------------------- |
| No deploy section  | Run `praisonai deploy init`        |
| Invalid config     | Run `praisonai deploy validate`    |
| Missing deps       | Run `praisonai deploy doctor`      |
| Deploy failed      | Check `praisonai deploy status`    |
| Port in use        | Change port in agents.yaml         |
| Missing API key    | `export OPENAI_API_KEY="your-key"` |
| Docker not running | Start Docker daemon                |
| AWS credentials    | `export AWS_ACCESS_KEY_ID=...`     |
| GCP credentials    | `gcloud auth login`                |

## Related

* [API Deploy](./api) - Deploy as local API server
* [Docker Deploy](./docker) - Deploy to Docker
* [AWS Deploy](./aws) - Deploy to AWS ECS/Fargate
* [GCP Deploy](./gcp) - Deploy to Google Cloud Run
