godelgate Book a demo

Policy rules

Allow, deny or require approval per tool, scoped to groups and argument values.

On Godelgate Cloud, edit the policy on the dashboard's Policy tab; it applies to the next call. A self-hosted gate reads it from the policy section of godelgate.yaml:

yaml
policy:
  default: allow            # allow | deny | approve
  trifecta: block           # block | approve | off
  approvalTimeoutSeconds: 300
  rules:
    - tool: "github__delete_*"
      action: approve
      reason: "deleting things needs a human"
    - tool: "hr__*"
      action: deny
      groups: [contractors]
    - tool: "github__*"
      action: allow

#Rules

FieldRequiredDescription
toolyesGlob on the namespaced tool name (server__tool). * matches any characters, ? matches one.
actionyesallow, deny or approve
groupsnoApply only to users in at least one of these groups. Omit to apply to everyone. On Cloud, roles count as groups: owner, admin, member.
whennoConditions on the call's arguments. All must hold.
reasonnoShown to the agent and recorded in the audit log.

The first matching rule wins. A rule matches when its glob matches the tool name, the user is in one of its groups (if it has any), and all of its when conditions hold. Put specific rules before broad ones.

#Conditions on arguments

when checks the arguments of the call before it runs. Each condition names an argument (dots reach into objects, as in message.to), an operator and a value:

yaml
rules:
  # Email inside the company is fine; anything else needs a human.
  - tool: "gmail__send_*"
    action: approve
    when:
      - { arg: to, op: notEndsWith, value: "@acme.com" }
    reason: "email leaving the company"
  # Never touch the production database.
  - tool: "supabase__execute_sql"
    action: deny
    when:
      - { arg: project_id, op: equals, value: "prod-db" }
OperatorHolds when the argument…
equals, notEqualsis (or isn't) the value
contains, notContainscontains (or doesn't contain) the value
startsWith, endsWithstarts or ends with the value
notEndsWithdoesn't end with the value
matchesmatches the value as a regular expression

Comparisons ignore case. Numbers, booleans and objects are compared as their JSON text. A missing argument fails equals, contains, startsWith, endsWith and matches, and passes the not… operators, so a rule like the email one above also catches calls that leave to out.

#Decision order

For every call, Godelgate decides in this order:

  1. Deny rule: if the first matching rule is deny, the call is denied.
  2. Quarantine: if the tool is quarantined, the call is denied.
  3. Lethal trifecta: if the call would complete the trifecta, it is denied or sent for approval, depending on trifecta.
  4. Matching rule: otherwise the first matching rule's action applies.
  5. Default: if no rule matches, default applies.

Calls to tools that don't exist are always denied with the reason unknown tool.

#Hidden tools

When the first rule that could match a tool for a user is a deny rule without conditions, the tool is also removed from that user's tool list, so the model never sees it.

#Examples

Read-only by default, writes need a human:

yaml
policy:
  default: approve
  rules:
    - tool: "*__get_*"
      action: allow
    - tool: "*__list_*"
      action: allow
    - tool: "*__search_*"
      action: allow

Engineering gets GitHub, nobody else does:

yaml
policy:
  rules:
    - tool: "github__*"
      action: allow
      groups: [engineering]
    - tool: "github__*"
      action: deny

Agents run unattended, so their risky calls are blocked instead of queued:

yaml
policy:
  rules:
    - tool: "*__send_*"
      action: deny
      groups: [agents]
    - tool: "*__send_*"
      action: approve