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//! ## Custom operations
12//!
13//! Implement [`Operation`](operation::Operation) to define custom step types
14//! (e.g. GitLab, Gmail, Slack) that integrate into the workflow lifecycle.
15//! Call [`WorkflowContext::operation()`](context::WorkflowContext::operation)
16//! inside a handler to execute them with full step tracking.
17//!
18//! # Dynamic workflow example
19//!
20//! ```no_run
21//! use ironflow_engine::prelude::*;
22//! use std::future::Future;
23//! use std::pin::Pin;
24//!
25//! struct DeployWorkflow;
26//!
27//! impl WorkflowHandler for DeployWorkflow {
28//!     fn name(&self) -> &str { "deploy" }
29//!     fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
30//!         Box::pin(async move {
31//!             let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
32//!             ctx.agent("review", AgentStepConfig::new(
33//!                 &format!("Review: {}", build.output["stdout"])
34//!             )).await?;
35//!             Ok(())
36//!         })
37//!     }
38//! }
39//! ```
40
41pub mod config;
42pub mod context;
43pub mod engine;
44pub mod error;
45pub mod executor;
46pub mod fsm;
47pub mod handler;
48pub mod operation;
49pub mod workflow;
50
51/// Convenience re-exports.
52pub mod prelude {
53    pub use crate::config::{AgentStepConfig, HttpConfig, ShellConfig, StepConfig};
54    pub use crate::context::WorkflowContext;
55    pub use crate::engine::Engine;
56    pub use crate::error::EngineError;
57    pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
58    pub use crate::handler::{HandlerFuture, WorkflowHandler};
59    pub use crate::operation::Operation;
60    pub use crate::workflow::{StepDef, Workflow, WorkflowDef};
61}