GoRules.ZenEngine 0.6.0

dotnet add package GoRules.ZenEngine --version 0.6.0
                    
NuGet\Install-Package GoRules.ZenEngine -Version 0.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GoRules.ZenEngine" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GoRules.ZenEngine" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="GoRules.ZenEngine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GoRules.ZenEngine --version 0.6.0
                    
#r "nuget: GoRules.ZenEngine, 0.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GoRules.ZenEngine@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GoRules.ZenEngine&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=GoRules.ZenEngine&version=0.6.0
                    
Install as a Cake Tool

GoRules.ZenEngine

Open-source Business Rules Engine for .NET. Execute JSON Decision Models (JDM) with native performance powered by Rust.

Installation

dotnet add package GoRules.ZenEngine

Quick Start

using GoRules.ZenEngine;

// Create an engine and evaluate
var engine = new ZenEngine(loader: null, customNode: null);
var decision = engine.CreateDecision(new JsonBuffer(File.ReadAllBytes("my-decision.json")));
var context = new JsonBuffer("""{"input": 42}""");
var response = await decision.Evaluate(context, null);
Console.WriteLine(response.result);

Features

  • Decision Tables - Rule tables with first/collect hit policies
  • Expression Language - Built-in ZEN expression language with functions like sum(), filter(), map()
  • Custom Nodes - Extend the engine with custom node handlers
  • Tracing - Full execution trace for debugging and auditing
  • Cross-platform - Native libraries for Windows (x64), macOS (x64/ARM), Linux (x64/ARM)

Tracing

Enable tracing to inspect the execution of each node:

var options = new ZenEvaluateOptions(maxDepth: null, trace: true);
var decided = await decision.Evaluate(context, options);

foreach (var (nodeId, trace) in decided.trace!)
{
    Console.WriteLine($"{trace.name}: {trace.output}");
}

Expression Evaluation

Evaluate expressions directly without a decision file:

// One-off evaluation
var result = ZenUniffiMethods.EvaluateExpression(
    "sum(items) * multiplier",
    new JsonBuffer("{\"items\": [10, 20, 30], \"multiplier\": 2}")
);

// Compiled expression (reusable, better performance)
var expr = ZenExpression.Compile("a + b * 2");
var output = expr.Evaluate(new JsonBuffer("{\"a\": 1, \"b\": 10}"));
Console.WriteLine($"output: {output}");
expr.Dispose();

Custom Nodes

Extend the engine with custom logic:


using var myEngine = new ZenEngine(loader: new FileLoader(), customNode: new MyCustomNode());
var myResponse = await myEngine.Evaluate("custom.json", context, options);
Console.WriteLine(myResponse.result); 

// Custom node handler
class MyCustomNode : ZenCustomNodeCallback
{
    public Task<ZenEngineHandlerResponse> Handle(ZenEngineHandlerRequest request) =>
        Task.FromResult(new ZenEngineHandlerResponse(
            output: new JsonBuffer("""{"result": "custom"}"""),
            traceData: null
        ));
}

// Implement a loader to resolve decision files
class FileLoader : ZenDecisionLoaderCallback
{
    public Task<JsonBuffer?> Load(string key) =>
        Task.FromResult<JsonBuffer?>(new JsonBuffer(File.ReadAllBytes(key)));
}

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 84 3/4/2026
0.5.0 113 2/25/2026