Guide · Governance
AI Agent Governance: Permissions, Approvals and Audit Trails
How to govern what an AI agent can do in your app: expose only the actions it needs, validate every call, enforce policies by role and plan, require human approval for risky actions, and keep a receipt of everything.
Last reviewed
In short: an AI agent should only be able to do what you have explicitly allowed, every action should be checked before it runs, risky actions should wait for a person, and everything should leave a record. Put those rules in code the model cannot override, not in its prompt.
Giving an AI agent the ability to act inside your software is useful precisely because it can change things: records, messages, money, files. That is also why it needs governance. This guide covers the five layers that matter, with working code for each using OpenVerb.
The five layers
| Layer | Question it answers | In OpenVerb |
|---|---|---|
| 1. Capabilities | What can the agent do at all? | The verbs you expose |
| 2. Validation | Is this request well-formed? | The executor or runtime checks it |
| 3. Policy | May this actor do this, now? | A policy function, by role, plan and context |
| 4. Human approval | Should a person confirm first? | Confirmation flags and policy checks |
| 5. Audit trail | What actually happened? | A receipt for every call |
1. Capabilities: least privilege by construction
The strongest control is the simplest: the agent can only call verbs you give it. It does not get your database, your shell or your internal APIs. It gets a short, named list of actions. If there is no invoice.pay verb, no prompt in the world can make the agent pay an invoice.
Start with read-only verbs, add write actions one at a time, and keep destructive ones out until you need them. Each verb also carries flags that later layers rely on:
{
"name": "task.delete",
"description": "Permanently delete a task.",
"params": { "id": { "type": "string", "description": "Task ID.", "required": true } },
"destructive": true,
"requires_confirmation": true
}2. Validation: reject bad requests before your code runs
Models make mistakes: missing fields, invented actions, wrong types. The executor checks every request against the library before any handler runs. These are real responses from the openverb package:
await executor.execute({ verb: 'task.create', params: {} });
// { verb: 'task.create', status: 'error', error_message: 'Missing required param: title' }
await executor.execute({ verb: 'invoice.pay', params: {} });
// { verb: 'invoice.pay', status: 'error', error_message: 'Unknown verb: invoice.pay' }Validate meaning inside your handlers too: that the record exists, that an amount is in range, that this user can see that customer. The executor checks shape; your handler checks sense.
3. Policy: who may do what, and when
@openverb/runtime calls a policy before every action. It receives the verb, the actor (a person, a service, or an AI, with roles) and the request context, and returns allow or deny with a reason the agent can pass on to the user:
import type { Actor, Context, PolicyDecision, VerbDefinition } from '@openverb/runtime'
const OUTBOUND = new Set(['draft.send', 'inbox.reply', 'campaign.schedule'])
export async function appPolicy(verb: VerbDefinition, actor: Actor, context: Context): Promise<PolicyDecision> {
// The AI may never delete data, whoever it is acting for.
if (actor.type === 'ai' && verb.id.endsWith('.delete')) {
return { decision: 'deny', reasons: ['ai_cannot_delete'], code: 'forbidden',
message: 'Deleting requires a person.' }
}
// Anything that reaches a customer needs the user's explicit go-ahead.
if (actor.type === 'ai' && OUTBOUND.has(verb.id) && context.confirmedByUser !== true) {
return { decision: 'deny', reasons: ['needs_confirmation'], code: 'confirmation_required',
message: 'Show the user what will be sent and ask them to confirm.' }
}
// Admin-only verbs.
if (verb.visibility === 'admin' && !actor.roles?.includes('admin')) {
return { decision: 'deny', reasons: ['admin_only'], code: 'forbidden', message: 'Admins only.' }
}
return { decision: 'allow', reasons: ['default'] }
}Because the policy runs on your server, in the path every action takes, it holds regardless of which model is connected or what the user typed. That is the difference between a rule and a suggestion.
Rules by plan
If your product has plans, @openverb/policy builds a policy from tiers: lists of verbs each plan may or may not use, checked against context.planId:
import { createPolicyEngine } from '@openverb/policy'
import { createRuntime } from '@openverb/runtime'
const policy = createPolicyEngine({
tiers: [
{ id: 'free', allow: { verbs: ['contact.list', 'contact.get', 'draft.create'] } },
{ id: 'pro', allow: { verbs: ['contact.list', 'contact.get', 'draft.create', 'draft.send', 'campaign.schedule'] } },
],
})
const runtime = createRuntime({ verbs, handlers, policy })
await runtime.execute({
verbId: 'campaign.schedule',
args: { id: 'cmp_7' },
actor: { type: 'ai', id: 'crm-assistant' },
context: { tenantId: 'acme', planId: 'free' }, // checked against the tiers
})4. Human approval for risky actions
Some actions should never happen on the model's say-so alone: sending an email, deleting data, spending money, publishing something. The pattern is the same everywhere:
- Mark the verb (
requires_confirmation) or deny it in policy unless confirmed. - When the agent requests it, don't run it. Return it to your interface.
- Show the user exactly what will happen, with a clear Confirm button.
- Run it only after they approve that specific action, then record that they did.
The CRM walkthrough shows this end to end: the assistant tries to send an email, the policy stops it, the user approves, and it goes through.
5. An audit trail of receipts
Every call through the runtime returns a receipt, including denied and failed ones. Store them and you can always answer: what did the agent do, for whom, when, and was it allowed?
const runtime = createRuntime({
verbs,
handlers,
policy: appPolicy,
onReceipt: async (receipt) => {
// executionId, verbId, verbVersion, timestamp, actorId, tenantId,
// status: 'ok' | 'denied' | 'error', durationMs
await auditLog.insert(receipt)
},
})The Universal Action Ledger is built to collect and search these records across apps.
Governance checklist
- The agent can only call verbs you have listed, and nothing else.
- Destructive and outbound verbs are flagged.
- Every action passes through one function on your server.
- A policy checks actor, role, plan and context before execution.
- Risky actions wait for explicit user approval of that specific action.
- Handlers validate meaning, not just shape.
- Every call produces a stored receipt, including denials.
- None of these rules depend on the model following its prompt.
For the idea behind all this, that governing AI actions is an old problem with a well-tested answer, read Governed by Design.
Frequently asked questions
What is AI agent governance?
The rules and controls that decide what an AI agent may do, for whom, and under what conditions, plus the record that shows what it actually did. In practice: limited capabilities, validated inputs, policies, human approval for risky actions, and an audit trail.
Isn't a good system prompt enough?
No. A prompt is an instruction the model may misread or be talked out of. Governance belongs in your code, in the path every action takes before it runs, where the model cannot override it.
How do I require human approval for some AI actions?
Mark those verbs with requires_confirmation (or check them in a policy), return them to your interface instead of running them, and only execute once the user has explicitly approved that specific action.
How do I keep an audit trail of what an AI agent did?
Run actions through @openverb/runtime and store the receipt it returns for every call, including denied ones. Each receipt records the verb, the actor, the tenant, the time, the outcome and the duration.