Sub topic 1
Where an Approval Step Fits in the Agent Loop
Assume you understand basic LLM agents, Python functions, JSON, and background jobs. An agent loop repeatedly plans a step, calls a tool, observes the result, and plans the next step.
Prerequisites
You should know how an agent selects a tool and passes it arguments. You should also be comfortable reading short Python programs and representing data with dictionaries.
Where the Approval Step Fits
Approval belongs between planning and execution. The agent proposes a tool call, the workflow checks its risk, and a human decides whether the call may run.
The pause should happen before the side effect, such as sending an email, changing a record, or issuing a payment. The agent can continue after execution or use a rejection as feedback for a revised plan.
Why Agents Need Human Checkpoints
Language models can produce plausible but incorrect arguments. They may misunderstand a request, select the wrong recipient, or follow instructions hidden in untrusted content. A checkpoint gives a reviewer control over actions that affect people, money, data, or external systems.
Approval is most useful when the action is consequential and difficult to reverse. It is less useful for read-only searches that have limited impact.
> callout warning > Treat approval as a control boundary, not as a request for the reviewer to trust the model. Show the exact action and arguments that will run.
Deciding Which Actions Need Approval
Classify each tool by impact, reversibility, and uncertainty. Unknown tools should require approval until someone classifies them.
| Action | Typical risk | Default |
|---|---|---|
| Search internal documentation | Low | Auto-run |
| Send an external email | High | Require approval |
| Delete a customer record | High and irreversible | Require approval |
A policy can combine these factors. For example, allow read-only tools automatically, but require approval for writes, external communication, and destructive operations.
Building an Approval Gate
The gate should support approval, rejection, and edited arguments. Editing is safer than asking a reviewer to reject a nearly correct request and hoping the agent reconstructs it correctly.
def run_step(call, tools, ask_human):
if call["risk"] == "low":
return tools[call["name"]](**call["args"])
decision = ask_human(call)
action = decision["action"]
if action == "approve":
return tools[call["name"]](**call["args"])
if action == "edit":
return tools[call["name"]](**decision["args"])
return {"rejected": True, "reason": decision.get("reason", "")}In production, save the pending call before pausing. The resumed workflow should load that state, verify the decision, and record who decided and when.
Exercise
Where should an approval check occur for a tool that deletes data?
Show answer
After the agent proposes the exact call but before the tool executes.