Workflows

Workflow Automation

Build automated pipelines using a directed acyclic graph (DAG) of nodes. Workflows respond to triggers and execute chains of conditions, actions, transforms, and control flow.

Overview

VexAI's workflow engine lets you create complex automation without writing code. Workflows are graph-based: a collection of nodes connected by edges, forming a directed acyclic graph (DAG). Execution flows from trigger nodes through conditions, actions, and transforms until it reaches terminal nodes.

â„šī¸ What's a DAG?

A directed acyclic graph is a structure where nodes are connected by one-way edges and there are no loops. This ensures workflows always terminate and execution order is deterministic.

How Workflows Work

  • Graph-based: nodes connected by edges form the execution pipeline
  • Template rendering: use {{variable}} syntax (Handlebars-like) to inject runtime values
  • Typed nodes: each node has a type, configuration object, and connections to other nodes
  • Traversal: execution starts at a trigger node and traverses the graph to terminal nodes
{
  "nodes": [
    { "id": "trigger", "type": "discord_event", "config": { "event": "memberAdd" } },
    { "id": "greet",   "type": "send_message",  "config": {
      "channel": "{{trigger.guild.systemChannelId}}",
      "content": "Welcome {{trigger.user.username}}! 🎉"
    }}
  ],
  "edges": [
    { "from": "trigger", "to": "greet" }
  ]
}

Node Types (30+ across 5 categories)

đŸŽ¯ Trigger Nodes

What starts the workflow:

NodeDescription
discord_eventTriggered by Discord events (message, reaction, member join, etc.)
commandTriggered by a custom command
reaction_roleTriggered by reaction role events
webhookTriggered by inbound webhook
scheduleTriggered on a cron schedule
manualTriggered manually via tool call

🔀 Condition Nodes

Branching logic that controls execution flow:

NodeDescription
ifConditional branch (true/false)
switchMulti-way branch based on value
cooldownRate limit check
permissionPermission check
time_windowOnly proceed during a specified time range

⚡ Action Nodes

Nodes that do things:

NodeDescription
send_messageSend a message to a channel
ai_generateGenerate text via LLM
tool_callExecute any VexAI tool
assign_roleAdd or remove a role
create_threadCreate a thread
dm_userSend a DM
http_requestMake an HTTP request
sub_agentSpawn a sub-agent
delayWait for a duration
logLog to workflow history

🔄 Transform Nodes

Reshape and process data between steps:

NodeDescription
templateRender a template string
json_extractExtract fields from JSON
ai_extractUse LLM to extract structured data
mergeMerge multiple inputs
mapTransform each item in an array

đŸŽ›ī¸ Control Nodes

Manage execution flow:

NodeDescription
parallelExecute branches in parallel
joinWait for parallel branches to complete
loopRepeat a section
error_handlerCatch and handle errors

Template Rendering

Workflows use a {{variable}} syntax (Handlebars-like) for inserting runtime values into node configurations. You can access trigger data, previous node outputs, and execution context.

# Access trigger data
Hello {{trigger.user.username}}, welcome to {{trigger.guild.name}}!

# Access previous node output
The AI generated: {{nodes.ai_step.output}}

# Access context
Current time: {{context.timestamp}}
💡 Template scope

Every node's output is available to downstream nodes via {{nodes.<nodeId>.output}}. Trigger data is always available at {{trigger.*}}.

Execution Limits

Workflows operate under hard limits to prevent runaway execution:

LimitValueDescription
Timeout2 minutesMaximum wall-clock time per workflow run
Node cap100 nodesMaximum number of nodes executed in a single run
🚨 Hard limits

Workflows that exceed the 2-minute timeout or 100-node cap are terminated immediately. Design workflows to complete well within these bounds. Use the workflow_run_history tool to identify bottlenecks.

Run Logging

Every workflow execution produces a full history log with node-by-node detail:

  • Node status: success, failure, or skipped for each node
  • Results: output data from every executed node
  • Duration tracking: how long each node and the total run took
  • Queryable: use the workflow_run_history tool to inspect past runs
{
  "run_id": "wfr_a1b2c3",
  "workflow": "welcome-new-members",
  "status": "completed",
  "duration_ms": 1240,
  "nodes": [
    { "id": "trigger", "status": "success", "duration_ms": 2 },
    { "id": "greet",   "status": "success", "duration_ms": 856 },
    { "id": "role",    "status": "success", "duration_ms": 382 }
  ]
}
â„šī¸ Debugging workflows

When a workflow fails, the run log shows exactly which node failed and why. Check the node's output field for error details.

Managing Workflows

Enabling Workflows

Workflows are toggled at the server level. Enable them with either method:

# Via slash command
/workflows

# Via config tool
/config set workflows.enabled true

Tools

Full workflow lifecycle management through VexAI's tool system:

ToolDescription
create_workflowCreate a new workflow definition
list_workflowsList all workflows
get_workflowGet a specific workflow's details
update_workflowModify an existing workflow
delete_workflowDelete a workflow
toggle_workflowEnable or disable a workflow
trigger_workflowManually trigger a workflow
workflow_run_historyQuery execution history and logs
workflow_templatesBrowse pre-built workflow templates
💡 Templates

Use workflow_templates to browse ready-made workflows for common tasks like welcome messages, auto-moderation, and scheduled announcements. Templates can be customized after creation.