pub fn run_event_loop(
ctx: &mut PhaseContext<'_>,
initial_state: Option<PipelineState>,
config: EventLoopConfig,
) -> Result<EventLoopResult>Expand description
Run the main event loop for the reducer-based pipeline.
This function orchestrates pipeline execution by repeatedly:
- Determining the next effect based on the current state
- Executing the effect through the effect handler (which performs side effects)
- Applying the resulting event to state through the reducer (pure function)
- Repeating until a terminal state is reached or max iterations exceeded
The entire event loop is wrapped in panic recovery to ensure the pipeline never crashes due to agent failures (including segmentation faults).
§Arguments
ctx- Phase context for effect handlersinitial_state- Optional initial state (if None, creates a new state)config- Event loop configuration
§Returns
Returns the event loop result containing the completion status and final state.