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

zen_engine-2.0.2.tar.gz (586.9 kB view details)

Uploaded Source

Built Distributions

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

zen_engine-2.0.2-cp38-abi3-win_amd64.whl (10.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

zen_engine-2.0.2-cp38-abi3-manylinux_2_28_x86_64.whl (10.3 MB view details)

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

zen_engine-2.0.2-cp38-abi3-manylinux_2_28_aarch64.whl (9.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

zen_engine-2.0.2-cp38-abi3-macosx_11_0_arm64.whl (9.2 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

zen_engine-2.0.2-cp38-abi3-macosx_10_12_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file zen_engine-2.0.2.tar.gz.

File metadata

  • Download URL: zen_engine-2.0.2.tar.gz
  • Upload date:
  • Size: 586.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for zen_engine-2.0.2.tar.gz
Algorithm Hash digest
SHA256 e300812dee2839f068a634b04c5ef1809dac5177b235b65a0e592db9fc3b350f
MD5 51edd57f5557b39b663359d8299d854f
BLAKE2b-256 bf43f3c6d0c92d09985c6e9ccbe7abb4c71f73aa654c0ab6880a06bd48777c5f

See more details on using hashes here.

File details

Details for the file zen_engine-2.0.2-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for zen_engine-2.0.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9c4ae8381d0c591cfac6831bacba7476c6dc5da6832b4afcf4b2a8e3a1359465
MD5 710dc7900d1a5bca34da3278dd767346
BLAKE2b-256 306d660066f5dca98b363747d527fca0cd858af66b80091f68d873ad6a238b88

See more details on using hashes here.

File details

Details for the file zen_engine-2.0.2-cp38-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zen_engine-2.0.2-cp38-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c1e23dacd874c40a2f9b4e46bc44439662860b7049eedad8ff2832cc5b2694f5
MD5 ff6b46ffb95477013f2909cce9e83be9
BLAKE2b-256 ad5c2e6ce26090f51c1095094356da91349f89e62193bfbfcf5edce760189147

See more details on using hashes here.

File details

Details for the file zen_engine-2.0.2-cp38-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for zen_engine-2.0.2-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fad99e7c117d27ae2c0d5bd936d9a9dcca13d3f49aa8184a28d0d7d7b95956f9
MD5 d79ace9f723a7a8dce7f6b242b8a74d8
BLAKE2b-256 6984d3c435adfbd41d6d49a0d27c1dd1be635946a5a6ebf4b17fa0dbb009d0dc

See more details on using hashes here.

File details

Details for the file zen_engine-2.0.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for zen_engine-2.0.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14f106def0b371816df82792698a7507ebd29a26a8531d2d35fc650a3c3fd60a
MD5 c672d6f0fb29896e3cd4d68c2f17f1af
BLAKE2b-256 7cbf907317488ec4f3dfc68570f5803ba05f6f6fb5845d0a4ec435bfbcfc9c6a

See more details on using hashes here.

File details

Details for the file zen_engine-2.0.2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for zen_engine-2.0.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 38541bfc059cec380ceb3ea6bbac2260fe20822c70885dac377234667414b7ff
MD5 d10c6ba3152e7fe633f5bd76ff3b4427
BLAKE2b-256 c592f9e7b11c9c360156a75945d1889ce197b8854da09450c3b4a957f836f7c6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.2 This release

6 files

2.0.1

6 files

2.0.0

6 files

0.53.0

37 files

0.52.0

37 files

0.51.0

37 files

0.50.3

38 files

0.50.2

38 files

0.50.1

38 files

0.50.0

32 files

0.49.1

32 files

0.49.0

32 files

0.48.0

32 files

0.47.1

32 files

0.47.0

33 files

0.46.0

33 files

0.45.0

33 files

0.44.1

33 files

0.44.0

33 files

0.43.1

33 files

0.43.0

33 files

0.42.0

33 files

0.41.0

33 files

0.40.1

33 files

0.40.0

32 files

0.39.0

32 files

0.38.4

32 files

0.37.1

31 files

0.37.0

32 files

0.36.0

32 files

0.35.2

32 files

0.35.1

32 files

0.35.0

32 files

0.34.1

32 files

0.34.0

32 files

0.33.1

32 files

0.33.0

32 files

0.32.1

34 files

0.32.0

34 files

0.31.0

34 files

0.30.0

34 files

0.29.3

34 files

0.29.2

34 files

0.29.1

34 files

0.29.0

34 files

0.28.0

34 files

0.27.0

34 files

0.26.0

34 files

0.25.0

34 files

0.24.3

34 files

0.24.2

34 files

0.24.1

34 files

0.24.0

34 files

0.23.0

34 files

0.22.0

34 files

0.21.0

34 files

0.20.0

32 files

0.19.0

32 files

0.18.1

32 files

0.18.0

32 files

0.17.0

32 files

0.16.0

32 files

0.15.1

31 files

0.15.0

29 files

0.14.0

29 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