Human In The Loop
The key breakthrough is that interruption isn't a bug – it's a feature.
Interruption
<?php
namespace App\Neuron;
use NeuronAI\Workflow\Node;
use NeuronAI\Workflow\WorkflowState;
class InterruptionNode extends Node
{
public function __invoke(InputEvent $event, WorkflowState $state): OutputEvent
{
// Interrupt the workflow and wait for the feedback.
$feedback = $this->interrupt([
'question' => 'Should we continue?',
'current_value' => $state->get('accuracy')
]);
if ($feedback['approved']) {
$state->set('is_sufficient', true);
$state->set('user_response', $feedback['response']);
return new OutputEvent();
}
$state->set('is_sufficient', false);
return new InputEvent();
}
}Checkpointing
Consume The Feedback Directly
Conditional Interruption
Catch the Interruption
https://github.com/inspector-apm/neuron-ai/blob/main/examples/workflow/workflow-interrupt.php
Monitoring & Debugging
Last updated