Agent Wranglers

AIF-70Required

Ask a person before an agent does what cannot be undone

List every tool that spends money, deletes data, sends a message to other people or changes access. An agent may run one only after the user approves that exact action in your own interface.

How to do it

Mark each tool in its definition as needing approval or not, and let the tool runner enforce it, not the prompt. Show the user what will happen in plain words, with the amounts, the recipients and the records affected. Save the run as waiting, as let runs pause and resume says. Run the action only with the approved arguments. A changed argument needs a new approval. Prompt injection can make a model call any tool it has, so this check must sit outside the model. The approval must come from the user's click, never from text the model writes.

Examples

TypeScript example

export async function runTool(run: AgentRun, call: ToolCall) {
  const tool = tools.get(call.name);
  if (tool.needsApproval) {
    const approval = await approvals.find(run.id, call.name, hashArgs(call.args));
    if (!approval) return run.waitForApproval(call);
  }
  return tool.execute(call.args, run.user);
}

Python example

def run_tool(run: AgentRun, call: ToolCall):
    tool = tools[call.name]
    if tool.needs_approval:
        approval = approvals.find(run.id, call.name, hash_args(call.args))
        if approval is None:
            return run.wait_for_approval(call)
    return tool.execute(call.args, run.user)

How to check

A test lists every tool marked as needing approval. For each, a fake model calls it with no approval, and the tool does not run and the run ends waiting for approval. A test that approves one set of arguments and runs with another is refused.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-features/agents-in-products/agent-approval-irreversible">Agent Wranglers AI features playbook</a>. In code you write, add a comment next to it with the same link.