VirtuousAI
Primitives

Automations

Configure automated workflows that execute actions on triggers

Automations

Automations are workflows that execute actions based on triggers. They connect your triggers (when) with your actions (what) and conditions (if).

Concept

An automation combines:

  • Trigger — When to run (schedule, webhook, event)
  • Conditions — Whether to run (filters, guards)
  • Actions — What to execute (one or more, in sequence or DAG)

ComponentExamples
Triggerschedule: "0 6 * * *", webhook: /orders, event: action.completed
Conditionsorder.total > 100, status = "new", region in ["US", "CA"]
Actionsdlt_extract, insight_delegate, web_search

Trigger Types

Schedule Triggers

Run automations on a cron schedule:

ScheduleCron ExpressionDescription
Every hour0 * * * *Top of every hour
Daily at 2am0 2 * * *Once per day
Every 6 hours0 */6 * * *4 times per day
Weekdays at 9am0 9 * * 1-5Monday-Friday
Monthly0 0 1 * *First of month
{
  "trigger": {
    "type": "schedule",
    "schedule": "0 6 * * *",
    "timezone": "America/New_York"
  }
}

Webhook Triggers

Trigger from external HTTP requests:

{
  "trigger": {
    "type": "webhook",
    "path": "/hooks/shopify-orders",
    "secret": "whsec_..."
  }
}

This creates an endpoint at:

https://vai-dev.virtuousai.com/webhooks/{org_id}/hooks/shopify-orders

Webhook URLs are unique per automation. The secret is used to verify requests are authentic.

Event Triggers

React to events within VirtuousAI:

{
  "trigger": {
    "type": "event",
    "eventType": "action.completed",
    "filters": {
      "actionKind": "dlt_extract"
    }
  }
}

Event types include:

  • action.completed, action.failed
  • connection.data_available, connection.error
  • automation.completed, automation.failed

Automation Lifecycle

StatusDescriptionTriggers Fire?
activeAutomation enabled and readyYes
pausedTemporarily disabledNo
errorConfiguration issue detectedNo

Conditions

Add conditions to filter when automations actually execute:

Condition Operators

OperatorDescriptionExample
eq, neEquals, not equalsstatus eq "new"
gt, gte, lt, lteNumeric comparisonsorderTotal gt 100
containsString containsemail contains "@company.com"
startsWith, endsWithString prefix/suffixsku startsWith "PROD-"
in, notInArray membershipregion in ["US", "CA", "MX"]
{
  "conditions": [
    {
      "field": "event.data.orderTotal",
      "operator": "gt",
      "value": 100
    }
  ]
}
{
  "conditions": [
    {
      "field": "event.data.status",
      "operator": "eq",
      "value": "new"
    },
    {
      "field": "event.data.region",
      "operator": "in",
      "value": ["US", "CA"]
    }
  ]
}

All conditions must pass (AND logic)

{
  "conditions": [
    {
      "field": "event.data.customer.tier",
      "operator": "eq",
      "value": "enterprise"
    }
  ]
}

Use dot notation for nested fields

Automation Runs

Each trigger creates an automation run that tracks execution:

FieldDescription
runIdUnique identifier for this run
automationIdParent automation
triggeredByWhat triggered it (schedule, webhook, event, manual)
startedAtWhen execution began
completedAtWhen execution finished
statusrunning, completed, failed, cancelled
actionRunsList of action executions with results

Multi-Action Workflows

Automations can execute multiple actions:

Sequential Execution

Actions execute in order. If any action fails, the workflow stops:

{
  "actions": [
    { "kind": "dlt_extract", "definition": {...} },
    { "kind": "transform", "definition": {...} },
    { "kind": "notify", "definition": {...} }
  ]
}

DAG Execution

For complex workflows, define dependencies between steps:

{
  "actions": [
    { "key": "extract", "kind": "dlt_extract", "definition": {...} },
    { "key": "transform", "kind": "duckdb", "dependsOn": ["extract"], "definition": {...} },
    { "key": "load", "kind": "export", "dependsOn": ["transform"], "definition": {...} },
    { "key": "notify", "kind": "webhook", "dependsOn": ["load"], "definition": {...} }
  ]
}

Failure Behavior

By default, if any action fails, the automation stops and marks the run as failed. Subsequent actions are skipped.

Creating Automations

{
  "name": "Daily Order Sync",
  "description": "Sync Shopify orders every day at 2am ET",
  "trigger": {
    "type": "schedule",
    "schedule": "0 2 * * *",
    "timezone": "America/New_York"
  },
  "actions": [
    { "kind": "dlt_extract", "definition": { "source": "shopify", "resources": ["orders"] } }
  ],
  "enabled": true
}
{
  "name": "Process New Data",
  "description": "Transform data when extraction completes",
  "trigger": {
    "type": "event",
    "eventType": "action.completed",
    "filters": { "kind": "dlt_extract" }
  },
  "conditions": [
    { "field": "event.data.recordCount", "operator": "gt", "value": 0 }
  ],
  "actions": [
    { "kind": "transform", "definition": {...} }
  ],
  "enabled": true
}
{
  "name": "External Trigger",
  "description": "Run sync when triggered by external system",
  "trigger": {
    "type": "webhook",
    "path": "/external/sync",
    "secret": "whsec_your_secret_here"
  },
  "actions": [
    { "kind": "dlt_extract", "definition": {...} }
  ],
  "enabled": true
}

Best Practices

  1. Start simple — Begin with single-action automations, add complexity gradually
  2. Use conditions wisely — Filter early to avoid unnecessary action executions
  3. Monitor runs — Check automation run history regularly, set up failure alerts
  4. Test with manual triggers — Use the trigger endpoint to test before enabling schedules
  5. Use descriptive names — Include frequency and purpose (e.g., "Daily 2am - Sync Orders")
  6. Consider time zones — Always specify timezone for scheduled automations

OpenAPI Reference

For detailed endpoint schemas, request/response formats, and authentication:

On this page