A pipeline is a graph of nodes in JSON. The work happens in stages — Python classes you write. Between them travels one immutable frame of variables, and everything the graph does with that frame is visible in the JSON: branching, retries, error handling, concurrency, nested graphs.
Because the pipeline is data, it can be stored, diffed, generated, validated before it runs — and drawn:
That is the editor: a separate static page that draws and debugs a graph while this core executes it.
Install
pip install stageflow-framework
Python 3.11+.
A pipeline in 30 seconds
import asyncio
from stageflow import BaseStage, Pipeline, Session, register_stage
@register_stage("HelloStage")
class HelloStage(BaseStage):
"""
description: "Greets whoever the pipeline points at"
arguments:
name: string
outputs:
greeting: string
"""
async def run(self):
name = self.get_arguments().get("name", "world")
self.set_outputs({"greeting": f"Hello, {name}!"})
pipeline = Pipeline.from_dict({
"nodes": [
{"id": "start", "type": "entry",
"variables": {"user_name": "Alice"}, "next": "hello"},
{"id": "hello", "type": "stage", "stage": "HelloStage",
"arguments": {"vars": {"name": "user_name"}},
"outputs": {"greeting": "greeting"}, "next": "finish"},
{"id": "finish", "type": "terminal",
"result": {"status": "ok"}, "artifacts": ["greeting"]},
],
})
pipeline.validate()
result = asyncio.run(Session(id="demo", pipeline=pipeline).run())
print(result.result) # {'status': 'ok'}
print(result.artifacts) # {'greeting': 'Hello, Alice!'}
The docstring is the stage's specification. validate() checks the graph
against it, so a wrong argument name is an error before anything runs.
What the graph can do
| Nine node types | entry, stage, condition, switch, parallel, try, map, subpipeline, terminal |
| One immutable frame | variables travel along the path; a write produces a new frame, so branches never collide |
| CEL expressions | in conditions, in switch cases, and in any argument or output through the .$ suffix |
| Errors as roads | retry on a node, try/except over a region of the graph derived from its shape |
| Real concurrency | parallel branches with their own frames and explicit merge rules |
| Loops over data | map runs a region of the graph once per element, sequentially or at once |
| Nested graphs | a subpipeline starts with a fresh frame and returns artifacts |
| A policy per tenant | the stages and node types one session may use — a subset of the registry, not a subset of the process |
| Budgets that hold | counters and gauges for time, steps, tokens, fan-out and depth; a ceiling a try block cannot catch |
| Gradual typing | declare the variables that matter; checked at validation and on every write |
| Step debugging | stop between nodes, read and edit the frame, replay the event stream |
| Answers in a language | a locale per request, not per process, for the framework's own messages; stage specs carry every language at once and let the client choose |
Documentation
The tutorial builds one working pipeline step by step, with screenshots from the editor. The reference covers the rest:
Quick start · Node types · Data model · Expressions · Errors · Policy · Limits · Variable typing · Localization · Session control · Step debugging
One page per node type: entry · stage · condition · switch · parallel · try · map · subpipeline · terminal
Sources are in docs/ (*.md English, *.ru.md Russian) and publish
themselves on every push to main.
The rest of the project
| Repository | What it is |
|---|---|
| stageflow | this one: the core that runs the pipelines |
| stageflow-ui | the editor: a static page that draws and debugs a graph |
| stageflow-example | a working backend for the editor: a support bot in four pipelines |
Development
pip install -e ".[dev]"
python -m unittest discover -s tests
Pipelines can be tested declaratively:
from stageflow.testing import PipelineTestSpec, run_pipeline_test
Releases are tag-driven: the tag has to match project.version in
pyproject.toml, and the workflow publishes to PyPI.
License
MIT — see LICENSE.
Release files for stageflow-framework 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stageflow_framework-0.13.0.tar.gz | 119.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stageflow_framework-0.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 216.8 kB
Release files / stageflow_framework-0.13.0.tar.gz
| Download URL | stageflow_framework-0.13.0.tar.gz |
|---|---|
| Size | 119.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c3050540f90471d0631a190f953014265d6df0839ba42d7fe550882bb93f083
|
|
BLAKE2b-256 checksum How to use checksums |
cf11f1bcc188057c4a4d72ad30b85a9bad7cbd11849aae2e593947da70c11709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / stageflow_framework-0.13.0-py3-none-any.whl
| Download URL | stageflow_framework-0.13.0-py3-none-any.whl |
|---|---|
| Size | 97.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9c0d0308e80735b43f6e4e96874253c6601fd7428a75523f8e40906204f6564
|
|
BLAKE2b-256 checksum How to use checksums |
27e3f414b0c991d7b4870f582538390db6f43a5163d2fc433bf12e89e8cd5bd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency log