Deploy to Fly.io

Deploy PraisonAI to Fly.io in one command

Deploy your agents to Fly.io with a starter fly.toml and a single deploy command.

Diagram

Fly.io Deploy

💻 create –template fly

📝 Edit fly.toml

🚀 deploy fly

✅ app.fly.dev

Quick Start

  1. Scaffold the project

    The starter drops fly.toml and agents.yaml into the current directory.

    bash
    praisonai deploy create --template fly
  2. Authenticate with Fly

    Set a token or log in with flyctl.

    bash
    export FLY_API_TOKEN="..."
    # or: fly auth login
  3. Deploy

    Deploy the app; pass a region if you want to override the default.

    bash
    praisonai deploy fly

How It Works

The command shells out to flyctl deploy, so authentication follows a clear precedence.

Diagram
flyctldeploy flyUserflyctldeploy flyUserpraisonai deploy flyResolve auth (FLY_API_TOKEN → FLY_ACCESS_TOKEN → whoami)fly secrets set –stage (env_vars)flyctl deploy –app <name> –remote-only [–image –vm-cpus –vm-memory]https://<app>.fly.dev

Auth precedence: FLY_API_TOKEN → FLY_ACCESS_TOKEN → flyctl auth whoami fallback (a fly auth login session stores its token in the flyctl config, not the environment).


CloudConfig support

The Fly provider forwards most CloudConfig fields to flyctl; a few belong elsewhere and are reported instead of dropped. Added in PraisonAI PR #4876.

Diagram

CloudConfig

env_vars

image

cpu / memory

region / min_instances / max_instances

fly secrets set –stage

flyctl deploy –image

flyctl deploy –vm-cpus / –vm-memory

logged + metadata.unapplied

CloudConfig fieldApplied viaNotes
env_varsfly secrets set --stage before deployValues never appear on argv or in logs; only names are logged. --stage records secrets without a second deploy, then flyctl deploy applies them.
imageflyctl deploy --imageForwarded verbatim.
cpuflyctl deploy --vm-cpusOnly forwarded when set away from the default "256".
memoryflyctl deploy --vm-memoryOnly forwarded when set away from the default "512".
regionNot appliedSet in fly.toml. Logged and echoed in metadata["unapplied"].
min_instances / max_instancesNot appliedUse flyctl scale count. Logged and echoed in metadata["unapplied"].

Command Options

Argument / FlagDefaultDescription
FILE (positional)agents.yamlAgent file to deploy.
--region / -r(from fly.toml)Fly region override.

Starter fly.toml

The fly starter ships production-ready defaults.

SettingValue
Imageghcr.io/mervinpraison/praisonai:latest
internal_port8005
PRAISONAI_API_AUTHenabled
Health checkHTTP GET /health every 15s

Doctor

Check Fly readiness before deploying.

bash
praisonai deploy doctor --provider fly

Best Practices

Pin the image tag for production

The starter uses latest. Swap in a released tag in [build] image before shipping.

Set secrets with fly secrets, not fly.toml

Keep OPENAI_API_KEY and other secrets out of Git: fly secrets set OPENAI_API_KEY=.... Any env_vars in CloudConfig are handled for you — the provider runs fly secrets set --stage before deploying, so values never reach the command line or logs.

Keep auth enabled

The starter sets PRAISONAI_API_AUTH=enabled. Leave it on and supply a token so the public app requires Authorization: Bearer.


Add a New Provider

Provider entry points are pluggable via pyproject.toml. To add your own, register it in the provider registry (providers/_registry.py) and implement the BaseProvider interface (doctor, plan, deploy, status, destroy).


Related