Not every action needs approval. Confirming everything breaks autonomy and trains users to click through anything. Build a curated list: production writes, payment authorization, external communication, schema changes, IAM mutations. Anything you can't undo with a revert. The gate lives in code. The agent never sees the raw action, only the wrapped tool that requires a human confirmation step. It can't route around what isn't there.
// A generic gate wrapper. Takes any tool, returns a gated version.
function gated<I, O>(
tool: (input: I) => Promise<O>,
label: string,
): (input: I) => Promise<O> {
return async (input) => {
// Blocks until a human approves or rejects in the UI.
await approvals.request({ label, preview: JSON.stringify(input) })
return tool(input)
}
}
const tools = {
readEmail: gmail.read, // autonomous
saveDraft: gmail.drafts.create, // autonomous
sendEmail: gated(gmail.send, 'send email'), // gated
deleteEmail: gated(gmail.delete, 'delete email'), // gated
addLabel: gated(gmail.addLabel, 'modify labels'), // gated
}
Reversible is autonomous. Irreversible is consensual.