D1 · Agentic Architecture › Cluster 5 · Autonomy

5.2 · Permission Policies & Confirmation Gates

Gate the dangerous · confirm before execute · deny with reason

CONCEPT The gate sits between decision and effect

The model decides to call a tool by emitting a tool_use block. But the model doesn't execute anything — your harness runs the tool. That gap is where a permission gate lives: you intercept the tool_use before executing, check it against a policy, and either run it or refuse. Because the manual loop (3.6) hands you every tool_use before it acts, gating is a natural extension of the loop — not a new mechanism.

Policy verdictWhat the harness doesWhat the model sees next turn
AllowRun the tool immediatelyThe real tool_result
ConfirmAsk a human; run only on approvalResult if approved, else a denial tool_result
DenyNever run itAn explanatory tool_result so it can adapt
🔑 Gate side-effecting or irreversible tool calls behind confirmation. Reads, globs, and greps flow through; send_email, delete, external POSTs, and payments stop at the gate. Which is which is the reversibility axis of 5.4.

CONCEPT Deny with a reason, not with silence

When you refuse a call, don't just drop it. Return a tool_result that explains the denial. The agent is stateless — the only way it learns "that path is blocked" is by reading the result you feed back. A good denial message lets the model adapt: pick a different tool, ask the user, or finish gracefully. A silent failure makes it retry the same blocked call.

DIAGRAM The confirmation gate

flowchart TD A["Model emits tool_use"] --> P{"Policy check
side-effecting?"} P -->|"reversible (read/glob/grep)"| R["🟢 Run tool"] P -->|"irreversible / side-effecting"| C{"Human confirms?"} C -->|approve| R C -->|deny| D["🟠 Explanatory tool_result
'Denied: needs approval'"] R --> RES["tool_result → append → loop"] D --> RES RES --> L["Re-send transcript (stateless)"] classDef ok fill:#d4edda,stroke:#28a745,color:#155724; classDef gate fill:#fff3cd,stroke:#ffc107,color:#856404; classDef deny fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; class R ok; class C,P gate; class D deny;

CODE A gate around tool execution

Intercept each tool_use, consult the policy, and either execute, confirm, or deny with an explanation. Note the denial still becomes a tool_result so the loop continues cleanly.

# Which tools are side-effecting / irreversible → must be gated (see 5.4).
GATED = {"send_email", "delete_file", "charge_card", "http_post"}

def handle_tool(block):
    # Intercept BEFORE executing — this is the gate.
    if block.name in GATED:
        if not confirm(f"Approve {block.name}({block.input})?"):
            # DENY WITH REASON so the agent can adapt, not silently drop it.
            return f"DENIED: '{block.name}' needs human approval and was refused. " \
                   "Try a reversible alternative or ask the user."
    return run_tool(block.name, block.input)          # allowed → execute

# In the manual loop: build tool_result blocks from the gate's verdict.
tool_results = []
for block in resp.content:
    if block.type == "tool_use":
        tool_results.append({
            "type": "tool_result",
            "tool_use_id": block.id,
            "content": handle_tool(block),
        })
messages.append({"role": "user", "content": tool_results})   # re-send, loop continues
Deny-by-default hardening: gate on an allow-list of safe tools instead of a block-list of dangerous ones, so a newly added tool is gated until you explicitly clear it.

TRADE-OFFS Where to draw the gate line

✅ Gate more aggressively

  • Smaller blast radius; nothing dangerous runs unreviewed
  • Clear audit trail of approvals
  • Safer for irreversible / regulated actions

⚠️ Gate more aggressively

  • More human interrupts → slower throughput
  • Approval fatigue; humans rubber-stamp
  • Loses the point of automation if over-applied
Balance: gate only the irreversible / side-effecting tools; let reversible reads run free. Cross-reference 3.6 — the manual loop is what gives you the interception seam.

EXAM TRAPS

Trap: "The model enforces the permission." → No. The model only requests a tool; your harness enforces the gate before executing. Never rely on the prompt alone to stop a dangerous call.
Trap: On denial, dropping the call or raising an exception. → Return an explanatory tool_result so the stateless agent can adapt. A silent drop makes it retry.
Trap: Gating everything, including reads. → Over-gating kills throughput and breeds rubber-stamping. Gate only side-effecting / irreversible actions.
Trap: Assuming an auto-managed loop lets you intercept. → Interception happens in the manual loop — you must own the step where tool_use becomes execution.

PRACTICE

Q1 · Where exactly does a confirmation gate intercept the call?

Between the model's tool_use block and your harness executing that tool — in the manual loop, before run_tool runs. That's the only point where you can approve, deny, or modify the action before it takes effect.

Q2 · A gate denies send_email. What must you send back, and why?

An explanatory tool_result tied to the same tool_use_id, e.g. "Denied: email requires approval." Because the API is stateless, the model only learns the action was blocked by reading that result — enabling it to adapt instead of blindly retrying.

Q3 · Allow-list vs. block-list for the gate — which is safer, and why?

Allow-list (deny-by-default). With a block-list, any newly added tool you forget to list runs unguarded. With an allow-list, an unclassified tool is gated until you explicitly approve it — a forgotten tool fails safe.