fable-agent/PHASES/phase-07-workflow-graph.md

998 B

Phase 7: Workflow Graph

Purpose: DAG-based dynamic workflow execution. TS Module: src/tier2-primitives/workflows/workflow-graph.ts

What It Does

Executes workflows defined as JSON DAGs (nodes = steps, edges = dependencies). Topological-sort execution with conditional branching and fallback steps.

Step Types

Type Description
action Execute a handler function
decision Branch based on state
subworkflow Run a nested workflow
parallel Run multiple steps concurrently
transform Transform data between steps

Usage

# Register a workflow
fable-agent workflow path/to/workflow.json

# Run with a workflow
fable-agent run "Goal" --workflow <workflow-id>

Key Rules

  • All edges and dependsOn must reference valid step IDs
  • Topological sort ensures correct execution order
  • Conditional branching: if context.key == value evaluates at runtime
  • Fallback steps execute when primary step fails