Sub topic 6
What to show the reviewer
This chapter assumes you can read short Python programs and JSON. It also assumes you know how an agent calls tools, and that you have seen the approval gate from the earlier chapters: the workflow pauses, a human decides, and the workflow resumes. Here we look at the message the human sees. A gate is only as good as the information it gives the reviewer.
Why the request matters
An approval gate moves a decision from the agent to a person. That only helps if the person can judge the action. Suppose the reviewer sees this:
Agent wants to run send_email. Approve?The reviewer cannot answer. They don't know who gets the email, what it says, or why the agent wants to send it. They will either reject everything, which makes the agent useless, or approve everything, which makes the gate useless.
A good approval request lets a reviewer answer four questions in about ten seconds:
- What exactly will happen?
- Why does the agent want to do it?
- What could go wrong, and can it be undone?
- What can I do besides say yes or no?
The parts of an approval request
Build the request as a structured object, not a free-text string. A structure can be rendered in a web page, a chat message, or a terminal. It can also be stored and checked later.
| Field | Purpose | Example |
|---|---|---|
| `approval_id` | Unique key that links the decision to the paused run | `apr_8f21` |
| `action` | Tool name in plain words | Send email |
| `args` | The exact arguments the tool will receive | `to`, `subject`, `body` |
| `risk` | Risk level from your classifier | `high` |
| `reversible` | Whether the effect can be undone | `false` |
| `reason` | The agent's stated purpose, shown as a claim | "Customer asked for a refund confirmation" |
| `context` | Evidence the reviewer can check | Ticket link, prior messages |
| `options` | Decisions the reviewer may choose | approve, edit, reject |
| `expires_at` | When the request stops being valid | ISO timestamp |
| `fingerprint` | Hash of the name and arguments | `9c1e...` |
The last field ties this chapter to the action-binding chapter. The fingerprint is computed from what the reviewer sees, so the approved action and the displayed action are the same thing.
A request builder
The code below builds a request from a tool call. It reuses ToolCall, risk_of, and fingerprint from earlier chapters, and I repeat them here so the example runs on its own.
import hashlib
import json
import time
from dataclasses import dataclass
@dataclass(frozen=True)
class ToolCall:
name: str
args: dict
RISK = {
"search_docs": "low",
"send_email": "high",
"delete_record": "high",
}
IRREVERSIBLE = {"send_email", "delete_record"}
LABELS = {
"send_email": "Send an email",
"delete_record": "Delete a record",
}
def risk_of(call: ToolCall) -> str:
return RISK.get(call.name, "high")
def fingerprint(call: ToolCall) -> str:
payload = json.dumps({"name": call.name, "args": call.args}, sort_keys=True)
return hashlib.sha256(payload.encode()).hexdigest()
def build_request(approval_id, call, agent_reason, context, ttl_seconds=3600):
return {
"approval_id": approval_id,
"action": LABELS.get(call.name, call.name),
"tool": call.name,
"args": call.args,
"risk": risk_of(call),
"reversible": call.name not in IRREVERSIBLE,
"reason": agent_reason,
"context": context,
"options": ["approve", "edit", "reject"],
"expires_at": time.time() + ttl_seconds,
"fingerprint": fingerprint(call),
}
call = ToolCall("send_email", {"to": "[email protected]", "subject": "Refund", "body": "Your refund is on its way."})
request = build_request(
"apr_8f21",
call,
agent_reason="Customer asked for confirmation of refund #4412.",
context={"ticket": "https://support.example.com/tickets/4412"},
)
print(json.dumps(request, indent=2))Notice that reversible defaults to true only for tools you did not list as irreversible. That is the opposite of the risk default, which treats unknown tools as high. For a safer design, make unknown tools both high risk and irreversible, so a new tool never looks harmless in the request.
Show the real action, not a summary
The most common mistake is to show a model-written summary of the action instead of the action. A summary can be wrong, and an attacker can influence it. Compare two displays for the same call:
- Summary: "Send a short thank-you note to the customer."
- Actual:
to: [email protected], cc: [email protected], body: "...export of all orders attached..."
If the reviewer only sees the summary, the gate protects nothing. Follow these rules:
- Always render the arguments that the tool will receive, taken directly from the
ToolCall. - Show the agent's explanation separately and label it as the agent's claim.
- Never let the explanation replace the arguments.
- Show all recipients, targets, and amounts, not just the first few.
Make the consequences visible
Reviewers judge risk better when you state the consequence in concrete words. Put the effect next to the arguments.
- For a payment: show amount, currency, destination account, and the remaining balance after the payment.
- For a deletion: show how many records match, and a few sample rows.
- For an email: show the full recipient list, and flag addresses outside your company domain.
- For a database update: show a before and after diff of the changed fields.
A diff is often the clearest format. The function below shows what changes for an update, and it only lists fields that differ.
def diff_fields(before: dict, after: dict) -> list:
changes = []
for key in sorted(set(before) | set(after)):
old = before.get(key)
new = after.get(key)
if old != new:
changes.append({"field": key, "old": old, "new": new})
return changes
before = {"plan": "basic", "seats": 5, "email": "[email protected]"}
after = {"plan": "pro", "seats": 5, "email": "[email protected]"}
for change in diff_fields(before, after):
print(f"{change['field']}: {change['old']} -> {change['new']}")This prints plan: basic -> pro. The reviewer reads one line instead of comparing two records.
If computing the consequence requires a read, do it in the approval builder using a read-only tool. Do not run the real action to preview it.
Give the reviewer enough context, but not too much
Context lets the reviewer verify the agent's claim. Good context is something the reviewer can check without trusting the agent:
- A link to the source ticket or document.
- The user's original request, quoted from the conversation.
- The one or two tool results that led to this action.
Bad context is a dump of the whole conversation. Long text hides the one detail that matters and trains reviewers to skim. Put the key facts at the top and make the full trace available through a link.
A useful layout, from top to bottom:
- One-line action title and risk badge.
- The exact arguments or a diff.
- Reversibility and blast radius (how many people or records are affected).
- The agent's reason, labeled as a claim.
- Links to evidence.
- Decision buttons and a text field for feedback.
Offer decisions that fit the situation
The options you show should match the decision types from the previous chapter. Each option needs a clear meaning.
- Approve runs the action exactly as shown.
- Edit opens the arguments for change. After an edit, show the new arguments again and recompute the fingerprint, because the approval now covers a different action.
- Reject requires or invites a reason. The reason goes back to the agent so it can try another route.
Prefer a reason field that is optional for approve and strongly encouraged for reject. A rejection with no reason leaves the agent to guess, and it often retries the same call.
Show the deadline and what happens at expiry
The reviewer should know how long the request stays open and what the default outcome is. Say it plainly: "Expires at 15:00. If nobody responds, the action will not run." The safe default for an expired request is that the action does not run. Never display a deadline that quietly approves on timeout.
Render the request safely
The arguments are data that might contain markup, long strings, or invisible characters. Treat the display as a security boundary.
- Escape all values before putting them in HTML or chat markup.
- Truncate long strings in the summary view, but show a clear "truncated" marker and a way to see the full value.
- Show lookalike or invisible characters, such as zero-width spaces in an email domain, in an escaped form.
- Compare the displayed value to the fingerprinted value, so what you render comes from the same object you hash.
The helper below makes control and non-ASCII characters visible in a recipient field.
def reveal(value: str) -> str:
out = []
for ch in value:
if ch.isascii() and ch.isprintable():
out.append(ch)
else:
out.append(f"\\u{ord(ch):04x}")
return "".join(out)
print(reveal("ana@exam\u200bple.com"))The output is ana@exam\u200bple.com, which exposes the hidden zero-width space that would otherwise look like a normal address.
Flow of a request
The diagram shows where the request is built and what the reviewer returns.
Common mistakes
- Showing only the tool name, with no arguments.
- Showing a model-written summary instead of the real arguments.
- Hiding irreversibility, so a delete looks like an update.
- Burying the key detail in a long transcript.
- Letting an edit reuse the old fingerprint.
- Displaying text that was not escaped.
- Using the same layout for low and high risk requests, which trains reviewers to ignore the risk label.
Exercises
Exercise
An agent proposes delete_record with {"table": "customers", "filter": "status = 'inactive'"}. The request shows only "Delete inactive customers?" and a model-written reason. List three things you would add so the reviewer can judge the action.
Show answer
Add the exact arguments (table and filter), the number of matching records with a few sample rows, and a statement that deletion is irreversible, including whether a backup exists. You could also add a link to the evidence for why these customers should be deleted, and an expiry that defaults to not running.
Exercise
A reviewer edits the to field of a pending email and clicks approve. Why must the request be rebuilt with a new fingerprint, and what could go wrong if it is not?
Show answer
The fingerprint is a hash of the tool name and arguments. After the edit, the arguments differ, so the old fingerprint describes a different action. If the old fingerprint were reused, the approval would either fail the check at execution time or, in a weaker design, authorize an action the reviewer never saw. Rebuilding shows the reviewer the final action and binds the approval to exactly that action.
Exercise
Why should the agent's reason be displayed separately from the arguments and labeled as a claim?
Show answer
The reason is model-generated text and may be shaped by untrusted content the agent read, such as a malicious web page or email. If it replaces or blends with the arguments, an attacker can make a harmful action look harmless. Showing the real arguments, with the reason clearly labeled as the agent's claim, lets the reviewer judge the action itself.