Blog

Designing deny, ask, allow policies for AI agents

Approve everything and people click Allow without reading. Approve nothing and the first bad call reaches production. A good policy table sits between those, and it is mostly about ordering.

Enterprise AI4 min read
The short answer

Write a small table of rules, each with an effect (deny, ask or allow), a priority and a match on bot, connector, tool name pattern, arguments or rooms. Try rules by priority, break ties deny, then ask, then allow, and let the first match decide. Make ask force a person even for tools set to run on their own, deny when rules cannot be read, and test drafts against recent history before you save them. That is how Bello Bot's policy engine works (src/policy.rs).

Why approvals fail in practice

Approval fatigue is the real risk. If every call needs a click, people stop reading the card. If no call does, a single prompt injection can send an email or delete a record. The fix is not more approvals, it is the right ones: deny what must never happen, ask for what is sensitive, allow what is routine.

The shape of a rule

Each rule can match a bot, a connector, a tool name pattern, the tool's arguments, or calls made in rooms, and has a priority. Lower numbers are tried first, and the first match decides.

Argument matching uses a JSON path and a glob, so a rule can say "ask before writing to any path under /prod" without blocking reads.

// src/policy.rs
pub struct ToolCtx { bot_id, connector_id, tool_name, args, in_room }
// arg_match: {"path": "$.a.b", "glob": "x/*"}
// tool_glob: "delete_*"   room_only: true

Ordering: priority first, then deny, ask, allow

Rules are tried by priority, lower numbers first. At equal priority, deny beats ask, and ask beats allow; then older rules come first. The first match decides. With no match, the call is allowed, because connector grants already gate what a bot can reach at all.

An ask rule forces the approval card even for a tool that is set to run on its own. That is what makes ask useful: a tool can be on auto for convenience, and one rule can still pull a person in for the risky cases.

PriorityEffectMatchResult
10denytool delete_* on any botNever runs
50askany tool, in roomsA person approves calls from shared rooms
50allowtool search_* on the research botRuns on its own
100askconnector Stripe, any toolEvery Stripe call waits for a person

Fail closed, but stay up

If a rule reload fails, the org keeps its last good rules. With nothing cached, an evaluation error denies the call.

Both halves matter. Denying on error keeps a database hiccup from turning into "everything is allowed". Keeping the last good rules on a failed reload keeps that same hiccup from stopping every bot in the org.

What the person sees

A tool call that needs a person pauses the reply. Allow approves this call, Always allow saves a standing allow for that bot and tool, and Deny refuses. The reply picks up again either way. Questions from ask_user ride the same rail.

Always allow is the pressure valve. Once a person trusts a bot with a tool, they save a standing allow and stop seeing that card, while deny and ask rules above it still apply.

Test before you ship a rule

Bello Bot gives admins two ways to check a rule before it bites. A test call returns the decision the engine would make for a given bot, tool, arguments and room flag. A replay takes a draft rule and re-decides the org's last 200 logged tool calls with and without it, so you see exactly which past calls would have changed.

That turns policy changes from guesswork into a diff: "this rule would have asked on 14 calls and denied 2".

Rooms, handoffs and access requests

Rules are checked before every MCP tool call, every bot-to-bot handoff and every access request. That coverage closes the gaps teams usually miss. A bot cannot route around a deny rule by asking another bot to do the work, because the handoff itself is a checked call.

The room-only flag is the simplest high-value rule. Calls made in shared rooms come from conversations that several people, and sometimes guests, can steer. Asking before any tool call from a room keeps that convenience without letting a stray message act on its own, while the same bot can work freely in a private chat with its owner.

A starter table

  1. Deny destructive tool patterns you never want automated.
  2. Ask for any call made from a shared room.
  3. Ask for connectors that move money or send messages outside the company.
  4. Allow read-only search and lookup tools for the bots that need them.
  5. Replay each new rule against recent history before saving it.

Email is a special case

Mailman sends email only after a person approves a card, and the bot that asked gets an outcome (counts, ids, links), never the email text. Gmail is invite-only right now.

Try it: the policy simulator

Pick what each matching rule says about one tool call, at equal priority.

Ask: the bot waits for Allow, Always allow or Deny.

From the blog

Questions

What does deny > ask > allow mean?

At equal priority, a deny rule wins over ask, and ask wins over allow. Rules with a lower priority number are still tried first.

What happens if no rule matches?

The call is allowed, because connector grants already limit what a bot can reach.

Can an ask rule override a tool set to auto?

Yes. Ask forces the approval card even for a tool set to run on its own.

What if the policy cannot be loaded?

A failed reload keeps the last good rules; with nothing cached, an evaluation error denies the call.

Can I test a rule before saving it?

Yes. Admins can test a single decision or replay a draft rule against the org's last 200 tool calls.

Keep reading

Try Bello Bot with your team

Public beta. Bring your own model keys, invite your team, and approve what your bots do.