Registry / workflow / zen-engine

zen-engine

JSON →
library0.53.0pypypi✓ verified 82d ago

Zen Engine is an open-source business rules engine implemented in Rust with Python bindings, designed for high-performance decision-making. It allows users to define complex business logic using a DMN-like JSON/YAML schema for decisions and flows. As of version 0.54.0, it leverages a Rust core for efficiency and provides a Pythonic interface for integration. It is actively maintained with frequent updates.

pip install zen-engine
INSTALL
IMPORT
SIG · ZEN-ENGINE
Z
zen-engine
workflowpythonv0.53.0
Install
2.0s avg
Import
Disk
29MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.53.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.0s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ZenEngine
from zen import ZenEngine
from zen_engine import ZenEngine

This quickstart demonstrates how to initialize the `ZenEngine`, define a basic decision rule using its JSON schema, and evaluate it with input context. It also shows how to access the result from the `ZenResult` object.

from zen_engine import ZenEngine # Define a simple decision rule in DMN-like JSON format decision_rule = { "name": "Welcome Message Decision", "kind": "Decision", "version": 1, "inputs": { "name": "text" }, "output": "text", "expressions": [ { "kind": "Literal", "content": "'Hello, ' + name + '!'" } ] } # Initialize the Zen Engine engine = ZenEngine() # Evaluate the decision with context data context = {"name": "World"} result = engine.evaluate(decision_rule, context) # Access the result using the ZenResult object if result.success: print(f"Decision Result: {result.result}") else: print(f"Decision Error: {result.error}") # Example with a different name context_2 = {"name": "Alice"} result_2 = engine.evaluate(decision_rule, context_2) print(f"Decision Result for Alice: {result_2.result}")
Debug
Known issues
breakingThe internal schema for Decision and Flow definitions underwent significant changes in version 0.50.0. Older rule definitions might no longer be valid and will fail validation.
fix
Review and update your JSON/YAML rule definitions to conform to the new schema introduced in v0.50.0. Refer to the official Zen Engine documentation for the latest schema structure.
affects: >=0.50.0
breakingThe return type of `engine.evaluate()` changed from a direct dictionary to a `ZenResult` object starting from version 0.50.0. Direct dictionary access (e.g., `result['result']`) will now raise an `AttributeError`.
fix
Update your code to access evaluation results via the `ZenResult` object's properties, such as `result.result` for the successful output, `result.success` to check for success, and `result.error` for error details.
affects: >=0.50.0
gotchaWhen initializing `ZenEngine` for advanced use cases (e.g., loading external resources), the `resources` argument was deprecated and replaced by `loader`.
fix
If you were passing a dictionary of resources to `ZenEngine()`, you now need to provide a `loader` object instead. The `loader` is an interface that the engine uses to fetch external DMNs/Flows/etc. Consult the documentation for implementing a custom loader.
affects: >=0.50.0
gotchaZen Engine expressions use a custom expression language similar to DMN FEEL. Familiarity with JavaScript-like syntax for string manipulation, comparisons, and conditional logic is helpful, but specific functions and operators may differ.
fix
Always refer to the official Zen Engine documentation for the precise syntax and available functions within its expression language. Do not assume full compatibility with JavaScript or other common expression languages.
affects: all
Upgrade
Version history
0.53.0latest on PyPI · released Mar 15, 2026
Audit
Dependencies
PyYAMLrequiredUsed for loading YAML rule definitions.
pydanticrequiredUsed for data validation and serialization of rule schemas.
requestsrequiredPotentially used for fetching external resources or definitions, though not directly in the core evaluation.
rustworkxrequiredCore dependency for graph operations within the Rust engine.
semverrequiredUsed for semantic versioning checks.
Agent activity
65 hits · last 30 days
node
60
OpenAI (training)
1
Resources