simple_flow/
simple_flow.rs

1
2use rust_logic_graph::{Graph, Orchestrator, GraphIO};
3use tracing_subscriber;
4
5#[tokio::main]
6async fn main() -> anyhow::Result<()> {
7    // Initialize tracing
8    tracing_subscriber::fmt()
9        .with_max_level(tracing::Level::INFO)
10        .init();
11
12    println!("=== Rust Logic Graph - Simple Flow Example ===\n");
13
14    // Load graph definition from JSON
15    let def = GraphIO::load_from_file("examples/simple_flow.json")?;
16    println!("Loaded graph with {} nodes and {} edges\n",
17        def.nodes.len(),
18        def.edges.len()
19    );
20
21    // Create graph
22    let mut graph = Graph::new(def);
23
24    // Execute the graph
25    println!("Starting graph execution...\n");
26    Orchestrator::execute_graph(&mut graph).await?;
27
28    // Display final context
29    println!("\n=== Final Context ===");
30    for (key, value) in &graph.context.data {
31        println!("{}: {}", key, value);
32    }
33
34    println!("\n=== Execution Complete ===");
35    Ok(())
36}