Skip to main content

ironflow_engine/
lib.rs

1//! # ironflow-engine
2//!
3//! Workflow orchestration engine for **ironflow**.
4//!
5//! Workflows are defined as Rust-native handlers implementing
6//! [`WorkflowHandler`](handler::WorkflowHandler). Handlers receive a
7//! [`WorkflowContext`](context::WorkflowContext) and can chain step outputs,
8//! use native `if`/`else`/`match` for conditional branching, and execute
9//! steps in parallel.
10//!
11//! Handlers can be executed inline or enqueued for a background worker.
12//!
13//! ## Custom operations
14//!
15//! Implement [`Operation`](operation::Operation) to define custom step types
16//! (e.g. GitLab, Gmail, Slack) that integrate into the workflow lifecycle.
17//! Call [`WorkflowContext::operation()`](context::WorkflowContext::operation)
18//! inside a handler to execute them with full step tracking.
19//!
20//! # Example
21//!
22//! ```no_run
23//! use ironflow_engine::prelude::*;
24//! use std::future::Future;
25//! use std::pin::Pin;
26//!
27//! struct DeployWorkflow;
28//!
29//! impl WorkflowHandler for DeployWorkflow {
30//!     fn name(&self) -> &str { "deploy" }
31//!     fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
32//!         Box::pin(async move {
33//!             let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
34//!             ctx.agent("review", AgentStepConfig::new(
35//!                 &format!("Review: {}", build.output["stdout"])
36//!             )).await?;
37//!             Ok(())
38//!         })
39//!     }
40//! }
41//! ```
42
43pub mod config;
44pub mod context;
45pub mod engine;
46pub mod error;
47pub mod executor;
48pub mod fsm;
49pub mod handler;
50pub mod operation;
51
52/// Convenience re-exports.
53pub mod prelude {
54    pub use crate::config::{AgentStepConfig, HttpConfig, ShellConfig, StepConfig};
55    pub use crate::context::WorkflowContext;
56    pub use crate::engine::Engine;
57    pub use crate::error::EngineError;
58    pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
59    pub use crate::handler::{HandlerFuture, WorkflowHandler};
60    pub use crate::operation::Operation;
61}