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 :heavy_check_mark:
linux-arm64-gnu :heavy_check_mark:
darwin-x64 :heavy_check_mark:
darwin-arm64 :heavy_check_mark:
win32-x64-msvc :heavy_check_mark:

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phenixrizen_zen_engine-2.1.0.tar.gz (618.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

phenixrizen_zen_engine-2.1.0-cp38-abi3-win_amd64.whl (10.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

phenixrizen_zen_engine-2.1.0-cp38-abi3-manylinux_2_28_x86_64.whl (10.4 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ x86-64

phenixrizen_zen_engine-2.1.0-cp38-abi3-manylinux_2_28_aarch64.whl (9.7 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

phenixrizen_zen_engine-2.1.0-cp38-abi3-macosx_11_0_arm64.whl (9.4 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

phenixrizen_zen_engine-2.1.0-cp38-abi3-macosx_10_12_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file phenixrizen_zen_engine-2.1.0.tar.gz.

File metadata

File hashes

Hashes for phenixrizen_zen_engine-2.1.0.tar.gz
Algorithm Hash digest
SHA256 0c976c819fd077c8b474280f3b8c444fa52bdecf039e2f0d345346e8b15e2f25
MD5 647350d3117aa37f3e9139c0d93a94c1
BLAKE2b-256 f0384eb606a3ad141e35a6f111a92fd0e7277d27bc5aa26653e03ca00e5bb610

See more details on using hashes here.

File details

Details for the file phenixrizen_zen_engine-2.1.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for phenixrizen_zen_engine-2.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9ef1fc9566100bf9ec560699909fe6fb799728a291c35caf3f503df464545cff
MD5 e640a6abdbf89d33789fb7e4df5b7dcf
BLAKE2b-256 58bdb17b120049d435b903b4c04e709da66ebf1bc2b4fdc86fac36253712ce60

See more details on using hashes here.

File details

Details for the file phenixrizen_zen_engine-2.1.0-cp38-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for phenixrizen_zen_engine-2.1.0-cp38-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7f1d53f7d8613f90c9f38063c2357776c7ed12783606b5270a4c7e08830e37cf
MD5 dab70b062975e1e5deadf5f9be69c6ae
BLAKE2b-256 5c94efe5331b9ed7288510601a0be847bda4b5773db4a7e38c46c58d9c36a258

See more details on using hashes here.

File details

Details for the file phenixrizen_zen_engine-2.1.0-cp38-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for phenixrizen_zen_engine-2.1.0-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d811fd9ab27b37fcbfa1f5f3b8d345b48f0ea5a12b20f14545fbcd2b95f71aaa
MD5 bef562216835d770aa8e66ce53567026
BLAKE2b-256 a2bcd3121004fbeffb92ac27168ea06fe133a2c85db94e2b160a2124f7bf7834

See more details on using hashes here.

File details

Details for the file phenixrizen_zen_engine-2.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for phenixrizen_zen_engine-2.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfaade903eb5d5074c2426a0a1c8697a4d9a167ec8fecde09e877e8224846bc2
MD5 237e1975ec5f763d318653c28305eb0f
BLAKE2b-256 e22d752e03db605d8599423fbf0205caf4052dbbc9c5ad7aca2a48f633eb0c9f

See more details on using hashes here.

File details

Details for the file phenixrizen_zen_engine-2.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for phenixrizen_zen_engine-2.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8836b4023dad3537d2a69723465217923231c61760c84f18c1f940cd70ef8d55
MD5 99f6dfe36df289a3ccd373b8a00451b2
BLAKE2b-256 f24fdd45cbc25d15537b3504ff9600f75010a229f1173f7318caab5795dd4cab

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.0 This release

6 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