Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

m8flow

An embeddable BPMN and DMN workflow engine for Python applications.
The workflow core of m8flow: import it, pass it a database session, and run processes inside your own application.

CI status Test coverage on main Latest m8flow-core release on PyPI Python 3.12, 3.13, and 3.14 Apache 2.0 license

m8flow-core

m8flow-core is the workflow core of m8flow. It runs Business Process Model and Notation (BPMN) 2.0 processes and Decision Model and Notation (DMN) decision tables inside your own Python process, on top of SpiffWorkflow and SQLAlchemy. You import it, pass it a database session, and call commands and queries. There's no server to deploy.

It's a library, in the same spirit as an embedded Camunda engine: your application owns the HTTP layer, the users, and the transaction. The library owns the workflow state.

m8flow-core capabilities: define BPMN and DMN processes, run instances and human tasks, automate timers and service tasks, and govern tenants.

Features

The library covers the following:

  • Process definitions. Import BPMN XML and optional DMN XML, validated before anything is stored.
  • BPMN collaborations. Deploy multiple executable pools from one file. Modeled messages start a participant or resume a correlated instance through the scheduler.
  • Process execution. Start instances from stored definitions and run them through exclusive and parallel gateways, script tasks, and DMN business rule tasks.
  • Human tasks. Build worklists of work items from BPMN lanes, then claim and complete them, safely under concurrency. Form values you submit are stored as process metadata.
  • Lifecycle control. Suspend, resume, error, retry, and terminate process instances, with an event history for each one.
  • Timers and scheduled retries. Timer start events, intermediate timers, interrupting boundary timers, and delayed retries, stored as database jobs that your application polls.
  • Service tasks. Run BPMN service tasks through pluggable connectors, including an adapter for the m8flow connector proxy.
  • Signals. Publish BPMN signals that reach waiting catch events, boundary events, event subprocesses, and signal start events in the same tenant, with durable, idempotent delivery.
  • Compensation. Undo completed work in reverse order through BPMN compensation handlers, with a journal that survives restarts and failed handlers you can retry.
  • Multi-tenancy and authorization. Every call is scoped to a tenant, and stored data, down to workflow payloads, belongs to one tenant. User actions are checked against tenant membership and command grants on exact resources, and you can plug in your own policy.
  • Caller-owned transactions. Pass a SQLAlchemy Connection and the library never commits or rolls back for you.

Install

m8flow-core needs Python 3.12 or later. To add it to your application, install it from PyPI:

pip install m8flow-core

With uv, run uv add m8flow-core instead. SQLite works out of the box. For another database, install its extra, such as m8flow-core[postgresql] or m8flow-core[mysql]. The celery extra adds what the Celery scheduler example needs.

Quick start

You need Python 3.12 and uv. To clone the project and run a complete purchase-order workflow on an in-memory SQLite database, run the following commands:

git clone https://github.com/AOT-Technologies/m8flow-core.git
cd m8flow-core
uv sync
uv run python examples/parallel_review.py

The script imports a BPMN definition, starts a process instance, and drives it through a parallel review to completion, printing the pending tasks after each step.

The core of an integration looks like the following:

from m8flow_core import api

with engine.begin() as connection:
    definition = api.execute_command(
        connection,
        api.ImportBpmnProcessDefinitionCommand(
            tenant_id="acme",
            bpmn_identifier="expense-approval",
            user_id=admin_id,
            source_bpmn_xml=bpmn_xml,
            properties_json={"lane_owners": {"Approvers": ["approver"]}},
        ),
    )
    instance = api.execute_command(
        connection,
        api.InitializeProcessInstanceFromDefinitionCommand(
            tenant_id="acme",
            bpmn_process_definition_id=definition.id,
            process_initiator_id=admin_id,
        ),
    )
    tasks = api.execute_query(
        connection,
        api.GetPendingTasksQuery(tenant_id="acme", user_id=approver_id),
    )

The quick start tutorial builds this into a complete script, from an empty database to a finished process. Running the finished script looks like this:

Terminal running the quick start script: the process starts, waits on Approve expense, and finishes as complete.

Documentation

The full documentation is in docs/. The pages follow the Diátaxis structure. Find your task in the following table:

I want to… Read
Run my first workflow Quick start
Add the library to my application Embed the library in your application · Build and install the package
Run timers and scheduled retries Run timers and scheduled retries
Call an external system from a process Call external services from service tasks
Send signals between processes Publish and deliver BPMN signals
Undo completed work Run compensation handlers
Add my own authorization rules Customize authorization
Find a quick answer Frequently asked questions
Fix an error or a stuck process Troubleshoot common problems
Upgrade from m8flow-bpmn-core 0.x Upgrade to 1.0
Look up a command, query, or error Public API reference · Database schema
Check which BPMN elements work BPMN support · Limitations
Understand how it fits together Architecture · Workflow data model
Try the runnable examples Run the examples · Sample app
Change the library itself Develop and test

Project status

m8flow-core 1.0 is the first stable release. The public surface is the m8flow_core.api module, documented in the API reference, together with the database schema. The changelog records every change to either. Releases follow Semantic Versioning: a breaking change to the public contract ships only in a new major version. Coming from m8flow-bpmn-core 0.x? Follow Upgrade to 1.0. Limitations describes the supported boundaries.

Get help and contribute

Use the following resources:

License

m8flow-core is released under the Apache License 2.0. See NOTICE for third-party attributions, including the LGPL-3.0 dependencies SpiffWorkflow and psycopg.

Metadata

Release files for m8flow-core 1.0.0b5

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

Source distribution (sdist)

Source distribution for m8flow-core 1.0.0b5
File Size Uploaded Provenance Actions
m8flow_core-1.0.0b5.tar.gz 499.6 kB With provenance Details for m8flow_core-1.0.0b5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for m8flow-core 1.0.0b5
File Interpreter ABI Platform Actions
m8flow_core-1.0.0b5-py3-none-any.whl Python 3 none any Details for m8flow_core-1.0.0b5-py3-none-any.whl

Total release size: 666.7 kB

Release files / m8flow_core-1.0.0b5.tar.gz

Download URL m8flow_core-1.0.0b5.tar.gz
Size 499.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6514846049221ebb1c3c1e578c31e1971e07553ee8c7099bb866db6c95a7322b
BLAKE2b-256 checksum
How to use checksums
4e0a1a3044b4d165111b8a047ea4e9217481cbabec819b0369ebfb37add11e78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Release files / m8flow_core-1.0.0b5-py3-none-any.whl

Download URL m8flow_core-1.0.0b5-py3-none-any.whl
Size 167.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4c447f445f6d201e8c2c080fe6c8baa0ccb69a477c9bae555011a994395daee
BLAKE2b-256 checksum
How to use checksums
9657c70f94db319856aed68efedf0fb5c8104c785c7ad85bbdcd484643352889
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for m8flow-core 1.0.0b5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for m8flow_core-1.0.0b5.tar.gz

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 Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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