1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! # RustyFlow
//!
//! A lightweight, high-performance agent framework for Rust, providing elegant abstractions
//! for building complex AI workflows with type safety and async concurrency.
//!
//! RustyFlow is designed to model AI workflows as graphs with async execution, offering
//! sequential, parallel, and batch processing patterns for building robust agent systems.
//!
//! ## Quick Start
//!
//! ```rust
//! use async_trait::async_trait;
//! use rustyflow::{flow::Flow, node::Node, error::FlowError};
//! use serde_json::{json, Value};
//!
//! struct GreetingNode;
//!
//! #[async_trait]
//! impl Node for GreetingNode {
//! async fn call(&self, input: Value) -> Result<Value, FlowError> {
//! let name = input["name"].as_str().unwrap_or("World");
//! Ok(json!({ "message": format!("Hello, {}!", name) }))
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), FlowError> {
//! let flow = Flow::new(vec![Box::new(GreetingNode)]);
//! let result = flow.execute(json!({"name": "Rust"})).await?;
//! println!("{}", result); // {"message": "Hello, Rust!"}
//! Ok(())
//! }
//! ```
//!
//! ## Core Components
//!
//! - [`Node`]: Basic computation unit with async execution
//! - [`Flow`]: Sequential orchestration of nodes
//! - [`ParallelFlow`]: Concurrent execution of multiple nodes
//! - [`Tool`]: Type-safe, structured computation with validation
//! - [`Batch`]: Concurrent processing of arrays
//!
//! ## Features
//!
//! - **Type Safety**: Compile-time guarantees for data flow
//! - **Async/Concurrent**: Full async/await support with parallel processing
//! - **Zero-Cost Abstractions**: High-level APIs with low-level performance
//! - **Flexible Execution**: Sequential, parallel, and batch patterns
//! - **Memory Safe**: Leverages Rust's ownership system
// Re-export commonly used types for convenience
pub use Batch;
pub use FlowError;
pub use ;
pub use Node;
pub use ;