Deploy Quick Start

Deploy an agent as an API server, Docker image, or cloud service in five lines

Add a deploy: section to agents.yaml, then deploy it with three method calls.

python
from praisonai_deploy import Deploy

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

📄 agents.yaml

Deploy.from_yaml

deploy

status

Quick Start

  1. Write agents.yaml

    Add a deploy: block alongside your agent definition.

    yaml
    name: Sample Agent
    framework: praisonai
    
    agents:
      assistant:
        role: Assistant
        goal: Help users with tasks
        backstory: Experienced assistant ready to help
    
    deploy:
      type: api
      api:
        host: 127.0.0.1
        port: 8005
  2. Deploy from Python
    python
    from praisonai_deploy import Deploy
    
    deploy = Deploy.from_yaml("agents.yaml")
    result = deploy.deploy()
    print(result.url)  # http://127.0.0.1:8005
  3. Or deploy from the CLI
    bash
    praisonai deploy run --file agents.yaml

agents.yaml by Type

Each deployment type reads a matching block under deploy:.

API

yaml
deploy:
  type: api
  api:
    host: 127.0.0.1
    port: 8005
    workers: 1
    cors_enabled: true
    auth_enabled: true

Docker

yaml
deploy:
  type: docker
  docker:
    image_name: praisonai-app
    tag: latest
    base_image: python:3.11-slim
    expose:
      - 8005
    push: false
  # Optional — configure the generated in-container server.
  # Omit to keep default auth on.
  api:
    host: 0.0.0.0
    port: 8005
    auth_enabled: false   # exposes /chat without a token

Cloud (GCP)

yaml
deploy:
  type: cloud
  cloud:
    provider: gcp
    region: us-central1
    service_name: my-agent
    project_id: your-project-id
    min_instances: 1
    max_instances: 10

Generate a Sample

generate_sample_yaml produces a ready-to-edit config for any type.

python
from praisonai_deploy import generate_sample_yaml, DeployType, CloudProvider

yaml_text = generate_sample_yaml(DeployType.CLOUD, CloudProvider.GCP)
print(yaml_text)

Best Practices

Start with type: api

The API type needs no cloud credentials and runs on your machine. Validate the agent locally before moving to Docker or cloud.

Validate before you deploy

Run praisonai deploy validate --file agents.yaml to catch schema errors early. It fails fast on:

  • A type: cloud block without a cloud: section.
  • Misspelled field keys (e.g. clustor_name vs cluster_name) — no more silent defaults.
  • Misspelled section names (e.g. dockerr: vs docker:), with the allowed-keys list in the error.

Related