Python Examples

import prava
import os

client = prava.Prava(api_key=os.environ.get("PRAVA_API_KEY"))

# Send work
task = client.tasks.create(
    workflow="quickbooks_sync",
    data={
        "invoices_folder": "s3://acme-invoices/march-2025/",
        "vendor_mapping": "existing_vendors.csv",
        "chart_of_accounts": "coa_manufacturing.json"
    },
    max_price=5000,    # Don't pay more than $50
    deadline="2025-09-15T17:00:00Z"  # Due 5pm today
)

# Get results
result = client.tasks.get(task.id)
print(f"Status: {result.status}")
print(f"Completed in {result.sla.completed_in_minutes} minutes")
print(f"Accuracy: {result.sla.accuracy_guarantee * 100}%")
print(f"Processed: {result.result.invoices_processed} invoices")

Labor Examples

EHR Data Processing

ehr_task = client.tasks.create(
    workflow="ehr_processing",
    data={
        "portal_url": "https://epic.northwellhealth.org",
        "patient_mrns": ["12345678", "87654321", "11223344"],
        "extract_fields": ["demographics", "vitals", "medications", "allergies"],
        "credentials_vault": "aws-secrets-manager://ehr-creds/northwell"
    },
    max_price=1200,    # $12 max
    deadline="2025-09-15T16:00:00Z"  # 4pm today
)

# Expected result:
# {
#   "result": {
#     "patients_processed": 3,
#     "records_extracted": 47,
#     "structured_data_url": "s3://phi-secure/extracted_20250315.json",
#     "hipaa_audit_log": "completed"
#   },
#   "sla": {
#     "completed_in_minutes": 18,
#     "accuracy_guarantee": 0.995
#   }
# }

Inventory Reconciliation

inventory_task = client.tasks.create(
    workflow="inventory_reconcile",
    data={
        "erp_system": "sap",
        "warehouse_locations": ["DC-01", "DC-02", "STORE-SF"],
        "cycle_count_file": "s3://inventory/cycle_counts_q1.csv",
        "tolerance_threshold": 0.02  # 2% variance tolerance
    },
    max_price=4000,    # $40 max
    deadline="2025-09-16T08:00:00Z"  # Tomorrow morning
)

# Expected result:
# {
#   "result": {
#     "items_reconciled": 15847,
#     "discrepancies_found": 23,
#     "total_variance_value": 2847.33,
#     "erp_adjustments_made": 23,
#     "reconciliation_report": "s3://reports/recon_20250315.xlsx"
#   },
#   "sla": {
#     "completed_in_minutes": 52,
#     "accuracy_guarantee": 0.998
#   }
# }

Environment Variables

# Uses PRAVA_API_KEY automatically
client = prava.Prava()

# Or explicit configuration
client = prava.Prava(api_key="your-api-key")