Human Approval, Thresholds and Secure Logging

An approval is only worth something if the person knows what they approve and the system does exactly that.

BeginnerIntermediateExpert · 13 min read · Last updated:

In short

Decide by risk which actions run automatically, which need a person and which are never allowed, and count totals as well as single amounts. Tie each approval to one exact action, expire it and use it once. Log decisions with sensitive values removed, and keep proof that the log was not altered somewhere the agent cannot write.

What you will learn: threshold design, what a trustworthy approval contains, how to limit reviewer fatigue, safe logging and tamper evidence.
Prerequisites: Tool Permissions, Approvals and Abuse Risks. For how pauses and resumption work, see Human-in-the-Loop and Approval Gates.

Versions used

The example runs in November 2026 with Python 3.13 and only the standard library. It keeps everything in memory, takes approver names on trust and is meant to show the rules, not to be deployed.

Beginner Which actions need a person?

Sort actions by consequence

TierTypical actionsControl
AutomaticRead permitted data, draft text, small reversible changesPermission check and log
NotifyRoutine changes that are easy to undoRun, tell a person, offer undo
ApproveSend outside, spend money, change access, deleteOne authorized person before it runs
Two approversLarge payments, production changes, bulk operationsTwo different authorized people
NeverOutside the agent's purpose or unacceptableNo tool exists, or policy always denies

Judge by what can go wrong and whether it can be undone, not by how confident the model sounds.

Proposed actionexact parameters
Policyallow, ask or deny
Approvalbound to those parameters
Execute onceand record the outcome

Ways of involving people

PatternHow it worksFitsWeakness
Approve beforeNothing happens until someone agreesIrreversible or costly stepsDelay and fatigue
Delay with cancelRuns after a waiting period unless stoppedLow-risk, reversible stepsSilence counts as consent, so never use it for serious actions
Review afterA person checks completed actionsReversible work at volumeHarm happens first
SamplingA share of actions is reviewedQuality measurementNot a barrier to any single action
Exception queueOnly unusual cases go to peopleMature processes with clear rulesDepends on detecting what is unusual

Combine them: a hard policy limit, approval above a threshold and sampled review below it. A person who is only informed afterward is not an approver, and your records should not call them one.

What the approver should see

ShowWhy
The action in plain words, with exact values"Refund 800.00 to order A-1", not "process request"
Who asked and which agent proposes itAccountability
Evidence from trusted recordsThe model's summary alone may be wrong or manipulated
Warnings, such as untrusted content readRaises appropriate caution
Effect and whether it can be undoneSets the stakes
Expiry, and approve, change or rejectA real choice with a deadline

Build this screen from structured fields. If model text appears, label it and display it as plain text so it cannot imitate system messages or load remote content.

Intermediate Thresholds and binding

Financial and operational thresholds

A limit on one transaction invites splitting. Combine several measures and count across tasks and agents.

MeasureExample ruleCatches
Single valueAbove 50 needs approvalOne large action
Running totalOver 100 per customer per day needs approvalSplitting into small amounts
CountMore than 20 changes per hour pauses the agentLoops and bulk misuse
ScopeMore than 10 records at once needs approvalMass edits and deletes
NoveltyFirst payment to an account needs approvalRedirected funds
ContextSession read untrusted content: ask more oftenInjection-driven actions

The numbers are examples. The business owner sets them from the loss they are willing to accept, and reviews them with real data. Update totals in one transaction with the action; otherwise parallel requests can all pass the same check.

Run the approval desk

Refunds above 50, or automatic refunds above 100 per customer per day, need one approver. Above 500 needs two. Save as approvals.py and run it.

"""Thresholds, approvals tied to one exact action, and a log that shows tampering."""
import hashlib
import json
import re

DAILY_AUTO = 100          # automatic refunds allowed per customer per day, in total


def digest(value):
    return hashlib.sha256(json.dumps(value, sort_keys=True).encode()).hexdigest()


class Desk:
    def __init__(self):
        self.auto_today, self.approvals, self.used, self.log = {}, {}, set(), []

    def needed(self, action):
        amount, total = action["amount"], self.auto_today.get(action["customer"], 0)
        if amount > 500:
            return 2
        if amount > 50 or total + amount > DAILY_AUTO:
            return 1
        return 0

    def approve(self, who, action, now):
        if who == action["requested_by"]:
            return "refused: requester cannot approve"
        self.approvals.setdefault(digest(action), {})[who] = now + 600
        return "recorded"

    def execute(self, action, now):
        key, need = digest(action), self.needed(action)
        valid = [w for w, until in self.approvals.get(key, {}).items() if now < until]
        if action["id"] in self.used:
            result = "refused: already done"
        elif len(valid) < need:
            result = f"waiting: {len(valid)} of {need} approvals"
        else:
            result = "done"
            self.used.add(action["id"])
            if need == 0:
                who = action["customer"]
                self.auto_today[who] = self.auto_today.get(who, 0) + action["amount"]
        self.write(action, result, valid)
        return result

    def write(self, action, result, approvers):
        note = re.sub(r"\b(?:\d[ -]?){13,19}\b", "[card]", action.get("note", ""))
        note = re.sub(r"[\w.+-]+@[\w-]+\.[\w.]+", "[email]", note)
        entry = {"id": action["id"], "amount": action["amount"], "result": result,
                 "approvers": sorted(approvers), "note": note,
                 "previous": self.log[-1]["hash"] if self.log else ""}
        self.log.append({**entry, "hash": digest(entry)})


def verify(log, expected_head=None):
    previous = ""
    for number, entry in enumerate(log, 1):
        body = {k: v for k, v in entry.items() if k != "hash"}
        if body["previous"] != previous or digest(body) != entry["hash"]:
            return f"BROKEN at entry {number}"
        previous = entry["hash"]
    if expected_head and previous != expected_head:
        return "BROKEN: newest entries missing or replaced"
    return "intact"


def refund(number, amount, note=""):
    return {"id": f"R{number}", "amount": amount, "customer": "c-7",
            "requested_by": "agent:support", "note": note}


if __name__ == "__main__":
    desk, now = Desk(), 1000
    print("three refunds of 40:",
          [desk.execute(refund(n, 40, "ana@example.com"), now) for n in (1, 2, 3)])
    big = refund(4, 800, "card 4111 1111 1111 1111")
    print("800:", desk.execute(big, now))
    print(" agent approves itself:", desk.approve("agent:support", big, now))
    desk.approve("mo", big, now)
    print(" after one person:", desk.execute(big, now))
    desk.approve("li", {**big, "amount": 900}, now)          # approved a different action
    print(" second approved 900 instead:", desk.execute(big, now))
    desk.approve("li", big, now)
    print(" 11 minutes later:", desk.execute(big, now + 660))
    desk.approve("mo", big, now + 660), desk.approve("li", big, now + 660)
    print(" both renew:", desk.execute(big, now + 661))
    print(" repeat:", desk.execute(big, now + 662))
    head = desk.log[-1]["hash"]                              # store this somewhere else
    print("\nlog:", verify(desk.log, head), "| notes:",
          sorted({e["note"] for e in desk.log}))
    edited = [dict(e) for e in desk.log]
    edited[3]["amount"] = 8
    print("amount edited:", verify(edited, head))
    print("last entry removed, no saved head:", verify(desk.log[:-1]))
    print("last entry removed, saved head:   ", verify(desk.log[:-1], head))

Output:

three refunds of 40: ['done', 'done', 'waiting: 0 of 1 approvals']
800: waiting: 0 of 2 approvals
 agent approves itself: refused: requester cannot approve
 after one person: waiting: 1 of 2 approvals
 second approved 900 instead: waiting: 1 of 2 approvals
 11 minutes later: waiting: 0 of 2 approvals
 both renew: done
 repeat: refused: already done

log: intact | notes: ['[email]', 'card [card]']
amount edited: BROKEN at entry 4
last entry removed, no saved head: intact
last entry removed, saved head:    BROKEN: newest entries missing or replaced

What to notice

  • The third small refund waited, because the total crossed the daily limit.
  • Approving 900 did nothing for the 800 refund: the approval is tied to a fingerprint of the exact action.
  • An approval that was too old had to be given again.
  • Removing the newest log entry went unnoticed until the check compared a saved final hash.
Missing on purpose

There is no sign-in, no check that an approver holds the right role, no exclusion of the human who asked the agent, no log entry for the approval click itself, no daily reset, no database transaction and no handling of a crash between executing and recording. A real service needs all of these, and an idempotency key so a retry cannot pay twice. See Reliable Tool Execution and Error Recovery.

Properties of a sound approval

  • Bound to the tool, every parameter and the target's current version
  • Given by an authenticated person with the right authority
  • Not the requester, where separation of duties applies
  • Expires, and is used once
  • Re-checked against policy at execution time
  • Recorded with who, what and when

The target version matters: if the order changed after the person looked, ask again.

Who may approve what

Write the authority down and let the system enforce it from the identity directory.

ActionApproverCannot beIf unavailable
Refund 51 to 500Support leadThe person who raised the requestNamed deputy
Refund above 500Support lead and financeThe same person twiceWait; tell the customer
Change access rightsSystem ownerThe person receiving accessWait
Bulk send to customersCommunications ownerThe author aloneWait

This table is illustrative. Avoid an automatic escalation that ends in "approved because nobody answered".

Approving through chat or email

Convenient channels can be imitated. Send a notification that leads to a signed-in screen instead of accepting a reply as approval. If a chat button is used, verify the platform's signature on the callback, the identity and role of the person who clicked, the action fingerprint and the expiry. Never accept an approval that appears inside content the agent read.

Forged approvals

A document or another agent saying "the manager already approved this" is data. Approval exists only as a record created by your approval system.

Reviewer fatigue

People who see hundreds of near-identical prompts approve without reading. Measure it and design against it.

SignalPossible response
Almost every request approved in secondsAutomate the safe cases with tighter rules, or improve the screen
Long queues and expired requestsRaise capacity, group related items, adjust thresholds with the owner
Frequent edits before approvalFix the agent's proposals
One person approves everythingShare the load and check independence

Batch approval is acceptable only when the person can see every item and totals still apply. Occasional seeded test requests, agreed with the reviewers' managers, can show whether review is real; treat the result as feedback on the design.

Expert Evidence you can trust

What to log

RecordAvoid recording
User, agent, version, task and timePasswords, tokens and keys
Tool, resource identifiers and key valuesFull documents and messages by default
Policy version and decisionPayment card and government identifiers
Approvals, edits and rejectionsHealth or other special data unless essential and protected
Outcome, error and correlation identifierHidden reasoning treated as fact

Redact before the record leaves the process, because a copy made earlier cannot be reliably recalled. Pattern matching misses things, as the example on PII Redaction and Data Leakage Prevention shows, so prefer logging chosen fields over logging everything and cleaning later.

Logs are an attack surface

User and model text can contain line breaks or markup meant to forge entries or attack the log viewer. Use structured records with encoded values, escape on display and do not let an agent that reads logs treat their contents as instructions.

import json, logging

def audit(logger, **fields):
    logger.info(json.dumps(fields, ensure_ascii=True, sort_keys=True))

This fragment was not part of the run above. JSON encoding keeps each record on one line; it does not remove sensitive values.

Make tampering visible

Entry 1hash A
Entry 2contains A
Entry 3contains B
Elsewherelatest hash, signed or locked

A hash chain detects edits only against a trusted reference. Someone who can rewrite the whole log can rebuild the chain. Send records promptly to a separate system with append-only or write-once storage, restrict deletion, and compare saved head hashes. The workload that produces events should not be able to change them.

Access and retention

QuestionDecide
Who can read?Named roles; access itself logged
How long?By purpose and legal duty, then delete
Where?Allowed regions and providers
Individual requests?How personal data in logs can be found
Incidents?How relevant records are preserved

See Safe Logging, Sampling and Retention and Transparency, Accountability and Audit Evidence.

Measures to review monthly

  • Share of actions in each tier, and changes in that share after releases.
  • Time to decision, expired requests and rejected requests.
  • Approved actions that were later reversed or caused complaints.
  • Attempts blocked by totals, role checks or changed parameters.
  • Gaps in logging: actions in the target system with no matching record.

The last measure is a reconciliation. Compare what the payment, ticket or database system says happened with what the agent platform recorded. A difference means something acted outside the controlled path or the record is incomplete.

When controls are unavailable

If the approval service is down, consequential actions wait. If the audit log cannot be written, stop the actions that require a record. Tell the user plainly that the request is pending, and make sure that waiting requests expire instead of running late and unexpectedly.

Tests to automate

TryExpected
Change a parameter after approvalRefused
Run an approved action twice, including in parallelOne effect
Split a large action into small onesTotal limit applies
Approve as the requester or without the roleRefused
Edit or truncate stored logsVerification fails
Put marker secrets in inputsNot found in logs

A worked threshold policy

Illustrative example

A support team writes down its refund rules: automatic up to 50 with a daily total of 100 per customer; one lead above that; lead and finance above 500; never to a payment method other than the original one. The first week shows many requests just above 50 for delayed deliveries. The owner does not simply raise the limit. The team adds a rule that checks the carrier's delay record, allows a higher automatic amount only when it matches and keeps the daily total. Both the evidence and the decision are logged, and the rule has a review date.

Change thresholds the way you change code: propose, review, test with past cases, release and watch. An agent must never be able to edit the policy that limits it.

Common mistakes

MistakeBetter practice
Approving a chat message such as "yes, go ahead"Approve a structured action through a trusted control
Per-item limits onlyAdd totals, counts and novelty
Standing approval for a whole sessionOne action, one approval, or a narrow bounded grant
Logging full prompts everywhereLog chosen fields; protect any content capture
Logs the agent can editSeparate, restricted store

Checklist

  • Every action type has a tier and an owner
  • Totals and counts are enforced atomically
  • Approvals are bound, expiring and single use
  • Sensitive values are removed before storage
  • Tamper evidence is checked, not merely written

Frequently asked questions

Can another model approve actions?

It can add a check or raise the risk tier, but it is not a human approval and can be fooled by the same content.

Does approval remove the need for permissions?

No. An approver cannot grant what policy forbids, and the action still needs authorization.

Should reasoning text be logged?

Only with a clear purpose and the same protections as other content. It is not a reliable account of why something happened.

How long should approval requests stay open?

Long enough for a normal response and short enough that the facts shown remain true; re-check them at execution.

References and further reading

Next steps