Skip to main content

ironflow_engine/
lib.rs

1//! # ironflow-engine
2//!
3//! Workflow orchestration engine for **ironflow**. Supports two workflow styles:
4//!
5//! - **Static** ([`WorkflowDef`](workflow::WorkflowDef)): serializable step sequences, no chaining.
6//! - **Dynamic** ([`WorkflowHandler`](handler::WorkflowHandler)): Rust-native handlers where
7//!   steps receive a [`WorkflowContext`](context::WorkflowContext) and can chain outputs.
8//!
9//! Both can run inline or be enqueued for a background worker.
10//!
11//! # Dynamic workflow example
12//!
13//! ```no_run
14//! use ironflow_engine::prelude::*;
15//! use std::future::Future;
16//! use std::pin::Pin;
17//!
18//! struct DeployWorkflow;
19//!
20//! impl WorkflowHandler for DeployWorkflow {
21//!     fn name(&self) -> &str { "deploy" }
22//!     fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
23//!         Box::pin(async move {
24//!             let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
25//!             ctx.agent("review", AgentStepConfig::new(
26//!                 &format!("Review: {}", build.output["stdout"])
27//!             )).await?;
28//!             Ok(())
29//!         })
30//!     }
31//! }
32//! ```
33
34pub mod config;
35pub mod context;
36pub mod engine;
37pub mod error;
38pub mod executor;
39pub mod fsm;
40pub mod handler;
41pub mod workflow;
42
43/// Convenience re-exports.
44pub mod prelude {
45    pub use crate::config::{AgentStepConfig, HttpConfig, ShellConfig, StepConfig};
46    pub use crate::context::WorkflowContext;
47    pub use crate::engine::Engine;
48    pub use crate::error::EngineError;
49    pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
50    pub use crate::handler::{HandlerFuture, WorkflowHandler};
51    pub use crate::workflow::{StepDef, Workflow, WorkflowDef};
52}