Skip to main content

StageFlow

Pipelines described in JSON, executed in Python — and debuggable node by node.

tests PyPI Python docs license

Documentation · Tutorial · Документация на русском

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:

A pipeline open in the StageFlow editor

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
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

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 · Variable typing · 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.

Metadata

Release files for stageflow-framework 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stageflow-framework 0.11.0
File Size Uploaded
stageflow_framework-0.11.0.tar.gz 63.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stageflow-framework 0.11.0
File Interpreter ABI Platform
stageflow_framework-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 117.0 kB

Release files / stageflow_framework-0.11.0.tar.gz

Download URL stageflow_framework-0.11.0.tar.gz
Size 63.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6b6ea079c9f94ea09233d2d6ea2d198ca8e2c79400efca0f5f7e0eb45506ff56
BLAKE2b-256 checksum
How to use checksums
547052f0d617ecf2de94fec14426ff09c6fe5987f0b79e5aa5957914b2008f29
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 28, 2026.

Transparency log

Release files / stageflow_framework-0.11.0-py3-none-any.whl

Download URL stageflow_framework-0.11.0-py3-none-any.whl
Size 53.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d033b5b32c8e0ef0f1c8f7bd163a74e3720ee53a3822466e8c34db7fba6cb96c
BLAKE2b-256 checksum
How to use checksums
f0cd837c0c19ce2c89ca1170046db6f7659032da5f8b8dcfef180e8d644bac01
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 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.0

2 release files

0.12.0

2 release files

This release

0.11.0 This release

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page