Workflow engine

Executes workflows and manages their lifecycle.

const engine: WorkflowEngine = new StandardWorkflowEngine({
agentOrchestrator,
toolRegistry,
ragPipelines
});

const execution = await engine.execute(workflow, { customerData: {...} });

if (execution.status === 'completed') {
console.log('Workflow completed:', execution.variables);
}
interface WorkflowEngine {
    execute(
        workflow: Workflow,
        input: Record<string, unknown>,
    ): Promise<Result<WorkflowExecution, Error>>;
    resume(
        executionId: string,
        input?: Record<string, unknown>,
    ): Promise<Result<WorkflowExecution, Error>>;
    pause(executionId: string): Promise<Result<void, Error>>;
    cancel(executionId: string): Promise<Result<void, Error>>;
    getExecution(executionId: string): Promise<undefined | WorkflowExecution>;
    listActive(): Promise<WorkflowExecution[]>;
    listExecutions(workflowId: string): Promise<WorkflowExecution[]>;
}

Methods

  • Cancel a running workflow

    Parameters

    • executionId: string

      Execution to cancel

    Returns Promise<Result<void, Error>>

    Success or error