Skip to content

Workflow YAML Definition

A Stavily workflow is defined using a structured YAML file that describes the complete automation process, from triggers to actions and outputs. The schema supports hierarchical agent definitions, conditional execution, error handling, and monitoring.

graph TD
    A[Workflow Metadata] --> B[Agents]
    B --> C[Triggers]
    C --> D[Actions]
    D --> E[Outputs]
    E --> F[Monitoring]
  • Hierarchical Agent Assignment: Agents can be defined at workflow, type, or step level
  • Dependency Management: Steps can depend on others with conditional execution
  • Error Handling: Built-in retry logic and failure strategies
  • Plugin Architecture: Versioned plugins for triggers, actions, and outputs

Below is a comprehensive example of a workflow.yaml file demonstrating all current features.

name: "High CPU Remediation with Escalation"
description: "Multi-step remediation for high CPU usage"
version: "1.2.0"
# Workflow-wise agent definition
agents:
pools:
- pool_name: "production-servers"
agent_regex: "prod-.*"
auto_install_plugins: true
on_plugin_missing: "skip_agent"
- pool_name: "staging-servers"
agent_regex: "staging-.*"
single_agent: "specific-agent-01"
triggers:
# Type-wise agent definition for triggers
agents:
single_agent: "trigger-specific-agent-01"
steps:
- name: "cpu-threshold"
plugin: "prometheus-trigger-v1.0.0"
config:
metric: "cpu_usage_percent"
condition: "> 90"
duration: "2m"
actions:
# Type-wise agent definition for actions
agents:
pools:
- pool_name: "actions-pool"
agent_regex: "actions-.*"
steps:
- name: "analyze-processes"
plugin: "python-script-action-v2.1.0"
# Plugin-wise agent definition
agents:
pools:
- pool_name: "analysis-pool"
agent_regex: "analysis-.*"
depends_on: []
config:
script: "analyze_cpu_processes.py"
timeout: "30s"
error_handling:
on_failure: "continue"
max_retries: 3
retry_delay: "30s"
- name: "kill-high-cpu-processes"
plugin: "system-command-action-v1.0.0"
agents:
single_agent: "killer-agent-007"
depends_on: ["analyze-processes"]
condition: "analyze-processes.output.high_cpu_count > 3"
config:
command: "pkill -f high_cpu_process"
timeout: "10s"
- name: "restart-service"
plugin: "service-management-action-v1.5.0"
depends_on: ["kill-high-cpu-processes"]
condition: "kill-high-cpu-processes.status == 'failed'"
config:
service: "webapp"
action: "restart"
outputs:
# Type-wise agent definition for outputs
agents:
single_agent: "output-agent-01"
steps:
- name: "send-alert"
plugin: "formatted-email-output-v1.5.0"
depends_on: ["analyze-processes"]
config:
recipients: ["[email protected]"]
template: "cpu_remediation_report"
monitoring:
timeout: "10m"
heartbeat_interval: "30s"
progress_tracking: true

The workflow schema is organized into logical sections. Each section serves a specific purpose in the workflow lifecycle.

The root-level properties provide essential metadata and identification for your workflow.

Core Metadata Fields

  • name: Human-readable name displayed in the UI
  • description: Brief explanation of the workflow’s purpose
  • version: Semantic version number (e.g., “1.2.0”)
  • created_by: Author or team responsible for the workflow
  • tags: Array of strings for categorization and filtering
# Basic workflow identification
name: "High CPU Remediation with Escalation"
description: "Multi-step remediation for high CPU usage with monitoring and escalation"
version: "1.2.0"
created_by: "devops-team"
tags: ["remediation", "cpu", "monitoring", "production"]
# Extended metadata for organization and UI
metadata:
revision: 3
environment: "production"
category: "infrastructure"
ui:
color: "#4B9EFF"
icon: "cpu"