TypeScript Examples

import { Prava } from 'prava';

const client = new Prava({ apiKey: 'prava_sk_...' });

// Send work
const task = await 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
const result = await client.tasks.get(task.id);
console.log(`Status: ${result.status}`);
console.log(`Completed in ${result.sla.completed_in_minutes} minutes`);
console.log(`Accuracy: ${result.sla.accuracy_guarantee * 100}%`);
console.log(`Processed: ${result.result.invoices_processed} invoices`);

// Monitor task progress
const status = await client.tasks.get(task.id);
if (status.status === 'completed') {
  console.log('Results:', status.result);
}

// List all tasks
const allTasks = await client.tasks.list();

Labor Examples

Salesforce Lead Generation

const leadTask = await client.tasks.create({
  workflow: "salesforce_leads",
  data: {
    target_companies: ["Series A SaaS", "50-200 employees"],
    geography: "US West Coast",
    contact_titles: ["VP Engineering", "CTO", "Head of DevOps"]
  },
  max_price: 3000,    // $30 max
  deadline: "2025-09-16T09:00:00Z"  // Tomorrow 9am
});

// Expected result:
// {
//   result: {
//     leads_found: 127,
//     qualified_contacts: 89,
//     salesforce_records_created: 89,
//     avg_confidence: 0.92
//   },
//   sla: {
//     completed_in_minutes: 42,
//     accuracy_guarantee: 0.95
//   }
// }

EHR Data Processing

const ehrTask = await 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
//   }
// }

Compliance Audit

const auditTask = await client.tasks.create({
  workflow: "compliance_audit",
  data: {
    document_folder: "s3://legal-docs/q4-contracts/",
    compliance_framework: "SOX",
    risk_threshold: "medium"
  },
  max_price: 8000,    // $80 max
  deadline: "2025-09-17T17:00:00Z"  // End of week
});

// Expected result:
// {
//   result: {
//     documents_reviewed: 234,
//     violations_found: 7,
//     risk_score: 0.23,
//     remediation_report_url: "s3://reports/audit_20250315.pdf"
//   },
//   sla: {
//     completed_in_minutes: 95,
//     accuracy_guarantee: 0.99
//   }
// }

Environment Variables

// Uses PRAVA_API_KEY automatically
const client = new Prava();

// Or explicit configuration
const client = new Prava({
  apiKey: process.env.PRAVA_API_KEY
});