Sub topic 12
Where a person stays in the loop
This chapter covers where an agent workflow should stop and wait for a person, and how to build that stop so it works under time pressure. It assumes you have read the chapter on checking numbers and claims, so you know how the unsupported_numbers check flags figures that no tool result supports. It also assumes you can read Python and know what a tool call is.
Why verification does not replace review
Automated checks catch one kind of error: a number that has no source. They cannot tell you whether a report is wise to send. These problems pass every check:
- The numbers are correct, but the comparison is misleading. For example, it compares a holiday week with an ordinary week.
- The report states a cause ("conversions fell because of the new landing page") that the data only hints at.
- The report is accurate and internal, but it is about to go to a client.
- The agent is about to change a budget, which is an action and not a statement.
A person is the right check for judgment, accountability and anything that is hard to undo. The design question is not whether to include a person. It is where to put them, so they see the right things and do not become a rubber stamp.
Three roles for a person
People can sit in an agent workflow in three different ways. Pick one per decision, not one for the whole system.
| Role | What the person does | Use it when |
|---|---|---|
| Approver | The agent stops until the person says yes or no | The action is external, costly or irreversible |
| Reviewer | The agent continues. The person checks a sample or a summary afterwards | Errors are cheap to fix and volume is high |
| Supervisor | The person sets rules and reads logs, but does not see each output | The task is routine and well measured |
An approver adds delay and attention cost to every item, so use it sparingly. A reviewer only works if you can still correct things after the fact. A supervisor needs the monitoring covered in a later chapter.
Decide by risk, not by habit
Two questions place most decisions: how bad is a mistake, and can it be undone?
- A weekly internal summary that nobody acts on without checking: low risk. Sample review is enough.
- A report sent to a client or published: external, so approval is required.
- A change to bids, budgets or audiences through an ad platform API: costly and immediate, so approval is required for every change.
- A draft that contains flagged unsupported numbers: stop, regardless of audience.
- A large change from the previous period, such as spend up 40%: either a real event or a data fault, so a person should look.
The following flowchart shows this routing.
A review gate in code
Put the routing rule in plain code, not in the prompt. A prompt that says "ask a human when unsure" depends on the model's judgment about its own uncertainty, and models are often confidently wrong. A rule such as "external reports always need approval" cannot be talked out of its decision.
The code below implements the routing and an approval record. It runs as shown.
from dataclasses import dataclass, field
from datetime import datetime, timezone
CHANGE_THRESHOLD_PCT = 25.0
@dataclass
class Draft:
report_id: str
text: str
audience: str # "internal" or "external"
unsupported: list = field(default_factory=list)
max_change_pct: float = 0.0 # largest period-over-period move
def review_level(draft):
"""Return 'approve' (blocks until a person decides) or 'sample'."""
if draft.audience == "external":
return "approve"
if draft.unsupported:
return "approve"
if abs(draft.max_change_pct) > CHANGE_THRESHOLD_PCT:
return "approve"
return "sample"
def record_decision(log, draft, reviewer, decision, comment=""):
"""Append an auditable record. decision is 'approved' or 'rejected'."""
if decision not in ("approved", "rejected"):
raise ValueError("decision must be 'approved' or 'rejected'")
if decision == "rejected" and not comment:
raise ValueError("a rejection needs a comment the agent can act on")
log.append({
"report_id": draft.report_id,
"reviewer": reviewer,
"decision": decision,
"comment": comment,
"at": datetime.now(timezone.utc).isoformat(),
})
log = []
d1 = Draft("r-101", "Weekly summary...", "internal", max_change_pct=4.0)
d2 = Draft("r-102", "Client report...", "external")
d3 = Draft("r-103", "CPA was 21.0...", "internal", unsupported=["21.0"])
for d in (d1, d2, d3):
print(d.report_id, review_level(d))
record_decision(log, d3, "dana", "rejected", "CPA 21.0 is not in the data; use 17.5")
print(log[0]["decision"], "-", log[0]["comment"])The output is:
r-101 sample
r-102 approve
r-103 approve
rejected - CPA 21.0 is not in the data; use 17.5Two details matter. The rejection requires a comment, because a bare "no" gives the agent nothing to fix and gives you no data on why drafts fail. The record includes who decided and when, so you can answer later who approved a report.
Gate actions, not only text
Reports are statements. Tools that change things in the world need a stronger gate. Split your tools into two groups:
- Read tools fetch data or calculate metrics. They can run freely inside the agent loop.
- Write tools change a budget, pause a campaign, send an email or publish a page. They should not execute inside the loop at all.
A safe pattern is to let the agent propose a write action as structured data, such as {"action": "pause_campaign", "campaign_id": "c-42", "reason": "CPA above target for 7 days"}. The proposal goes to a queue. A person approves it, and separate code then executes it. The agent never holds the credentials for the write tool. This also limits damage from a prompt-injection attack, where text in a scraped web page tells the model to do something it should not.
Make the review easy to do well
A review fails when the reviewer cannot tell what to look at. Reviewers who see a 3,000-word report with no hints will skim and approve. Give them:
- The flagged items first: unsupported numbers, large changes, and claims the agent marked as inference.
- A link from each figure to the tool result it came from, so checking takes seconds.
- A diff against last period's report, so they see what changed.
- Clear options. Approve, reject with comment, and edit directly are enough.
Separate facts from interpretation in the report's structured output. If each claim carries a field such as "basis": "data" or "basis": "inference", the review screen can highlight the inferences, which are where the model most often overreaches.
Sampling, and how to keep it honest
For low-risk output you review a sample, not everything. Two rules keep sampling from decaying:
- Sample at random, not by what looks interesting. Choose, for example, 1 in 10 released reports with a seeded random draw, plus every report in the first two weeks of any new prompt or model version.
- Track the result. If the reviewer corrects 2% of sampled reports, the sampling rate can stay low. If corrections rise above a limit you set in advance, move that report type back to full approval.
This turns "how much should a person check" into a number you adjust from evidence, and it links to the evaluation chapter later in this tutorial.
Common failure modes
- Approval fatigue. If 95% of approvals are clicks with no edits, the reviewer is no longer reviewing. Reduce the volume of items needing approval, and make flagged items stand out.
- Automation bias. People trust fluent, well-formatted text. Show sources next to claims and ask reviewers to check at least one figure per report against the source.
- Unclear ownership. If "the team" approves, nobody does. Name a person for each report type.
- A gate that can be bypassed. If an operator can run the publish script directly, the gate is a suggestion. Route all publishing through the gated path.
- Feedback that goes nowhere. Rejection comments should return to the agent's next run, either as context for that draft or as a recorded example for later prompt changes.
Exercise
An agent drafts a weekly internal report. Its numbers all pass the unsupported-number check, and the largest change from last week is 8%. A teammate wants to add a rule that lets the agent also pause any campaign whose CPA is above target for 7 days, without asking anyone. Using the routing in this chapter, which review level applies to the report, and what should happen to the pause action?
Show answer
The report is internal, has no unsupported numbers and no change above the threshold, so it takes the "sample" level: it is released and included in the random spot-check. The pause action is a write action with an immediate cost, so it should not run automatically. The agent should only propose it as structured data, for example the campaign ID and reason, and a person approves it. Separate code that holds the platform credentials then executes it.
Exercise
Your reviewer corrected 1 of 40 sampled reports last month, then 9 of 40 after you switched to a new model version. What should you do with the review level for that report type, and why?
Show answer
Move it back to full approval, at least temporarily, and sample every report for a period after the model change. The rise from about 2.5% to about 22.5% corrections is evidence that the new version is less reliable on this task. Once corrections fall below the limit you set in advance, you can return to sampling. Read the rejection comments to find what changed.