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.
from praisonai_deploy import Deploy
deploy = Deploy.from_yaml("agents.yaml")
result = deploy.deploy()
status = deploy.status()Install
pip install praisonai-deploypip install "praisonai-deploy[api]"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
- Pick a deployment type
Every deployment is one of three types.
python from praisonai_deploy import Deploy deploy = Deploy.from_yaml("agents.yaml") - Deploy
python result = deploy.deploy() print(result.url) - 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.
| Type | Runs on | Best for |
|---|---|---|
api | Local Flask server | Development, quick demos |
docker | A container | Portable, reproducible builds |
cloud | AWS / Azure / GCP / Fly / Railway / Render / plugins | Production, 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 field | AWS | Azure | GCP | Fly | Railway | Render |
|---|---|---|---|---|---|---|
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.
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 # teardownWhat’s New
Fixes bundled in this release:
/chatmessage 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.statusaccepts an explicitconfig_pathargument. 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 barepythoninvocation could resolve to a different interpreter and fail withModuleNotFoundError: No module named 'flask'.- The generated Flask API server subprocess now inherits the parent environment (e.g.
OPENAI_API_KEY), so the auto-generated/chatendpoint reaches the agent runtime without extra wiring. - Docker deploys now honor an optional sibling
deploy.apiblock — setapi.auth_enabled: falseto expose the generated/chatendpoint 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/chatcalls (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.