pub struct CompiledGraph { /* private fields */ }Expand description
A compiled graph ready for execution
Implementations§
Source§impl CompiledGraph
Convenience methods for CompiledGraph
impl CompiledGraph
Convenience methods for CompiledGraph
Sourcepub async fn invoke(
&self,
input: State,
config: ExecutionConfig,
) -> Result<State>
pub async fn invoke( &self, input: State, config: ExecutionConfig, ) -> Result<State>
Execute the graph synchronously
Sourcepub fn stream(
&self,
input: State,
config: ExecutionConfig,
mode: StreamMode,
) -> impl Stream<Item = Result<StreamEvent>> + '_
pub fn stream( &self, input: State, config: ExecutionConfig, mode: StreamMode, ) -> impl Stream<Item = Result<StreamEvent>> + '_
Execute with streaming
Sourcepub async fn get_state(&self, thread_id: &str) -> Result<Option<State>>
pub async fn get_state(&self, thread_id: &str) -> Result<Option<State>>
Get current state for a thread
Sourcepub async fn update_state(
&self,
thread_id: &str,
updates: impl IntoIterator<Item = (String, Value)>,
) -> Result<()>
pub async fn update_state( &self, thread_id: &str, updates: impl IntoIterator<Item = (String, Value)>, ) -> Result<()>
Update state for a thread (for human-in-the-loop)
Source§impl CompiledGraph
impl CompiledGraph
Sourcepub fn with_checkpointer<C: Checkpointer + 'static>(
self,
checkpointer: C,
) -> Self
pub fn with_checkpointer<C: Checkpointer + 'static>( self, checkpointer: C, ) -> Self
Configure checkpointing
Sourcepub fn with_checkpointer_arc(self, checkpointer: Arc<dyn Checkpointer>) -> Self
pub fn with_checkpointer_arc(self, checkpointer: Arc<dyn Checkpointer>) -> Self
Configure checkpointing with Arc
Sourcepub fn with_interrupt_before(self, nodes: &[&str]) -> Self
pub fn with_interrupt_before(self, nodes: &[&str]) -> Self
Configure interrupt before specific nodes
Sourcepub fn with_interrupt_after(self, nodes: &[&str]) -> Self
pub fn with_interrupt_after(self, nodes: &[&str]) -> Self
Configure interrupt after specific nodes
Sourcepub fn with_recursion_limit(self, limit: usize) -> Self
pub fn with_recursion_limit(self, limit: usize) -> Self
Set recursion limit for cycles
Sourcepub fn get_entry_nodes(&self) -> Vec<String>
pub fn get_entry_nodes(&self) -> Vec<String>
Get entry nodes
Sourcepub fn get_next_nodes(&self, executed: &[String], state: &State) -> Vec<String>
pub fn get_next_nodes(&self, executed: &[String], state: &State) -> Vec<String>
Get next nodes after executing the given nodes
Sourcepub fn leads_to_end(&self, executed: &[String], state: &State) -> bool
pub fn leads_to_end(&self, executed: &[String], state: &State) -> bool
Check if any of the executed nodes lead to END
Sourcepub fn schema(&self) -> &StateSchema
pub fn schema(&self) -> &StateSchema
Get the state schema
Sourcepub fn checkpointer(&self) -> Option<&Arc<dyn Checkpointer>>
pub fn checkpointer(&self) -> Option<&Arc<dyn Checkpointer>>
Get the checkpointer if configured