Mokanata Docs
Agents

Guardrails and rules

Set the rules every draft is checked against before anything goes out, and decide whether a failing draft is held, handed off, revised, flagged or blocked.

Guardrails are rules an agent's drafts must pass before anything is sent, such as "the quoted price is within the approved band". Each rule is a condition plus what happens when a draft fails it. Rules apply at every autonomy level, Autonomous included.

  • Who can use it: Everyone can read an agent's guardrails. Adding, editing, turning off and deleting rules need permission to edit agents (owners and admins by default). Without it, the switches are read-only, Add rule is disabled and rule menus are hidden. See Roles and permissions.
  • Before you start: Nothing.

Read the rules

On the agent's page, click the Guardrails tab. The panel title sums up what the rules that are on will do, such as "6 rules · 3 hold, 1 hands off, 1 warns, 1 hard limit". Open in builder opens the first flow with a Guardrails step.

The Guardrails panel of Closer Agent with five rules, each with its condition, outcome and scope, and the required Customer asks for a human rule at the bottom

Each rule shows its name, what it does in plain words, its condition (such as deal.price >= tier.floor * 0.85), what happens when a draft fails it, and where it applies (All channels, one channel such as WhatsApp only, or a knowledge source such as Pricing & packaging). A rule that's turned off shows Off.

OutcomeWhat happens when a draft fails
HoldsThe draft waits for your approval.
RevisesIt rewrites the draft and checks again, up to twice, then holds it.
Hands offA person takes over the conversation.
WarnsIt sends and flags the run.
Hard limitNothing sends and the run is logged, at any level.

The last row, Customer asks for a human, hands the conversation to the deal owner on every channel. It's Required by workspace policy, so it can't be turned off or changed.

Turn a rule on or off

Use the switch on a rule's row. A message confirms it, with Undo: when a rule is off, drafts that break it are no longer stopped.

Add a rule

Choose how to start

Click Add rule under the list, then:

  • Write a rule to start from a blank rule, or
  • a template under Start from a template: Value threshold, Approved language, Citation required, Human approval gate or WhatsApp 24h window. A template the agent already has shows Already added.

The Add rule menu with Write a rule and five templates, two of them Already added

Name it

In Name, say what the rule checks, such as "Price within approved band" (3 to 80 characters, unique for this agent).

Write when it passes

In Passes when, write the condition a good draft meets, for example deal.price >= tier.floor * 0.85. Under the field, Mokanata reads it back in plain words ("Passes when the quoted price is at least the tier price × 0.85.") or shows what to fix.

Click Fields you can use to see the fields a rule can read, such as deal.price (the quoted price), deal.discount, draft.confidence or channel.session_hours_left. Click one to insert it where the cursor is.

The Add a rule dialog with Name, Passes when, and the Fields you can use list open, showing deal.price, deal.value, deal.discount, tier.floor and draft fields

If the condition ends in a number, a Threshold field shows it on its own: change it there and the condition updates.

Decide what happens when a draft fails

Under When a draft fails:

  • Warn and send: the reply still sends, and the run is flagged for you to review.
  • Block it: the draft stops, and On failure decides what happens next:
On failureWhat happensShown as
Route to a person for approvalThe draft waits for the deal owner to approve or edit it.Holds
Route to a person to take overThe deal owner gets the conversation and replies themselves.Hands off
Block and logNothing sends, at any autonomy level. The run is logged with the reason.Hard limit
Auto-reviseIt rewrites the draft and checks again, up to twice, then holds it.Revises

Choose where it applies and save

In Applies to, choose All channels or one of the agent's channels. A rule that already applies to a knowledge source, such as Pricing & packaging, keeps that choice in the list. Leave On switched on to start checking right away. Click Add rule. The dialog for an existing rule looks the same, with Save rule in place of Add rule.

The Edit Price within approved band dialog with Passes when, Threshold 0.85, Block it, Route to a person for approval, Applies to Pricing & packaging and the On switch

Edit or delete a rule

  • To edit, click ⋯ on the rule, then Edit rule. Change anything and click Save rule.
  • To delete, click ⋯, then Delete rule, and confirm with Delete rule. Drafts stop being checked against it right away. Flows that copied the rule into their own Guardrails step keep their copy until you edit them.

The dialog Delete Tone matches brand voice? with Keep rule and Delete rule

Each change shows a message with Undo.

Write conditions

A condition compares fields with >=, <=, >, <, == or !=, and joins comparisons with and or or. Use parentheses to group them and not before a comparison.

ExamplePasses when
deal.price >= tier.floor * 0.85The quoted price is at least 85% of the tier price.
deal.discount <= 0.15The discount is 15% or less.
draft.uncited_claims == 0Every claim cites a source.
channel.session_hours_left > 0The WhatsApp 24-hour window is still open.
not reply.is_publicThe reply isn't public.

Write shares as decimals (15% is 0.15) and amounts as plain numbers (100000). Compare yes/no fields with true or false. If the condition can't be read, the error says what to fix:

The Passes when field with deal.price > 15% and the error Write a share as a decimal: 15% is 0.15.

Other common messages are "Use == to compare two values." and "Close the parenthesis you opened." When a field name is misspelled, the error says it isn't a field rules can read and suggests the closest one.

Rules inside flows

A flow's Guardrails step checks drafts against these rules. To see or change that step, click Open in builder. See Conditions and paths for conditions that route a flow rather than check a draft.

Next steps

On this page