Skip to main content

Crate treadle

Crate treadle 

Source
Expand description

§Treadle

A persistent, resumable, human-in-the-loop workflow engine backed by a petgraph DAG.

Treadle fills the gap between single-shot DAG executors (like dagrs) and heavyweight distributed workflow engines (like Restate or Temporal). It is designed for local, single-process pipelines where:

  • Work items progress through a DAG of stages over time
  • Each item’s state is tracked persistently (survives restarts)
  • Stages can pause for human review and resume later
  • Fan-out stages (e.g., enriching from multiple sources) track each subtask independently with per-subtask retry
  • The full pipeline is inspectable at any moment

§Quick Example

use treadle::{Workflow, Stage, StageOutcome, StageContext};

// Define your stages by implementing the Stage trait
struct Scan;
struct Enrich;
struct Review;

// Build the workflow DAG
let workflow = Workflow::builder()
    .stage("scan", Scan)
    .stage("enrich", Enrich)
    .stage("review", Review)
    .dependency("enrich", "scan")
    .dependency("review", "enrich")
    .build()?;

// Advance a work item through the pipeline
workflow.advance(&my_item, &state_store).await?;

§Design Philosophy

The name comes from the treadle — the foot-operated lever that drives a loom, spinning wheel, or lathe. The machine has stages and mechanisms, but without the human pressing the treadle, nothing moves. This captures the core design: a pipeline engine where human judgment gates the flow.

Functions§

version
Treadle is under active development. See the README for the design and roadmap.