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.10.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.10.0
File Size Uploaded
stageflow_framework-0.10.0.tar.gz 61.9 kB Details

Built distribution (wheel)

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

Total release size: 114.2 kB

Release files / stageflow_framework-0.10.0.tar.gz

Download URL stageflow_framework-0.10.0.tar.gz
Size 61.9 kB
Tags Source
SHA-256 checksum
How to use checksums
02b20fc03712681bd913b660d4c57c37f5fe7ec7c499cb138983310243ce703f
BLAKE2b-256 checksum
How to use checksums
bd62a65e52a4f9657112e3fa153c6fe0108b6ab478b6c1dd35e0fff73b06ac07
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.10.0-py3-none-any.whl

Download URL stageflow_framework-0.10.0-py3-none-any.whl
Size 52.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af5beffd360a726277e1681bc8bfed322a9fab25b5e74ac7c6809ffabc8be03e
BLAKE2b-256 checksum
How to use checksums
9f80a16e7906cdbc41e2ad1d79d1e514efa30a80b5bbfaf028d8d47c5a40224d
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

0.11.0

2 release files

This release

0.10.0 This release

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