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

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.7
File Size Uploaded Provenance Actions
zen_engine-2.1.7.tar.gz 707.0 kB Without provenance Details for zen_engine-2.1.7.tar.gz

Built distributions (wheels)

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

Total release size: 52.5 MB

Release files / zen_engine-2.1.7.tar.gz

Download URL zen_engine-2.1.7.tar.gz
Size 707.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bd6c41c0ffa9e327b209a677c8703de1e5787490dbe9dea1c8e034f35d30641c
BLAKE2b-256 checksum
How to use checksums
c7040932f1733cc5489f4b1a3a67c2606deb6dec5358e861026631fc2c8ce9fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

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

Download URL zen_engine-2.1.7-cp38-abi3-win_amd64.whl
Size 11.0 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5e60f2d79dddc1a02ce601e4c92b72ec1930a8a72f999b0a6e66400de0168faf
BLAKE2b-256 checksum
How to use checksums
326fc1717ca610ce17dc0271af8d9a125bd199b762b1d68cc7c3c6c707d7a5b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

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

Download URL zen_engine-2.1.7-cp38-abi3-manylinux_2_28_x86_64.whl
Size 10.7 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d95ac1e22d7ff7eb825ef380da1550bf36c571cf0a22a54f9c449c6e6e817b47
BLAKE2b-256 checksum
How to use checksums
f76ca24c46e1eaf89c6c19abc622bc798e86d8d01b6bf2ba4183e7d96f11db65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

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

Download URL zen_engine-2.1.7-cp38-abi3-manylinux_2_28_aarch64.whl
Size 9.9 MB
Tags CPython 3.8 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
fc7f9bdfbe72afbe80b1f507ecf195f856f50867c2d111240cf6094a0c761931
BLAKE2b-256 checksum
How to use checksums
2daa7fb626f7ded9ac6fe7603fdba191654ec702d69412db72d2fd4f1ea34f01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

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

Download URL zen_engine-2.1.7-cp38-abi3-macosx_11_0_arm64.whl
Size 9.6 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
559671ab9f5926ce81c07fb5e65daea82b3f74944612c5643be77196cb0cf04e
BLAKE2b-256 checksum
How to use checksums
ca149d87a351fe74689c783c0e11c75fc48fb61cc26cc2929c7e555934649114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

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

Download URL zen_engine-2.1.7-cp38-abi3-macosx_10_12_x86_64.whl
Size 10.5 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8ce6635e91f4daaf62558d99a2100e3cf92883776fb614254994650d9fcaea40
BLAKE2b-256 checksum
How to use checksums
9865a5b7db32fc214ee43bde78064afbb27cc1b7dabe6d96fa04d11eb8830720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Security for zen-engine 2.1.7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

2.1.7 This release

6 release files No provenance

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