Pipeline Engine
Workflows are frozen Pydantic models — diffable, versionable, gate-enforced, and checkpoint-resumable.
What it is
A deterministic executor that runs a DAG-validated WorkflowPlan of StageSpec nodes. Each stage has a name, an agent role, optional quality gates, optional bounce-back targets, and a max iteration count.
Where it lives
| File | Lines | Purpose |
|---|---|---|
engine/pipeline.py | 681 | The executor |
engine/gates.py | — | Quality gates (completion, test_pass, verification, review_approval) |
engine/executor.py | — | Stage runner |
engine/checkpoint.py | — | Mid-pipeline state persistence |
engine/advisor.py | — | Retry strategy |
models/plan.py | — | WorkflowPlan, StageSpec, WorkflowType |
Workflows are data
A workflow is a frozen Pydantic model, not a Python script. You can diff two workflows, version them in git, emit them over the wire as JSON.
Compare:
- CrewAI — workflows are Python graphs. Not serializable without custom code.
- LangGraph — workflows are Python graphs.
ChatPromptTemplateis position-based. - AutoGen — workflows are Python scripts. Not introspectable.
Bonfire workflows are data. WorkflowPlan is a Pydantic model with model_dump_json(). Two plans can be diffed in git. A plan can be frozen, stored, replayed.
DAG validation
Happens at plan-construction time. You cannot commit a plan with a cycle. If stage B depends on stage A, and stage A depends on stage B, the plan rejects at construction — not at runtime.
Gate-based bounce-back
When a stage fails its gate, the executor resumes at on_gate_failure (a named earlier stage), not from the top.
The standard_build() pipeline uses this:
- Prover failure → Warrior rework (up to 3 attempts)
- Wizard rejection → Warrior rework
Each bounce-back is a discrete pipeline event with a receipt trail.
Checkpoint and resume
Mid-pipeline crashes do not lose work. State persists to disk between stages via the checkpoint module. A crashed run at stage 4 resumes at stage 4, not stage 1.
What it does NOT do (yet)
- Distributed execution across machines
- Multi-tenant isolation (single-operator by design in v1)
- Hosted pipeline-as-a-service (Phase 2 design target)