Skip to main content

Crate ironflow_engine

Crate ironflow_engine 

Source
Expand description

§ironflow-engine

Workflow orchestration engine for ironflow.

Workflows are defined as Rust-native handlers implementing WorkflowHandler. Handlers receive a WorkflowContext and can chain step outputs, use native if/else/match for conditional branching, and execute steps in parallel.

Handlers can be executed inline or enqueued for a background worker.

§Custom operations

Implement Operation to define custom step types (e.g. GitLab, Gmail, Slack) that integrate into the workflow lifecycle. Call WorkflowContext::operation() inside a handler to execute them with full step tracking.

§Example

use ironflow_engine::prelude::*;
use std::future::Future;
use std::pin::Pin;

struct DeployWorkflow;

impl WorkflowHandler for DeployWorkflow {
    fn name(&self) -> &str { "deploy" }
    fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
        Box::pin(async move {
            let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
            ctx.agent("review", AgentStepConfig::new(
                &format!("Review: {}", build.output["stdout"])
            )).await?;
            Ok(())
        })
    }
}

Modules§

config
Serializable step configurations — one per operation type.
context
WorkflowContext — execution context for dynamic workflows.
engine
The core Engine – orchestrates workflow execution and persistence.
error
Engine error types.
executor
Step executor — reconstructs operations from configs and runs them.
fsm
Finite State Machines for workflow run and step lifecycles.
handler
WorkflowHandler trait — dynamic workflows with context chaining.
operation
Operation trait — user-defined step operations.
prelude
Convenience re-exports.