pub struct InterruptibleNode<S: StateSchema, F> { /* private fields */ }Expand description
Resume-aware node (LangGraph-style interrupt).
The wrapped closure is called twice per runtime interrupt:
- first pass:
resumeisNone— the node either completes normally or suspends itself by returningErr(GraphError::InterruptRequest { payload }); - resume: after a human answers, the node is re-entered with
resume=Some(decision)so the closure can continue past the suspension.
Branch on that second argument instead of re-walking expensive side effects (an API call, a DB write) that already happened on the first pass — keep any such work memoized in the state between the two passes.
Implementations§
Source§impl<S: StateSchema, F> InterruptibleNode<S, F>
impl<S: StateSchema, F> InterruptibleNode<S, F>
Trait Implementations§
Source§impl<S: StateSchema, F> GraphNode<S> for InterruptibleNode<S, F>
impl<S: StateSchema, F> GraphNode<S> for InterruptibleNode<S, F>
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 S,
config: Option<NodeConfig>,
) -> Pin<Box<dyn Future<Output = Result<StateUpdate<S>, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 S,
config: Option<NodeConfig>,
) -> Pin<Box<dyn Future<Output = Result<StateUpdate<S>, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the node Read more
Auto Trait Implementations§
impl<S, F> Freeze for InterruptibleNode<S, F>
impl<S, F> RefUnwindSafe for InterruptibleNode<S, F>
impl<S, F> Send for InterruptibleNode<S, F>
impl<S, F> Sync for InterruptibleNode<S, F>
impl<S, F> Unpin for InterruptibleNode<S, F>
impl<S, F> UnsafeUnpin for InterruptibleNode<S, F>
impl<S, F> UnwindSafe for InterruptibleNode<S, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more