AI Rule Engine Docs
Go to App

Rule Sets

A rule set is the runnable unit of the engine. It groups an ordered list of rules, defines the input context they operate on, and controls how matching rules are executed.

What a rule set is

Where a project is the container, a rule set is the thing you actually run. Each rule set belongs to one project and has a name (up to 30 characters) and an optional description. When invoked, the engine walks the rule set's rules, evaluates each rule's condition, and fires the actions of the rules that match. That single pass is the default; a rule set can instead run in Inference mode, where rules re-fire as the context changes. See Forward-Chaining Inference.

The context definition

A rule set declares a context definition: the named, typed inputs it expects. Each context item has a context key, a data type, an optional description, and a flag for whether it should be pre-populated as initial context (for example, shown on a manual-run form). This definition is the contract callers fill in when they run the set. See Variables & Context and Data Types & Values.

Ordering and matching

Several rule-set settings govern how the rules run. The match policy and its related controls live on the execution toolbar, which sits above the Rules view and applies to both the Table and List layouts.

SettingEffect
Match policyHow the run proceeds: First match, First N, All matching (single-pass, the default), Inferenceforward chaining, where rules re-fire as the context changes — or Goal-drivenbackward chaining, where the engine works backwards from the keys you want and fires only the rules needed to establish them. Chosen from the toolbar dropdown.
Rule orderRules are evaluated in the order they appear in the set.
Randomize rule orderWhen enabled, the rule order is shuffled before matching begins. Under Inference it becomes the tie-breaker between equal-salience rules.
Rule sequenceSequential (default) runs matching rules one after another; Parallel runs them concurrently. Parallel is unavailable under Inference, which fires rules one at a time.
Max rules to matchOptional, single-pass only. Stops evaluating once this many rules have matched — the basis of First match / First N behavior. Cleared under Inference.
Max activationsInference and Goal-driven only. Caps total rule firings before the run halts (default 500), a guard against write/read loops.
GoalsGoal-driven only. The context keys a run works backwards to establish, comma separated. Leave it blank to fall back to the rule set's decision keys, then its declared tool outputs. A Then forward chain toggle beside it continues into the normal cascade once the goals are resolved. See Goal-Driven Evaluation.
Decision keysDoes not affect the run, so it lives in a collapsed panel below the Rules view rather than on the toolbar — expand it to edit, or read the current keys off its header. Names the context keys holding this rule set's outcome, comma separated, so their values are charted on the environment's Analytics page.

First match wins Choose First match from the toolbar dropdown — its badge then reads Match First — to make a rule set behave like a priority list where only the highest-priority matching rule fires. First N stops after a count you set, and All matching (badge Match All) fires every matching rule.

How a rule set is invoked

A rule set can be run in three ways:

  • Directly — from the runner in your environment, supplying the input context. See Running Rule Sets.
  • On a schedule — triggered automatically at set times. See Scheduling.
  • From another rule — a rule's Run Rule Set action invokes another rule set, optionally copying the current context and passing named parameters. See Control & Flow Actions.

Creating and editing

Rule sets are built in the rule-set editor or the visual Workflow Builder. From the editor you add rules, attach conditions and actions, define the context, and adjust the ordering settings above. Rules that follow a “when these inputs, set these outputs” shape can also be edited as a grid in the decision table view. A rule set can also carry an optional input form that gives manual runs a friendly, guided way to enter the context.

A rule set can additionally be exposed to AI clients over the MCP server: its MCP tab defines the tool (inputs, outputs, and behavior hints) and any reusable prompts it publishes.

Two editor tabs check your work as you go. Verify reads the rule set without running it and reports rules that can never fire, duplicates, rules that overwrite each other, and input combinations nothing covers — see Verifying Rule Sets. Tests holds the rule set's test cases, which prove a given input still produces the outcome you expect.

Saving, versions, and publishing

The editor tracks unsaved changes — edits to the settings, the rules, or the input form — and every save records a new version. From the more-actions menu (the ⋮ button in the editor header) you can execute the rule set manually, open the version history to inspect and restore any earlier version, or copy the rule set id.

The header also shows the rule set's release status — hover it to see who submitted, reviewed, or published, and when. The actions offered next to it depend on the project's approval policy:

  • Direct publish — when approval is not required, Publish makes the current working copy the live, published version.
  • Approval flow — when the project requires approval, you Submit for review instead; an approver approves or rejects the release (optionally with a note), and an approved release can then be published.

With unsaved edits on screen, the buttons read Save & publish and Save & submit for review: the editor saves your changes first, so you never publish or submit an earlier, stale save by accident. A project can additionally require a green test run before a release — see Testing Rule Sets.

Saving as a template

Once a rule set is useful beyond its original project, you can capture it. From a Standard project's dashboard, Save as Template creates a new Template project from the current rule sets, leaving the original untouched. Templates can then be published and reused. See Marketplace Templates.