Add rules¶
A Rule is something Anychat checks, not something the agent is asked to remember. Guardrails steer, Rules are checked: a Guardrail is an instruction the agent reads and follows with judgment; a Rule is enforced against the agent's actual reply, every time, whether or not the agent remembered it. Rules are edited at Behavior · Rules.
What a Rule contains¶
| Field | What it does |
|---|---|
| Text | The sentence you'd say to describe the rule: "Never mention Brand X". Up to 300 characters. For a Judged Rule, this is also what the judge reads, so write it the way you'd explain the rule to a person. |
| Mode | How Anychat checks it: Checked against patterns, or Judged by a fast model reading the reply. |
| Patterns | Checked only. What the check looks for in the reply. Up to 20 patterns, each up to 200 characters. |
| Action | What happens when a pattern matches: Rewrite once, then fall back or Block. |
| Fallback text | What goes out instead, when rewriting or blocking still needs to send something. Up to 1,000 characters. |
| Enabled | Switches the Rule off without deleting it. |
Checked mode¶
A Checked Rule inspects the text the agent drafted before it sends, against the patterns you wrote. Two pattern shapes are supported:
- A plain phrase, matched case-insensitively as a substring:
guarantee resultscatches "we guarantee results" and "results are guaranteed to improve". - A regular expression, written between slashes with flags:
/\bguarantee[sd]?\b/ifor more precise control.
A pattern that isn't valid, whether a malformed regex or an empty string, is rejected when you save the Rule rather than silently ignored.
Judged mode¶
Some rules can't be reduced to a word list. "Never promise a delivery date" is tripped by "it'll be there Tuesday" and "you'll have it within the week" alike, and no pattern list catches both without also catching things you meant to allow. A Judged Rule hands the reply to a fast model instead: it reads the Rule's text and the reply together and decides whether the reply does what the Rule forbids or skips what the Rule requires.
Pick Checked when the violation is a word, a phrase, or a shape a pattern can name: a competitor's name, a phone number, a banned claim written a specific way. Pick Judged when the violation is about intent rather than wording, and no fixed list of phrases would catch it reliably. A Judged Rule has no patterns to write. The Text field is the whole rule; put the sentence you'd say to a person, because that's what the judge reads.
Judging adds about a second to a reply that trips no rule, and only runs when the agent has at least one enabled Judged Rule; an agent with none makes no judge call. The judge never sees your Behavior document, only the reply, the person's latest message, and the Judged Rules' text, and it reports a violation only when the reply clearly crosses the line: a close call is not a violation.
A Judged Rule fails open. If the judge errs, times out, or returns something Anychat can't parse, that turn is treated as no violation and the reply goes out as drafted, the same stance Checked Rules take toward a pattern that can't be evaluated. A Rule you can't trust to run never blocks a conversation.
The examples below come from Mia, the med spa agent in the worked example. Her Rule No delivery promises is Judged, with text "Never promise a specific delivery date or timeframe" and action Block with the fallback "I can't commit to a delivery window here, but our team will confirm one with you directly."
Rewrite once, then fall back, or block¶
Two actions decide what happens when a reply trips a Rule, and they work the same way whether a Checked pattern matched or a Judged model called a violation:
Rewrite once, then fall back asks the agent to rewrite the reply with the violation named, one time. If the rewrite still trips the Rule, Anychat sends the fallback text instead of the agent's words. Use this for rules where a second attempt usually clears the problem: the agent said too much, not something categorically wrong. When a reply trips both a Checked and a Judged rule, one rewrite round names both before either fallback triggers.
Block skips the rewrite and goes straight to the fallback text. Use this for rules where any tripped reply is disqualifying and a rewrite attempt isn't worth the extra model call.
Fallback text is optional. Leave it blank and a reply that still trips
the Rule after a rewrite, or a reply blocked outright, is dropped: the
person gets no message that turn rather than one Anychat can't vouch
for. A Rule with action: Block and no fallback text is flagged in
lint (rule.fallback.missing) precisely because that silence is easy
to miss when authoring.
Mia's Rule No diagnosis language blocks a short list of diagnostic patterns with the fallback "I can't speak to that, but a Glow provider can at your consultation."
Each time a Rule fires, it's named in the turn record by its id, so a rewritten or blocked reply is traceable after the fact.
Platform rules¶
Below your own Rules, a read-only Platform rules section lists what Anychat already enforces on every agent, whether or not you've written a single Rule of your own: the tool gates that require a clear ask before scheduling cancels or reschedules a booking, the send-time rules that hold every send to opt-out and the sends Anychat schedules to safe hours and carrier compliance, and the baseline guardrails every agent ships with.
Each platform rule carries a mode badge, and the badges aren't all the same. Tool gates and send-time rules show Checked: They're enforced in code, ahead of or after the agent, the same way your own Checked Rules are. The baseline guardrails show Instructed: they're text in every agent's Behavior document, not a check Anychat runs against the reply. That's the same distinction the platform overview draws between Guardrails and Rules, applied to the platform's own defaults — Anychat doesn't label something Checked when what actually happens is a well-briefed model choosing to comply.
Operator-facing vocabulary¶
A Rule belongs to the agent's Behavior, alongside Guardrails, Goals, and Playbooks. In conversation with an agent's Behavior document, say what a Rule does, not that it's a "tool" or a "policy" — those are wire and legacy names, not what you'll see in the console.
What's next¶
- Rules and safety: what the platform enforces whatever the agent judges.
- Set guardrails: the limits the agent follows by judgment.
- Rules in the Agent API