pub struct AgentGraph { /* private fields */ }Expand description
The agent graph — an orchestrator that owns control-flow and delegates node work to the Payload layer.
Implementations§
Source§impl AgentGraph
Execution-related methods on AgentGraph.
impl AgentGraph
Execution-related methods on AgentGraph.
Sourcepub async fn execute(
&self,
start_node: &str,
state: AgentState,
) -> Result<AgentState>
pub async fn execute( &self, start_node: &str, state: AgentState, ) -> Result<AgentState>
Execute the graph starting from a specific node.
Sourcepub async fn execute_with_summary(
&self,
start_node: &str,
state: AgentState,
config: GraphConfig,
) -> (Result<AgentState>, RunSummary)
pub async fn execute_with_summary( &self, start_node: &str, state: AgentState, config: GraphConfig, ) -> (Result<AgentState>, RunSummary)
Execute the graph and return a structured run summary alongside the result.
Sourcepub async fn execute_with_config(
&self,
start_node: &str,
state: AgentState,
config: GraphConfig,
) -> Result<AgentState>
pub async fn execute_with_config( &self, start_node: &str, state: AgentState, config: GraphConfig, ) -> Result<AgentState>
Execute the graph with a runtime config.
Sourcepub async fn execute_with_interrupt(
&self,
start_node: &str,
state: AgentState,
config: GraphConfig,
) -> ExecutionResult
pub async fn execute_with_interrupt( &self, start_node: &str, state: AgentState, config: GraphConfig, ) -> ExecutionResult
Execute the graph with interrupt support.
Sourcepub fn execute_cancellable(
self: Arc<Self>,
start_node: &str,
state: AgentState,
config: GraphConfig,
) -> (JoinHandle<Result<AgentState>>, Arc<AtomicBool>)
pub fn execute_cancellable( self: Arc<Self>, start_node: &str, state: AgentState, config: GraphConfig, ) -> (JoinHandle<Result<AgentState>>, Arc<AtomicBool>)
Execute with cancellation support using an Arc-wrapped graph.
Sourcepub fn stream(
self: Arc<Self>,
start_node: &str,
state: AgentState,
config: GraphConfig,
) -> (JoinHandle<Result<AgentState>>, Receiver<StreamEvent>)
pub fn stream( self: Arc<Self>, start_node: &str, state: AgentState, config: GraphConfig, ) -> (JoinHandle<Result<AgentState>>, Receiver<StreamEvent>)
Execute with streaming using Arc-wrapped graph. Returns a join handle for the result and a receiver for events.
Source§impl AgentGraph
impl AgentGraph
Sourcepub fn builder() -> AgentGraphBuilder
pub fn builder() -> AgentGraphBuilder
Create a new graph builder.
Sourcepub async fn resume(
&self,
state: AgentState,
config: GraphConfig,
checkpoint: InterruptCheckpoint,
) -> Result<AgentState>
pub async fn resume( &self, state: AgentState, config: GraphConfig, checkpoint: InterruptCheckpoint, ) -> Result<AgentState>
Resume execution from an interrupt checkpoint.
Validates that the graph topology hasn’t changed since the checkpoint
was taken. Returns CheckpointMismatch if the graph hash differs.
Use Self::resume_force to skip this check.
Sourcepub async fn resume_force(
&self,
state: AgentState,
config: GraphConfig,
checkpoint: InterruptCheckpoint,
) -> Result<AgentState>
pub async fn resume_force( &self, state: AgentState, config: GraphConfig, checkpoint: InterruptCheckpoint, ) -> Result<AgentState>
Resume execution from an interrupt checkpoint without validating graph topology.
Sourcepub async fn get_state(
&self,
config: &GraphConfig,
) -> Result<Option<AgentState>>
pub async fn get_state( &self, config: &GraphConfig, ) -> Result<Option<AgentState>>
Get current state from checkpointer.
Sourcepub async fn get_state_history(
&self,
config: &GraphConfig,
) -> Result<Vec<Checkpoint>>
pub async fn get_state_history( &self, config: &GraphConfig, ) -> Result<Vec<Checkpoint>>
Get checkpoint history for a thread.
Sourcepub async fn update_state(
&self,
config: &GraphConfig,
updates: HashMap<String, Value>,
) -> Result<()>
pub async fn update_state( &self, config: &GraphConfig, updates: HashMap<String, Value>, ) -> Result<()>
Update state in the checkpointer (time travel).
Sourcepub fn to_mermaid(&self) -> String
pub fn to_mermaid(&self) -> String
Generate a Mermaid diagram of the graph structure.
Sourcepub fn node_names(&self) -> Vec<&String>
pub fn node_names(&self) -> Vec<&String>
Get the node names.
Sourcepub fn compute_graph_hash(&self) -> String
pub fn compute_graph_hash(&self) -> String
Compute a stable hash of the graph’s topology (node names + edges).
Used to detect graph-definition drift when resuming from a checkpoint. Two graphs with the same nodes and edges produce the same hash.