Skip to main content

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 Python 3.12 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.
  • 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.
  • 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.

Quick start

You need Python 3.12 and uv. To install 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
Add my own authorization rules Customize authorization
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. Coming from m8flow-bpmn-core 0.x? Follow Upgrade to 1.0. Messaging and correlation, call activities, multi-instance activities, and tenant and user management aren't covered yet. Limitations lists every known gap.

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.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 m8flow-core 1.0.0
File Size Uploaded Provenance Actions
m8flow_core-1.0.0.tar.gz 349.9 kB With provenance Details for m8flow_core-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 437.4 kB

Release files / m8flow_core-1.0.0.tar.gz

Download URL m8flow_core-1.0.0.tar.gz
Size 349.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ffed2a00f6f826109f6e86ad5ddbbb079654da185f1ba2c8b7b845597c98825e
BLAKE2b-256 checksum
How to use checksums
c255f296173486feddad719e61886e7ab923c3c0ed3b2260191ea1627f01b225
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.0-py3-none-any.whl

Download URL m8flow_core-1.0.0-py3-none-any.whl
Size 87.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
099a7b58199e9e3c75ad00156c39e4da6fbb32946ad27a13f9d2212795e66755
BLAKE2b-256 checksum
How to use checksums
36b6adb2932a9d8b0849d902a36898c5bd08e2771b39f2be6bff266b25ec265b
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.0

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