Skip to main content

Tool Rules

A rule is a check Willow's gateway runs on every call of one tool, before the tool runs. It looks at what the agent is about to send and either blocks the call or asks you first.

Use rules when a tool is fine most of the time but not always. For example:

  • Block send_email when to ends with @rival.com.
  • Ask first when amount is more than 100.
  • Block create_issue when project isn't SUPPORT.

Add a rule​

  1. Open the agent and click the Connectors tab.
  2. Click Rules on a connector's card. The button appears once at least one tool is on.
  3. Fill in the rule:
    • When the agent uses: the tool.
    • and its argument: the field to check, like to or amount. Pick it from the list, or type it. Use dots to reach inside an object, like message.to.
    • matches: how to compare, and the value.
    • then: Block it or Ask first.
  4. Click Add rule.

The card shows each rule in plain words, like "Blocks when to ends with "@rival.com"".

How matching works​

ComparisonExample
contains, doesn't containsubject contains "invoice"
is, isn'tstatus is "draft"
starts with, ends with, doesn't end withto ends with "@acme.com"
is more than, is less thanamount is more than 100 (numbers only)
  • Matching ignores case.
  • If the argument is a list, like several recipients, the rule matches when any item does.
  • A connector can have up to 20 rules.

Rules and approvals​

Ask first works like a tool set to Ask Each Time, but only for the calls that match. Block it means the call never runs, even if you'd approve it.

Rules also count toward the safety score: a risky tool with a rule loses fewer points. See Safety score.

Built-in memory and Slack tools can take rules too. See Built-in tools.

On this page