Skip to main content

Module graph

Module graph 

Source
Expand description

Graph building, compilation, and topology validation

This module provides the core graph construction API for Juncture. It includes:

  • StateGraph: Builder for constructing executable graphs
  • CompiledGraph: Optimized, validated graph for execution
  • [TopologyValidator]: Ensures graph structure is valid
  • TopologyError: Validation failure details

§Examples

use juncture_core::{StateGraph, State, Node, IntoNode};

struct MyState;
impl State for MyState { type Update = MyStateUpdate; }
struct MyStateUpdate;

// Build a simple graph
let mut graph = StateGraph::<MyState>::new();
graph.add_node_simple("process", |state: MyState| async move {
    Ok(MyStateUpdate)
});
graph.set_entry_point("process");
graph.set_finish_point("process");

// Compile and validate
let compiled = graph.compile()?;

Structs§

CircuitBreakerConfig
Circuit breaker configuration for node execution
CircuitBreakerState
Runtime state of a circuit breaker
CompileConfig
Configuration for graph compilation
CompiledGraph
Compiled and validated graph ready for execution
DrawableEdge
Drawable edge for visualization
DrawableGraph
Drawable graph representation for export
DrawableNode
Drawable node for visualization
ErrorHandlerNode
Node wrapper that adds error recovery handling
GraphOutput
Output from graph execution
GraphOutputMetadata
Metadata about graph execution
InterruptInfo
Information about a human-in-the-loop interrupt
NodeMetadata
Metadata stored for each node during graph construction
RetryPolicy
Retry policy for node execution
RetryingNode
Node wrapper that adds retry behavior
StateFilter
Filter for state history queries
StateGraph
Builder for constructing executable Juncture graphs
StateUpdate
State update for manual checkpoint modifications
StreamHandle
Result of a streaming graph execution.
SubgraphInfo
Information about a subgraph in a compiled graph
TimeoutNode
Node wrapper that adds timeout enforcement

Enums§

CircuitState
Circuit breaker states
TopologyError
Topology validation errors

Functions§

execute_with_retry
Execute an async operation with retry according to the given policy.
execute_with_timeout
Execute an async operation with a timeout.