Skip to content

Workflow Engine

Alessio Rocchi edited this page Jan 27, 2026 · 1 revision

Workflow Engine

Multi-phase workflow orchestration system.


Overview

The workflow engine executes multi-phase workflows with:

  • Phase-based execution
  • Iterative refinement
  • Result aggregation
  • Event notifications

Basic Workflow

import { WorkflowRunner } from '@blackms/aistack';

const runner = new WorkflowRunner();

const report = await runner.run({
  id: 'my-workflow',
  name: 'My Workflow',
  phases: ['phase1', 'phase2', 'phase3'],
  maxIterations: 3
});

console.log('Workflow complete:', report);

Phase Executors

// Register phase executor
runner.registerPhase('inventory', async (context) => {
  // Phase logic here
  return {
    phase: 'inventory',
    success: true,
    findings: [],
    artifacts: {},
    duration: 0
  };
});

Events

runner.on('workflow:start', (config) => {
  console.log('Workflow started:', config.id);
});

runner.on('phase:complete', (result) => {
  console.log('Phase complete:', result.phase);
});

runner.on('finding', (finding) => {
  console.log('Finding:', finding);
});

runner.on('workflow:complete', (report) => {
  console.log('Workflow complete:', report);
});

Built-in Workflows

Doc Sync Workflow

import { runDocSync } from '@blackms/aistack';

const report = await runDocSync('./docs', './src');

Related:

Clone this wiki locally