Quick Start
Copy
from praisonai import Deploy
# Deploy from agents.yaml
deploy = Deploy.from_yaml("agents.yaml")
result = deploy.deploy()
print(f"Success: {result.success}")
print(f"URL: {result.url}")
Deploy Types
API Server
Copy
from praisonai import Deploy, DeployConfig, DeployType
from praisonai.deploy.models import APIConfig
config = DeployConfig(
type=DeployType.API,
api=APIConfig(
host="0.0.0.0",
port=8005,
workers=2,
cors_enabled=True,
auth_enabled=False
)
)
deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()
Docker
Copy
from praisonai import Deploy, DeployConfig, DeployType
from praisonai.deploy.models import DockerConfig
config = DeployConfig(
type=DeployType.DOCKER,
docker=DockerConfig(
image_name="my-agent",
tag="v1.0.0",
base_image="python:3.11-slim",
expose=[8005],
registry="ghcr.io/myorg",
push=False
)
)
deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()
Cloud - AWS
Copy
from praisonai import Deploy, DeployConfig, DeployType, CloudProvider
from praisonai.deploy.models import CloudConfig
config = DeployConfig(
type=DeployType.CLOUD,
cloud=CloudConfig(
provider=CloudProvider.AWS,
region="us-east-1",
service_name="my-agent-service",
cpu="512",
memory="1024",
min_instances=1,
max_instances=5
)
)
deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()
Cloud - Azure
Copy
from praisonai import Deploy, DeployConfig, DeployType, CloudProvider
from praisonai.deploy.models import CloudConfig
config = DeployConfig(
type=DeployType.CLOUD,
cloud=CloudConfig(
provider=CloudProvider.AZURE,
region="eastus",
service_name="my-agent-service",
resource_group="my-rg",
cpu="0.5",
memory="1.0",
min_instances=1,
max_instances=10
)
)
deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()
Cloud - GCP
Copy
from praisonai import Deploy, DeployConfig, DeployType, CloudProvider
from praisonai.deploy.models import CloudConfig
config = DeployConfig(
type=DeployType.CLOUD,
cloud=CloudConfig(
provider=CloudProvider.GCP,
region="us-central1",
service_name="my-agent-service",
project_id="my-project-id",
cpu="1",
memory="512",
min_instances=0,
max_instances=10
)
)
deploy = Deploy(config, "agents.yaml")
result = deploy.deploy()
Deploy Doctor
Check deployment readiness:Copy
from praisonai import Deploy
deploy = Deploy.from_yaml("agents.yaml")
report = deploy.doctor()
print(f"Total checks: {report.total_checks}")
print(f"Passed: {report.passed_checks}")
print(f"Failed: {report.failed_checks}")
for check in report.checks:
status = "✅" if check.passed else "❌"
print(f"{status} {check.name}: {check.message}")
Provider-Specific Checks
Copy
from praisonai.deploy.doctor import (
run_local_checks,
run_aws_checks,
run_azure_checks,
run_gcp_checks,
run_all_checks
)
# Local checks only
report = run_local_checks()
# AWS checks
report = run_aws_checks()
# Azure checks
report = run_azure_checks()
# GCP checks
report = run_gcp_checks()
# All checks
report = run_all_checks()
Deploy Plan (Dry Run)
Preview deployment without executing:Copy
from praisonai import Deploy
deploy = Deploy.from_yaml("agents.yaml")
plan = deploy.plan()
print(f"Type: {plan.get('type')}")
print(f"Steps: {plan.get('steps', [])}")
YAML Configuration
API Deploy
Copy
name: My Agent
framework: praisonai
agents:
assistant:
name: Assistant
role: Helper
goal: Help users
deploy:
type: api
api:
host: 0.0.0.0
port: 8005
workers: 2
cors_enabled: true
auth_enabled: false
Docker Deploy
Copy
deploy:
type: docker
docker:
image_name: my-agent
tag: latest
base_image: python:3.11-slim
expose:
- 8005
registry: ghcr.io/myorg
push: false
Cloud Deploy (AWS)
Copy
deploy:
type: cloud
cloud:
provider: aws
region: us-east-1
service_name: my-agent-service
cpu: "512"
memory: "1024"
min_instances: 1
max_instances: 5
Cloud Deploy (Azure)
Copy
deploy:
type: cloud
cloud:
provider: azure
region: eastus
service_name: my-agent-service
resource_group: my-rg
cpu: "0.5"
memory: "1.0"
min_instances: 1
max_instances: 10
Cloud Deploy (GCP)
Copy
deploy:
type: cloud
cloud:
provider: gcp
region: us-central1
service_name: my-agent-service
project_id: my-project-id
cpu: "1"
memory: "512"
min_instances: 0
max_instances: 10
Schema Validation
Copy
from praisonai.deploy.schema import validate_agents_yaml, generate_sample_yaml
from praisonai.deploy.models import DeployType, CloudProvider
# Validate existing YAML
config = validate_agents_yaml("agents.yaml")
if config:
print(f"Deploy type: {config.type.value}")
# Generate sample YAML
yaml_content = generate_sample_yaml(DeployType.API)
print(yaml_content)
# Generate cloud sample
yaml_content = generate_sample_yaml(DeployType.CLOUD, CloudProvider.AWS)
print(yaml_content)
Deploy Status
Check the current status of a deployment:Copy
from praisonai import Deploy
deploy = Deploy.from_yaml("agents.yaml")
status = deploy.status()
# Status attributes
print(f"State: {status.state.value}") # running, stopped, pending, failed, not_found, unknown
print(f"URL: {status.url}")
print(f"Service: {status.service_name}")
print(f"Provider: {status.provider}")
print(f"Healthy: {status.healthy}")
print(f"Instances: {status.instances_running}/{status.instances_desired}")
# Convert to dictionary for JSON output
status_dict = status.to_dict()
ServiceState Values
Copy
from praisonai.deploy import ServiceState
# Available states
ServiceState.RUNNING # Service is running and healthy
ServiceState.STOPPED # Service is stopped
ServiceState.PENDING # Service is starting or updating
ServiceState.FAILED # Service failed to start
ServiceState.NOT_FOUND # Service does not exist
ServiceState.UNKNOWN # Unable to determine state
Deploy Destroy
Destroy/delete a deployment:Copy
from praisonai import Deploy
deploy = Deploy.from_yaml("agents.yaml")
# Destroy deployment
result = deploy.destroy()
print(f"Success: {result.success}")
print(f"Message: {result.message}")
print(f"Deleted: {result.resources_deleted}")
# Force destroy (removes all related resources)
result = deploy.destroy(force=True)
DestroyResult
Copy
from praisonai import Deploy
deploy = Deploy.from_yaml("agents.yaml")
result = deploy.destroy(force=True)
# Result attributes
print(f"Success: {result.success}")
print(f"Message: {result.message}")
print(f"Resources deleted: {result.resources_deleted}")
print(f"Error: {result.error}")
print(f"Metadata: {result.metadata}")
DeployResult
Copy
from praisonai import Deploy
deploy = Deploy.from_yaml("agents.yaml")
result = deploy.deploy()
# Result attributes
print(f"Success: {result.success}")
print(f"Message: {result.message}")
print(f"URL: {result.url}")
print(f"Error: {result.error}")
print(f"Metadata: {result.metadata}")
Complete Workflow Example
Copy
from praisonai import Deploy
# Initialize deployment
deploy = Deploy.from_yaml("agents.yaml")
# 1. Run health checks
report = deploy.doctor()
if not report.all_passed:
print("Fix issues before deploying:")
for check in report.checks:
if not check.passed:
print(f" - {check.name}: {check.fix_suggestion}")
exit(1)
# 2. Preview deployment plan
plan = deploy.plan()
print(f"Deploying as: {plan.get('type')}")
# 3. Deploy
result = deploy.deploy()
if result.success:
print(f"Deployed! URL: {result.url}")
else:
print(f"Failed: {result.error}")
exit(1)
# 4. Check status
status = deploy.status()
print(f"Status: {status.state.value}")
print(f"Healthy: {status.healthy}")
# 5. Destroy when done
destroy_result = deploy.destroy(force=True)
print(f"Destroyed: {destroy_result.resources_deleted}")

