Skip to main content
Deploy agents as a local FastAPI server using praisonai deploy run --type api.

CLI

pip install praisonai
export OPENAI_API_KEY="your-key"

# Initialize with API deploy config
praisonai deploy init --file agents.yaml --type api

# Deploy as API server
praisonai deploy run --file agents.yaml --type api
Expected Output:
🚀 Starting deployment...

✅ Deployment successful!
🔗 URL: http://127.0.0.1:8005

Metadata:
  • type: api
  • host: 127.0.0.1
  • port: 8005
  • workers: 1
Verify:
curl http://127.0.0.1:8005/health

Python

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}")

agents.yaml

framework: praisonai
topic: helpful assistant
roles:
  assistant:
    role: Assistant
    goal: Help users with their questions
    backstory: You are a helpful assistant
    tasks:
      help_task:
        description: Answer user 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

API Config Options

FieldTypeDefaultDescription
hoststring127.0.0.1Server host
portint8005Server port
workersint1Number of worker processes
cors_enabledbooltrueEnable CORS
auth_enabledboolfalseEnable authentication
auth_tokenstringnullAuthentication token
reloadboolfalseEnable auto-reload (dev)

CLI Flags

FlagTypeDefaultDescription
--file, -fstringagents.yamlPath to agents.yaml
--typechoice-Must be api
--backgroundflagfalseRun in background
--jsonflagfalseOutput as JSON

Background Mode

Run the API server in background:
praisonai deploy run --file agents.yaml --type api --background

Check Status

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                                                       │
╰─────────────────┴───────────────────────────────────────────────────────────╯

Stop Server

praisonai deploy destroy --file agents.yaml

Troubleshooting

IssueFix
Port in useChange port in agents.yaml or use --port
No agents.yamlRun praisonai deploy init --type api
Missing API keyexport OPENAI_API_KEY="your-key"
Server not startingRun praisonai deploy doctor