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.
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.
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.
Sort actions by consequence
| Tier | Typical actions | Control |
|---|---|---|
| Automatic | Read permitted data, draft text, small reversible changes | Permission check and log |
| Notify | Routine changes that are easy to undo | Run, tell a person, offer undo |
| Approve | Send outside, spend money, change access, delete | One authorized person before it runs |
| Two approvers | Large payments, production changes, bulk operations | Two different authorized people |
| Never | Outside the agent's purpose or unacceptable | No 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.
Ways of involving people
| Pattern | How it works | Fits | Weakness |
|---|---|---|---|
| Approve before | Nothing happens until someone agrees | Irreversible or costly steps | Delay and fatigue |
| Delay with cancel | Runs after a waiting period unless stopped | Low-risk, reversible steps | Silence counts as consent, so never use it for serious actions |
| Review after | A person checks completed actions | Reversible work at volume | Harm happens first |
| Sampling | A share of actions is reviewed | Quality measurement | Not a barrier to any single action |
| Exception queue | Only unusual cases go to people | Mature processes with clear rules | Depends 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
| Show | Why |
|---|---|
| The action in plain words, with exact values | "Refund 800.00 to order A-1", not "process request" |
| Who asked and which agent proposes it | Accountability |
| Evidence from trusted records | The model's summary alone may be wrong or manipulated |
| Warnings, such as untrusted content read | Raises appropriate caution |
| Effect and whether it can be undone | Sets the stakes |
| Expiry, and approve, change or reject | A 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.
Financial and operational thresholds
A limit on one transaction invites splitting. Combine several measures and count across tasks and agents.
| Measure | Example rule | Catches |
|---|---|---|
| Single value | Above 50 needs approval | One large action |
| Running total | Over 100 per customer per day needs approval | Splitting into small amounts |
| Count | More than 20 changes per hour pauses the agent | Loops and bulk misuse |
| Scope | More than 10 records at once needs approval | Mass edits and deletes |
| Novelty | First payment to an account needs approval | Redirected funds |
| Context | Session read untrusted content: ask more often | Injection-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.
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.
| Action | Approver | Cannot be | If unavailable |
|---|---|---|---|
| Refund 51 to 500 | Support lead | The person who raised the request | Named deputy |
| Refund above 500 | Support lead and finance | The same person twice | Wait; tell the customer |
| Change access rights | System owner | The person receiving access | Wait |
| Bulk send to customers | Communications owner | The author alone | Wait |
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.
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.
| Signal | Possible response |
|---|---|
| Almost every request approved in seconds | Automate the safe cases with tighter rules, or improve the screen |
| Long queues and expired requests | Raise capacity, group related items, adjust thresholds with the owner |
| Frequent edits before approval | Fix the agent's proposals |
| One person approves everything | Share 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.
What to log
| Record | Avoid recording |
|---|---|
| User, agent, version, task and time | Passwords, tokens and keys |
| Tool, resource identifiers and key values | Full documents and messages by default |
| Policy version and decision | Payment card and government identifiers |
| Approvals, edits and rejections | Health or other special data unless essential and protected |
| Outcome, error and correlation identifier | Hidden 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
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
| Question | Decide |
|---|---|
| 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
| Try | Expected |
|---|---|
| Change a parameter after approval | Refused |
| Run an approved action twice, including in parallel | One effect |
| Split a large action into small ones | Total limit applies |
| Approve as the requester or without the role | Refused |
| Edit or truncate stored logs | Verification fails |
| Put marker secrets in inputs | Not found in logs |
A worked threshold policy
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
| Mistake | Better practice |
|---|---|
| Approving a chat message such as "yes, go ahead" | Approve a structured action through a trusted control |
| Per-item limits only | Add totals, counts and novelty |
| Standing approval for a whole session | One action, one approval, or a narrow bounded grant |
| Logging full prompts everywhere | Log chosen fields; protect any content capture |
| Logs the agent can edit | Separate, 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
- OWASP logging cheat sheet
- NIST SP 800-61 Rev. 3: incident response recommendations
- OWASP Top 10 for Agentic Applications 2026
- General Data Protection Regulation
Next steps
Red Teaming and Incident Response
Test the controls and prepare to respond.
Action Guardrails and Policy Engines
Express the rules as policy.
Risk Tiers, Approvals and Human Oversight
Set oversight by risk across agents.