Deploy Package

Ship agents as an API server, a Docker image, or a cloud service with praisonai-deploy

praisonai-deploy turns an agents.yaml file into a running service — a local API server, a Docker image, or a cloud deployment on AWS, Azure, GCP, Fly, Railway, Render, or any registered plugin provider.

python
from praisonai_deploy import Deploy

deploy = Deploy.from_yaml("agents.yaml")
result = deploy.deploy()
status = deploy.status()
Diagram

praisonai-deploy

📄 agents.yaml

🚀 Deploy

🖥️ API Server

📦 Docker Image

☁️ Cloud Service

Install

Standalone
pip install praisonai-deploy
With API server
pip install "praisonai-deploy[api]"
Full umbrella
pip install "praisonai[deploy]"

praisonai-deploy is a tier-2 package (C14, publish slot #8). It drives host CLIs — docker, aws, az, and gcloud — directly. No boto3, Azure, or Google Cloud SDKs are required.

Quick Start

  1. Pick a deployment type

    Every deployment is one of three types.

    python
    from praisonai_deploy import Deploy
    
    deploy = Deploy.from_yaml("agents.yaml")
  2. Deploy
    python
    result = deploy.deploy()
    print(result.url)
  3. Check status
    python
    status = deploy.status()
    print(status.state)  # running / stopped / pending / failed / not_found / unknown

Which Type?

Choose a deployment type based on where the agent runs.

Diagram

My machine

A container

A cloud provider

Where does
it run?

type: api

type: docker

type: cloud

provider: aws
ECS

provider: azure
Container Apps

provider: gcp
Cloud Run

provider: fly

provider: railway

provider: render

any registered plugin

Custom cloud providers

TypeRuns onBest for
apiLocal Flask serverDevelopment, quick demos
dockerA containerPortable, reproducible builds
cloudAWS / Azure / GCP / Fly / Railway / Render / pluginsProduction, autoscaling

PraisonAI ships six providers out of the box (aws, azure, gcp, fly, railway, render). You can add your own by publishing a package that registers under the praisonai.deploy.providers entry-point group — see Custom cloud providers.


Provider Coverage of CloudConfig

Not every provider applies every CloudConfig field. Fields a provider cannot apply are logged and echoed in DeployResult.metadata["unapplied"] (PraisonAI PR #4876).

CloudConfig fieldAWSAzureGCPFlyRailwayRender
env_vars✅✅✅✅ (fly secrets set --stage)⚠️⚠️
image✅✅✅✅⚠️⚠️
cpu / memory✅✅✅✅ (non-default only)⚠️⚠️
region✅✅✅⚠️ (fly.toml)⚠️⚠️
min_instances / max_instances✅✅✅⚠️ (flyctl scale count)⚠️⚠️

✅ applied · ⚠️ not applied (logged + metadata["unapplied"])

See Fly, Railway, and Render for the per-provider details and workarounds.


User Flow

A full deploy goes from validation to teardown.

Diagram

validate

doctor

plan

run

status

destroy

bash
praisonai deploy validate --file agents.yaml   # strict schema check — catches typos and missing sections
praisonai deploy doctor --all                  # docker/aws/az/gcloud present?
praisonai deploy plan --file agents.yaml       # dry-run
praisonai deploy run --file agents.yaml        # execute
praisonai deploy status --file agents.yaml     # poll state
praisonai deploy destroy --file agents.yaml --yes  # teardown

What’s New

Fixes bundled in this release:

  • /chat message forwarding now correctly forwards the user message.
  • Docker builds use the correct build context, environment variables, and ports, and replace existing containers on rebuild.
  • Foreground API deploys block until the process exits.
  • The CLI docker shortcut merges the YAML deploy: section into invocation flags.
  • MCP deploy.status accepts an explicit config_path argument.
  • praisonai deploy api (foreground and --background) now spawns the Flask server with the same Python interpreter as the CLI (sys.executable), so it works on Windows and any multi-Python / venv setup. The previous bare python invocation could resolve to a different interpreter and fail with ModuleNotFoundError: No module named 'flask'.
  • The generated Flask API server subprocess now inherits the parent environment (e.g. OPENAI_API_KEY), so the auto-generated /chat endpoint reaches the agent runtime without extra wiring.
  • Docker deploys now honor an optional sibling deploy.api block — set api.auth_enabled: false to expose the generated /chat endpoint unauthenticated. Previously the block was silently dropped and the container defaulted to auth-on (PR #3609).
  • Generated Docker containers now run Gunicorn with --timeout 120 --graceful-timeout 30. Cold-start /chat calls (agent import + first model round-trip) used to exceed Gunicorn’s 30 s default and get SIGKILL’d mid-request; the new defaults tolerate the cold-start latency and shut workers down cleanly on restart (PR #3630).

Best Practices

Run doctor before every cloud deploy

praisonai deploy doctor --all checks that docker, aws, az, and gcloud are installed and authenticated before you spend time on a failed deploy.

Prefer the new import path

Use from praisonai_deploy import Deploy in new code. The legacy praisonai.deploy path still resolves but is only kept for compatibility.

Keep secrets out of agents.yaml

Use env_vars references and provider secret stores rather than committing tokens into the YAML file.

ModuleNotFoundError: No module named 'flask' when running deploy api

As of PraisonAI PR #3608 the server is spawned with the same interpreter as the CLI, so this error should no longer occur on any supported install. If you still see it, verify that pip install "praisonai-deploy[api]" ran against the same Python you’re running praisonai with — python -c "import sys, flask; print(sys.executable, flask.__version__)" should print the interpreter path the deploy CLI uses.


Related