Embedded workflow engine
Stabilize
AvailableOrchestration with no server to run.
Stabilize is a Python library that runs workflows inside your own application. There is no orchestrator service to deploy, secure or keep available. It implements the 43 control-flow patterns catalogued by van der Aalst and colleagues, from a plain sequence to a race between a reviewer and an escalation timer. It is built for work that hands off to AI agents. Because it records each step as an event, a workflow resumes where it stopped after a crash.
Who it is for. Teams that want dependable, repeatable workflows inside an existing application, without introducing another service to run.
- Status
- Available
- Part of
- Open source
- Licence
- Open source, Apache 2.0
- Product site
- stabilize.readthedocs.io/en/latest
- Tags
- EmbeddedWorkflow patternsCrash recoveryPython library
Technical specification
Written for a technical assessor. A row with no measured value is left out.
Splits and joins
- Joins
- Wait for every incoming branch (the default), for the branches an OR-split chose, for the first to finish, or for a set number of them. A multi-merge runs once for each branch that arrives, one run at a time.
- Conditions
- Each branch of an OR-split has a condition over the stage’s context and outputs. Conditions use comparisons, and, or, not, in, and nested lookups. Stabilize parses each condition and accepts only that fixed set of operators. A condition cannot run arbitrary code.
- Branch pruning
- A branch that no split chose is skipped along with every stage behind it. A join whose branches were all skipped is skipped too, and the workflow does not pass through it.
Races, gates and locks
- Deferred choice
- Stages in one group race. The group is decided when the first member starts, or when the first one finishes. A losing stage is skipped, and one that is already running is cancelled with its clean-up hook.
- Milestones
- A stage can be allowed only while another stage is in a given status. For example, a route change is accepted only until the ticket has been issued.
- Mutual exclusion
- Stages that share a lock name do not run at the same time. A blocked stage goes back on the queue until the holder finishes.
- Concurrency limit
- A pipeline can cap how many of its runs execute at once. Runs over the cap wait in a buffered state and start when a slot frees.
Signals and cancellation
- Pause and resume
- A task suspends until a named signal arrives. When it resumes, it reads the signal’s name and data.
- Transient or persistent
- A transient signal is dropped if the stage is not waiting for it. A persistent signal is held until the stage suspends, up to 1,000 per stage by default. A signal that arrives at a full buffer goes to the dead-letter queue. It can be inspected and replayed from there.
- Finished stages
- A signal sent to a stage that has finished is refused and logged. A command clears buffers left behind by earlier versions and can report what it would clear before it changes anything.
- Cancellation
- Cancel one stage, a whole workflow, or every stage tagged with a named region. A cancelled task runs its own clean-up hook.
Loops, retries and sub-workflows
- Jumps
- A task can send the workflow to any stage, forward or back. Each stage may jump 10 times by default, and the limit can be changed for a workflow. The workflow keeps a history of its jumps.
- Structured loops
- While and repeat-until loops have a maximum number of passes. A condition that names a value nothing provides fails the stage at once. A nested loop gets its full budget again on each pass of the outer loop.
- Retries that keep progress
- A task that hits a temporary error can say when to try again and save how far it got. The next attempt starts from that point.
- Sub-workflows
- A stage can start a child workflow and wait for it, up to 10 levels deep by default. The child is stored and started in one transaction. A message delivered again after a crash finds the child that already exists. An optional timeout bounds the whole child run, and cancelling the parent cancels the child.
Multiple instances
- How many
- A fixed number, a number read from the workflow’s data at run time, or one instance for each item in a list. The join can wait for all of them, for a set number of them, or not wait at all.
- Added at run time
- Instances can be added while the parent stage is running. The call returns once the instance is stored, or names the reason it was refused.
- Stages around a stage
- A stage type can add stages that run before it, after it, or when it fails. These carry setup, clean-up, validation and rollback.
What it does
-
Runs inside your application
You import it like any other library. There is no separate orchestrator to deploy or keep running.
-
The 43 workflow patterns
It implements the control-flow catalogue of van der Aalst and colleagues. An unusual sequencing need is usually one setting on a stage.
-
Joins that wait for the right branches
A join can wait for every branch, for only the branches a split chose, for the first to finish, or for three of five.
-
Unchosen branches stay off
When a split does not choose a branch, that branch and the stages behind it are skipped. A stage that a chosen branch also reaches still runs once.
-
Races between people and timers
Put a reviewer and a 30-minute escalation timer in one group. Whichever finishes first wins, and Stabilize cancels the other and runs its clean-up.
-
Signals that wait for the stage
A stage can pause until an approval or a file arrives. A persistent signal sent early is held until the stage is ready, up to 1,000 per stage by default.
-
Loops with a budget
While and repeat-until loops carry their values from one pass to the next. A loop that reaches its limit lets the workflow carry on and tells later stages it ran out.
-
Work that fans out at run time
Run one instance per reviewer, per item in a list, or per count read at run time. A planner can add instances while it is still running, and the join waits for those too.
Documentation and access details are on the product site, stabilize.readthedocs.io/en/latest. For a pilot, an integration or procurement questions, contact us.