πΊοΈ Library Overview
dagpipe is a small execution framework that propagates immutable State
objects through Node units connected in a directed acyclic graph (DAG). It is
designed for deterministic, observable, and resumable data-processing pipelines.
ποΈ Architecture
At runtime a pipeline is made of four cooperating layers:
Nodeβ a pure unit of work. Each node consumes oneStateand yields zero, one, or many derivedStateobjects.Graphβ the execution topology. It only stores connectivity; it never executes anything.Engineβ the orchestrator. It accepts either a linearSequence[Node]or aGraphand produces terminal states.State/Payload/Schemaβ the immutable data plane. Nodes read aState, fork new ones, and let theSchemaguarantee shape.
π Lifecycle of a run
| Step | Who | What happens |
|---|---|---|
| 1 | You | Define Node subclasses and a State subclass bound to a Schema. |
| 2 | You | Build a Graph (order + add_edge) or a linear Sequence[Node]. |
| 3 | You | Construct Engine(nodes_or_graph). |
| 4 | You | Create a root State (MyState(payload=Payload(...))) β validated here. |
| 5 | Engine | Executes roots first, then fans State out along edges (graph mode) or feeds each sequence element (linear mode). |
| 6 | Engine | Collects terminal states β states from nodes with no children (or the last step in linear mode). |
Nodes that yield no states prune the branch β see use case 02.
βοΈ Which execution model should you use?
| Model | Construct | Use when | Runs |
|---|---|---|---|
| Linear | Engine([a, b, c]) |
A fixed pipeline of steps, no branches | run |
| Graph | Engine(Graph) |
Branching, merging, multiple roots | run |
| Async | Engine + AsyncNode subclasses |
I/O-bound steps (HTTP, DB, files) | run_async |
| Steps | Engine.run_steps(...) |
Progress bars, resume-after-interrupt | run_steps |
A linear sequence is equivalent to a chain graph: each step receives every state its predecessor produced. Graph mode gives you explicit fan-out and fan-in.
π Read Next
- Core Components β the validated public API surface.
- Use case 01 β the minimal pipeline.
- Use case 02 β branching and merging.
- Best Practices β team-wide conventions.