While the brain mechanisms underlying selective attention have been studied in great detail in controlled laboratory settings, it is less clear how these processes function in the context of a real-world self-paced task. Here, we investigated engagement on a real-world computerized task equivalent to a standard academic test that consisted of solving high-school level problems in a self-paced manner. In this task, we used EEG-source derived estimates of effective coupling between brain sources to characterize the neural mechanisms underlying switches of sustained attention from the attentive on-task state to the distracted off-task state. Specifically, since the salience network has been implicated in sustained attention and attention switching, we conducted a hypothesis-driven analysis of effective coupling between the core nodes of the salience network, the anterior insula (AI) and the anterior cingulate cortex (ACC). As per our hypothesis, we found an increase in AI - > ACC effective coupling that occurs during the transitions of attention from on-task focused to off-task distracted state. This research may inform the development of future neural function-targeted brain-computer interfaces to enhance sustained attention.