Skip to main content

interrupt

Function interrupt 

Source
pub fn interrupt<S: State>(value: Value) -> NodeOutput<S>
Expand description

Create an interrupt command that pauses graph execution.

The interrupt value is saved with the checkpoint and returned to the caller as GraphResult::Interrupted. To resume, pass Command::resume(value) as input to graph.invoke().

§Example

use synaptic_graph::{interrupt, NodeOutput, MessageState};

async fn approval_node(state: MessageState) -> Result<NodeOutput<MessageState>, SynapticError> {
    Ok(interrupt(serde_json::json!({"question": "Approve this action?"})))
}