Skip to main content

Python Rules Engine

Business logic humans can read and machines can run. One copy of your rules: the owner reads it, every system runs it.

License: MIT PyPI

GoRules ZEN Engine

ZEN Engine is a cross-platform, open-source Business Rules Engine (BRE) written in Rust with native Python bindings, alongside Node.js, Go, Java, Kotlin and .NET. Decisions evaluate in microseconds, run identically on every platform, and are stored as portable JSON. Loading the JSON is up to you: file system, database or service call.

Try it in the free Online Editor with a built-in simulator, or embed the open-source React JDM Editor in your own product. Learn more about the Python rules engine on the GoRules website.

Rules that read like sentences

Conditions are written the way the business says them, in the ZEN Expression Language. The developer view is one toggle away, and the two can never drift apart: there is only one source of truth, and this engine runs it.

Readable rules

Rules as graphs, or as documents

Model a decision on a visual canvas of decision tables, switches, expressions, functions and reusable sub-decisions. Or write it as a policy document with prose, typed data models and tables. Both compile to the same engine and return the same answers.

Graphs and documents

To go deeper, see the Python SDK documentation, the decision graph guide and the ZEN Expression Language reference.

What's new in 2.0

Version 2.0 is the first stable release of the new engine line:

  • Policy documents: model decisions as readable documents with typed data models, expressions, decision tables, match blocks and assertions. Policies compile to the same engine as graphs and return the same answers.
  • Workspace analysis: static type checking across policies and graphs. Type flow, exhaustiveness checking, write-conflict detection and precise diagnostics, all available before anything runs.
  • Per-column collect: decision table output columns can collect across all matching rows (tags[]) while the rest of the table stays first-match.
  • Pre-compiled engine: decisions are parsed and compiled once at load; evaluation is allocation-light and repeat-safe.
  • Hardened runtime: out-of-range numbers, arithmetic overflow and malformed inputs return errors or nulls instead of crashing the process.
  • Unified bindings: configurable loaders, batch evaluation and consistent error envelopes across Node.js, Python, Go and FFI consumers.

Installation

pip install zen-engine

Prebuilt wheels ship for Linux, macOS and Windows; no Rust toolchain required.

Quickstart

import zen

with open("./jdm_graph.json", "r") as f:
    content = f.read()

engine = zen.ZenEngine()

decision = engine.create_decision(content)
result = decision.evaluate({"input": 15})
print(result)

Loaders

For more advanced use cases where you want to load multiple decisions and reuse them across evaluations you can build loaders. When engine.evaluate is invoked it calls the loader with a key, expecting the content of the JDM decision graph in return.

import zen

def loader(key):
    with open("./jdm_directory/" + key, "r") as f:
        return f.read()

engine = zen.ZenEngine({"loader": loader})
result = engine.evaluate("jdm_graph1.json", {"input": 5})
print(result)

The same pattern works for loading from a REST API, S3, a database, or anywhere else. Full guides, including multi-decision graphs and batch evaluation, are in the Python SDK documentation.

Other platforms

The GoRules platform

The engine is open at the core; GoRules is the platform around it. Managed cloud, self-hosted, or embedded with no network hop. SOC 2 Type II.

AI that builds rules, and stays reviewable

An AI copilot and MCP server that edits rules, runs tests and explains decisions. It never deploys. Releases stay with your reviewers.

GoRules AI

Promote like a release, run like a binary

A release moves from testing to staging to production untouched. Approvals, instant rollback, and a paper trail for every change.

Governance

Prove it before it ships

Scenario suites run on every change, coverage is measured against decision paths, and every answer comes with a replayable trace.

Testing

Support matrix

Arch Python
linux-x64-gnu ✔️
linux-arm64-gnu ✔️
darwin-x64 ✔️
darwin-arm64 ✔️
win32-x64-msvc ✔️

We do not support linux-musl currently.

Contribution

The JDM standard is growing and we need to keep tight control over its development and roadmap, as a number of companies use GoRules ZEN Engine and GoRules BRMS. For this reason we can't accept code contributions at this moment, apart from help with documentation and additional tests.

License

MIT License

Metadata

Release files for zen-engine 2.1.1

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

Source distribution (sdist)

Source distribution for zen-engine 2.1.1
File Size Uploaded
zen_engine-2.1.1.tar.gz 629.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for zen-engine 2.1.1
File
zen_engine-2.1.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
zen_engine-2.1.1-cp38-abi3-manylinux_2_28_x86_64.whl CPython 3.8 abi3 Linux glibc 2.28+ x86-64 Details
zen_engine-2.1.1-cp38-abi3-manylinux_2_28_aarch64.whl CPython 3.8 abi3 Linux glibc 2.28+ ARM64 Details
zen_engine-2.1.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
zen_engine-2.1.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 49.8 MB

Release files / zen_engine-2.1.1.tar.gz

Download URL zen_engine-2.1.1.tar.gz
Size 629.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8d204b4fa8ca4b6d4f060a198ea0f01f91da8cbd2aeccdb418b1e41205c329e3
BLAKE2b-256 checksum
How to use checksums
ca1ef04f221fcb835f0b0c83ee4cb5ea4431c8216980948edf9d74ebf5a4a4c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / zen_engine-2.1.1-cp38-abi3-win_amd64.whl

Download URL zen_engine-2.1.1-cp38-abi3-win_amd64.whl
Size 10.5 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c25de42ff92e9f3cb37291643061a23b1c1f79a2cf771c6f8d8c79e63d989ad8
BLAKE2b-256 checksum
How to use checksums
c8663dcd8835f0d9d0d5c7a877de9bca44749095197a6f23e732c70b936aa996
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / zen_engine-2.1.1-cp38-abi3-manylinux_2_28_x86_64.whl

Download URL zen_engine-2.1.1-cp38-abi3-manylinux_2_28_x86_64.whl
Size 10.2 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
89a8bcb6be5c7da2dff43a8fc2de96edc028939fa5a2770172e30e5327712cad
BLAKE2b-256 checksum
How to use checksums
3b327996b74e3db9ea40f1ed63c4df8024557a6235d46a80fbd7517db251c802
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / zen_engine-2.1.1-cp38-abi3-manylinux_2_28_aarch64.whl

Download URL zen_engine-2.1.1-cp38-abi3-manylinux_2_28_aarch64.whl
Size 9.5 MB
Tags CPython 3.8 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
abc29b2bc3fda832f284d6232766097f8e82c5aac1221b8cafa90e46f466bd6a
BLAKE2b-256 checksum
How to use checksums
6f697a78fa4d939712f8d5c411b17df40c7a200a18e4828b8217ed8bfe84199d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / zen_engine-2.1.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL zen_engine-2.1.1-cp38-abi3-macosx_11_0_arm64.whl
Size 9.2 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f9e23cc3d4552940e4ad6b0beba312861e1ad060ef5b88184233c7c5b0883ad0
BLAKE2b-256 checksum
How to use checksums
8fa6be7b2a5b98ba674f2faf1e9cae69226cfdd8e43b317554de26758f202d15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / zen_engine-2.1.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL zen_engine-2.1.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 9.9 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f724623cec10f72cbe7ab4272d92e309f1913528e27f09bb69703fc488360d13
BLAKE2b-256 checksum
How to use checksums
ff056cda9e7f1543c930357d943a43aacb7d62480c43d80c92bf8300973b2fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

2.1.2

6 release files

This release

2.1.1 This release

6 release files

2.1.0

6 release files

2.0.2

6 release files

2.0.1

6 release files

2.0.0

6 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