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:
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
| Field | Required | Description |
|---|---|---|
tool | yes | Glob on the namespaced tool name (server__tool). * matches any characters, ? matches one. |
action | yes | allow, deny or approve |
groups | no | Apply only to users in at least one of these groups. Omit to apply to everyone. On Cloud, roles count as groups: owner, admin, member. |
when | no | Conditions on the call's arguments. All must hold. |
reason | no | Shown 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:
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" }| Operator | Holds when the argument… |
|---|---|
equals, notEquals | is (or isn't) the value |
contains, notContains | contains (or doesn't contain) the value |
startsWith, endsWith | starts or ends with the value |
notEndsWith | doesn't end with the value |
matches | matches 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:
- Deny rule: if the first matching rule is
deny, the call is denied. - Quarantine: if the tool is quarantined, the call is denied.
- Lethal trifecta: if the call would complete the trifecta, it is denied or sent for approval, depending on
trifecta. - Matching rule: otherwise the first matching rule's action applies.
- Default: if no rule matches,
defaultapplies.
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:
policy:
default: approve
rules:
- tool: "*__get_*"
action: allow
- tool: "*__list_*"
action: allow
- tool: "*__search_*"
action: allowEngineering gets GitHub, nobody else does:
policy:
rules:
- tool: "github__*"
action: allow
groups: [engineering]
- tool: "github__*"
action: denyAgents run unattended, so their risky calls are blocked instead of queued:
policy:
rules:
- tool: "*__send_*"
action: deny
groups: [agents]
- tool: "*__send_*"
action: approve