Back to Skills

Workflow Compose

epieczko
Updated Today
47 views
0
View on GitHub
Metaaiautomation

About

Workflow Compose executes multi-step workflows by chaining Betty Framework skills from a declarative YAML definition. It enables developers to define complex processes once and run them reliably with built-in error handling and audit logging. Use this skill to automate multi-step sequences like creating, validating, and registering new skills.

Documentation

workflow.compose

Purpose

Allows declarative execution of Betty Framework workflows by reading a YAML definition and chaining skills like skill.create, skill.define, and registry.update.

Enables complex multi-step processes to be defined once and executed reliably with proper error handling and audit logging.

Usage

Basic Usage

python skills/workflow.compose/workflow_compose.py <path_to_workflow.yaml>

Arguments

ArgumentTypeRequiredDescription
workflow_pathstringYesPath to the workflow YAML file to execute

Workflow YAML Structure

# workflows/create_and_register.yaml
name: "Create and Register Skill"
description: "Complete lifecycle: create, validate, and register a new skill"

steps:
  - skill: skill.create
    args: ["workflow.validate", "Validates workflow definitions"]
    required: true

  - skill: skill.define
    args: ["skills/workflow.validate/skill.yaml"]
    required: true

  - skill: registry.update
    args: ["skills/workflow.validate/skill.yaml"]
    required: false  # Continue even if this fails

Workflow Fields

FieldRequiredDescriptionExample
nameNoWorkflow name"API Design Workflow"
descriptionNoWhat the workflow does"Complete API lifecycle"
stepsYesArray of steps to executeSee below

Step Fields

FieldRequiredDescriptionExample
skillYesSkill name to executeapi.validate
argsNoArguments to pass to skill["specs/api.yaml", "zalando"]
requiredNoStop workflow if step failstrue (default: false)

Behavior

  1. Load Workflow: Parses the workflow YAML file
  2. Sequential Execution: Runs each step in order
  3. Error Handling:
    • If required: true, workflow stops on failure
    • If required: false, workflow continues and logs error
  4. Audit Logging: Calls audit.log skill (if available) for each step
  5. History Tracking: Records execution history in /registry/workflow_history.json

Outputs

Success Response

{
  "ok": true,
  "status": "success",
  "errors": [],
  "path": "workflows/create_and_register.yaml",
  "details": {
    "workflow_name": "Create and Register Skill",
    "steps_executed": 3,
    "steps_succeeded": 3,
    "steps_failed": 0,
    "duration_ms": 1234,
    "history_file": "/registry/workflow_history.json"
  }
}

Partial Failure Response

{
  "ok": false,
  "status": "failed",
  "errors": [
    "Step 2 (skill.define) failed: Missing required fields: version"
  ],
  "path": "workflows/create_and_register.yaml",
  "details": {
    "workflow_name": "Create and Register Skill",
    "steps_executed": 2,
    "steps_succeeded": 1,
    "steps_failed": 1,
    "failed_step": "skill.define",
    "failed_step_index": 1
  }
}

Example Workflow Files

Example 1: Complete Skill Lifecycle

# workflows/create_and_register.yaml
name: "Create and Register Skill"
description: "Scaffold, validate, and register a new skill"

steps:
  - skill: skill.create
    args: ["workflow.validate", "Validates workflow definitions"]
    required: true

  - skill: skill.define
    args: ["skills/workflow.validate/skill.yaml"]
    required: true

  - skill: registry.update
    args: ["skills/workflow.validate/skill.yaml"]
    required: true

Execution:

$ python skills/workflow.compose/workflow_compose.py workflows/create_and_register.yaml
{
  "ok": true,
  "status": "success",
  "details": {
    "steps_executed": 3,
    "steps_succeeded": 3
  }
}

Example 2: API Design Workflow

# workflows/api_design.yaml
name: "API Design Workflow"
description: "Design, validate, and generate models for new API"

steps:
  - skill: api.define
    args: ["user-service", "openapi", "zalando", "specs", "1.0.0"]
    required: true

  - skill: api.validate
    args: ["specs/user-service.openapi.yaml", "zalando", "true"]
    required: true

  - skill: api.generate-models
    args: ["specs/user-service.openapi.yaml", "typescript", "src/models"]
    required: false  # Continue even if model generation fails

Example 3: Multi-Spec Validation

# workflows/validate_all_specs.yaml
name: "Validate All API Specs"
description: "Validate all OpenAPI specifications in specs directory"

steps:
  - skill: api.validate
    args: ["specs/users.openapi.yaml", "zalando"]
    required: false

  - skill: api.validate
    args: ["specs/orders.openapi.yaml", "zalando"]
    required: false

  - skill: api.validate
    args: ["specs/payments.openapi.yaml", "zalando"]
    required: false

Workflow History

Execution history is logged to /registry/workflow_history.json:

{
  "executions": [
    {
      "workflow_path": "workflows/create_and_register.yaml",
      "workflow_name": "Create and Register Skill",
      "timestamp": "2025-10-23T12:34:56Z",
      "status": "success",
      "steps_executed": 3,
      "steps_succeeded": 3,
      "duration_ms": 1234
    }
  ]
}

Audit Integration

If audit.log skill is available, each step execution is logged:

log_audit_entry(
    skill_name="api.validate",
    status="success",
    duration_ms=456,
    metadata={"workflow": "api_design.yaml", "step": 1}
)

Integration

With workflow.validate

Validate workflow syntax before execution:

# Validate first
python skills/workflow.validate/workflow_validate.py workflows/my-workflow.yaml

# Then execute
python skills/workflow.compose/workflow_compose.py workflows/my-workflow.yaml

With Hooks

Auto-validate workflows when saved:

python skills/hook.define/hook_define.py \
  --event on_file_save \
  --pattern "workflows/*.yaml" \
  --command "python skills/workflow.validate/workflow_validate.py {file_path}" \
  --blocking true

In CI/CD

# .github/workflows/test.yml
- name: Run workflow tests
  run: |
    python skills/workflow.compose/workflow_compose.py workflows/test_suite.yaml

Common Errors

ErrorCauseSolution
"Workflow file not found"Path incorrectCheck workflow file path
"Invalid YAML in workflow"Malformed YAMLFix YAML syntax errors
"Skill handler not found"Referenced skill doesn't existEnsure skill is registered or path is correct
"Step X failed"Skill execution failedCheck skill's error output, fix issues
"Skill execution timed out"Skill took >5 minutesOptimize skill or increase timeout in code

Best Practices

  1. Validate First: Run workflow.validate before executing workflows
  2. Use Required Judiciously: Only mark critical steps as required: true
  3. Small Workflows: Keep workflows focused on single logical task
  4. Error Handling: Plan for partial failures in non-required steps
  5. Test Workflows: Test workflows in development before using in production
  6. Version Control: Keep workflow files in git

Files Modified

  • History: /registry/workflow_history.json – Execution history
  • Logs: Step execution logged to Betty's logging system

Exit Codes

  • 0: Success (all required steps succeeded)
  • 1: Failure (at least one required step failed)

Timeout

Each skill has a 5-minute (300 second) timeout by default. If a skill exceeds this, the workflow fails.

See Also

Status

Active – Production-ready, core orchestration skill

Version History

  • 0.1.0 (Oct 2025) – Initial implementation with sequential execution, error handling, and audit logging

Quick Install

/plugin add https://github.com/epieczko/betty/tree/main/workflow.compose

Copy and paste this command in Claude Code to install this skill

GitHub 仓库

epieczko/betty
Path: skills/workflow.compose

Related Skills

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill

llamaguard

Other

LlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.

View skill

langchain

Meta

LangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.

View skill