Skip to main content

Deterministic policies

Policies are fast, local numeric comparisons over the proposed arguments of one tool.

amount:
policy: amount <= 200

A passed policy contributes allow. A failed policy contributes hold, allowing a Console-managed action to enter human review.

Supported grammar

ActionRail v1 accepts one complete comparison:

<argument> <operator> <finite number>

Supported operators:

OperatorMeaning
<less than
<=less than or equal
>greater than
>=greater than or equal
==numerically equal
!=numerically unequal

Valid examples:

policy: amount <= 200
policy: retry_count < 3
policy: confidence >= 0.95
policy: adjustment != -1
policy: quantity <= 1e3

The referenced name must be an argument reported for the same tool. It does not have to be the key under which the policy is stored, although placing a policy beside the value it constrains is easier to maintain.

Validation behavior

The Console shows an inline error and refuses to save an invalid expression. The SDK also rejects invalid local or remotely loaded configuration before wrapping tools.

Rejected examples include:

amount between 0 and 200
amount <= daily_limit
amount <= 200 and currency == "USD"
missing_argument > 0
amount <= NaN

There is no silent fallback for invalid policy syntax.

Runtime numeric conversion

At evaluation time, ActionRail converts the proposed argument to an exact decimal number. Numeric strings are accepted. Missing values, booleans, non-numeric values, NaN, and positive or negative infinity fail the policy and hold the action. Large integers do not pass through a binary floating-point conversion.

"125" → 125 → evaluated
"many" → not numeric → hold
null → not numeric → hold

Keep policy narrow

Use policy for stable numeric boundaries such as per-action amounts, quantities, confidence thresholds, or retry limits.

Use grounding when a decision depends on current external facts:

  • the customer’s remaining balance;
  • the current approval status;
  • a per-customer limit stored in billing;
  • whether a previous refund already exists;
  • the authenticated caller’s ownership of a record.

For example, amount <= 200 is policy. “Account balance is at least the proposed amount” is a grounding match against another argument.

v1 scope

Compound boolean expressions, strings, collections, and CEL are not part of the current policy grammar. Model complex decisions as multiple grounding conditions or enforce an upstream authorization policy separately.