Skip to content

Human-in-the-Loop Patterns for Trustworthy AI Agents

Human-in-the-loop patterns for AI agents: approval gates, escalation, draft-and-review, and audit sampling, matched to action risk so oversight works.

TechnoKeen Engineering 8 min read Published
On this page

Human-in-the-loop design means deciding, action by action, where a person must approve, review, or be able to intervene in what an AI agent does. The right pattern depends on how risky and reversible each action is: read-only lookups can run freely, while payments, deletions, and external messages usually need an approval gate. Done well, oversight is targeted and fast. Done badly, it becomes a rubber stamp that slows everything and catches nothing.

Key takeaways

  • Classify every tool by risk and reversibility, and attach oversight to actions, not to the agent as a whole.
  • Use a small set of patterns: approval gates, draft-and-review, confidence-based escalation, and post-hoc audit sampling.
  • Implement approvals as a pause-and-resume in the orchestration layer with persisted state, never as a prompt instruction asking the agent to “check first”.
  • Design the review screen as carefully as the agent. Reviewers need the proposed action, the evidence, and a fast way to edit or reject.
  • Measure oversight itself: approval rates, edit rates, and review times tell you when to tighten or relax controls.

Why human oversight is an engineering problem

It’s tempting to treat human-in-the-loop as a policy statement: “a person reviews all agent actions.” In practice that statement fails in one of two ways. Either review becomes so constant that people approve without reading, or it’s so vague that nobody knows which actions actually need a human.

Effective oversight is a design decision made per action, enforced in code, and measured over time. It also matters for compliance. The EU AI Act requires high-risk AI systems to be designed so that people can effectively oversee them (Article 14), including being able to understand outputs, decide not to use them, and intervene or stop the system. The NIST AI RMF similarly treats human oversight roles as part of managing AI risk. “Effective” is the key word in both: a reviewer who can’t tell what they’re approving isn’t providing oversight.

There’s also a security reason. The OWASP Top 10 for LLM Applications lists excessive agency as a core risk, and recommends requiring human approval for high-impact actions. An approval gate is one of the few controls that still works when a prompt injection has convinced the model to do something it shouldn’t. Our guide to securing AI agents covers that threat model.

Step one: classify actions by risk

Before picking patterns, list every tool your agent can call and place each on two axes: impact if it’s wrong, and reversibility.

Tier Example actions Reversible? Default oversight
0: Read-only Search docs, look up an order, query analytics N/A None; log and trace
1: Internal, reversible Tag a ticket, draft a reply, update a CRM note Yes Post-hoc audit sampling
2: Customer-facing or moderate impact Send an email, issue a small credit, change a booking Partly Approval or confidence-based escalation
3: High impact or irreversible Large refund, delete data, change permissions, execute a payment, deploy code No Mandatory approval, possibly two-person

The tiers belong in configuration next to the tool definitions, so they’re reviewable and versioned. Thresholds can depend on arguments as well as the tool: a refund under a set amount might be tier 2 while a larger one is tier 3.

A useful side effect: this exercise often reveals tools that shouldn’t be exposed to the agent at all. If an agent never needs to delete records, remove the delete tool rather than gating it. Our post on tool design for AI agents discusses scoping tools this way.

The core human-in-the-loop patterns

1. Approval gate

The agent proposes an action and pauses. A person approves, edits, or rejects it, and the agent resumes with the decision. Use this for tier 2 and tier 3 actions.

The key implementation detail is that the pause happens outside the model. The orchestrator intercepts the tool call before execution, persists the run’s state, and waits. The model never gets the chance to skip the check.

2. Draft and review

The agent produces a complete work product, such as an email, a contract summary, or a code change, and a person reviews it before it goes anywhere. This is approval at the level of an artifact rather than a single tool call. It works well when the agent’s value is in preparation and the final act (sending, signing, merging) stays human. Coding agents that open pull requests for human review follow this pattern. See coding agents in the enterprise.

3. Confidence-based escalation

The agent handles routine cases end to end and hands off to a human when a case falls outside defined bounds. The trigger should be based on things you can check, not on the model’s self-reported confidence alone, which tends to be poorly calibrated. Better triggers include:

  • Business rules: amount above a threshold, VIP account, regulated product.
  • Missing information: a required field couldn’t be found or verified.
  • Validation failure: the proposed action fails a schema or policy check.
  • Disagreement: a verifier model or second sample disagrees with the first.
  • User request: the person asks for a human.
  • Budget limits: the run hit its step or spend cap.

4. Post-hoc audit sampling

For low-risk, reversible actions, review happens after execution on a sample of runs. Reviewers flag errors, which become eval cases and may trigger a rollback. This keeps throughput high while still giving you a quality signal. Increase the sample rate after any change to prompts, models, or tools.

5. Interrupt and takeover

For long-running or real-time agents, give operators the ability to pause a run, inspect its state, correct course, or take over entirely. This is the “stop button” that oversight requirements describe, and it depends on having good observability so the operator can see what’s happening.

Implementing an approval gate

The pattern is the same regardless of framework: intercept the tool call, check its tier, persist state, and resume when a decision arrives. Here is a framework-agnostic policy check in Python.

from dataclasses import dataclass
from enum import IntEnum
from typing import Any, Callable


class Tier(IntEnum):
    READ_ONLY = 0
    INTERNAL = 1
    CUSTOMER_FACING = 2
    HIGH_IMPACT = 3


@dataclass(frozen=True)
class ToolPolicy:
    base_tier: Tier
    # Optional rule that can raise the tier based on arguments.
    escalate_if: Callable[[dict[str, Any]], bool] | None = None


POLICIES: dict[str, ToolPolicy] = {
    "lookup_order": ToolPolicy(Tier.READ_ONLY),
    "add_ticket_note": ToolPolicy(Tier.INTERNAL),
    "send_customer_email": ToolPolicy(Tier.CUSTOMER_FACING),
    "issue_refund": ToolPolicy(
        Tier.CUSTOMER_FACING,
        escalate_if=lambda args: args.get("amount", 0) > 250,
    ),
    "close_account": ToolPolicy(Tier.HIGH_IMPACT),
}


def effective_tier(tool_name: str, args: dict[str, Any]) -> Tier:
    policy = POLICIES.get(tool_name)
    if policy is None:
        # Unknown tools are treated as highest risk, never as safe.
        return Tier.HIGH_IMPACT
    if policy.escalate_if and policy.escalate_if(args):
        return Tier.HIGH_IMPACT
    return policy.base_tier


def requires_approval(tool_name: str, args: dict[str, Any]) -> bool:
    return effective_tier(tool_name, args) >= Tier.CUSTOMER_FACING

If you’re using LangGraph, its interrupt mechanism handles the pause and resume. The graph must be compiled with a checkpointer so state survives while waiting, and the run is resumed with a Command carrying the reviewer’s decision. See the LangGraph documentation for the full human-in-the-loop guide.

from langgraph.types import interrupt, Command


def execute_tool_node(state: dict) -> dict:
    call = state["pending_tool_call"]

    if requires_approval(call["name"], call["args"]):
        # Execution pauses here; the payload is surfaced to your review UI.
        decision = interrupt({
            "tool": call["name"],
            "args": call["args"],
            "tier": effective_tier(call["name"], call["args"]).name,
            "evidence": state.get("evidence", []),
        })
        if decision["action"] == "reject":
            return {"messages": [tool_rejection(call, decision.get("reason", ""))]}
        if decision["action"] == "edit":
            call = {**call, "args": decision["args"]}

    result = TOOLS[call["name"]](**call["args"])
    return {"messages": [tool_result(call, result)]}


# Later, when the reviewer responds (graph compiled with a checkpointer):
# graph.invoke(Command(resume={"action": "approve"}), config={"configurable": {"thread_id": run_id}})

Three details matter in any implementation:

  1. Unknown tools default to the highest tier. A new tool added without a policy should be blocked, not allowed.
  2. Edits are first-class. Reviewers often want to fix an amount or a sentence rather than reject outright. Feed the edited arguments back so the agent continues with them.
  3. Rejections go back to the agent with a reason. That lets it try a different approach or explain to the user, instead of stalling.

One LangGraph-specific caution: when a run resumes, the interrupted node re-executes from its beginning, so keep any side effects after the interrupt() call, not before it.

Make approvals durable. Persist run state in a database-backed checkpointer, not memory, so a deploy or restart doesn’t lose pending approvals. Set a timeout and a default action (usually “escalate” or “cancel”, never “approve”) for requests that sit too long.

Designing the review experience

The review screen is where oversight succeeds or fails. A reviewer looking at “Approve tool call: issue_refund {“order_id”: “88123”, “amount”: 412.50}” has almost nothing to judge with. Good review interfaces show:

  • The proposed action in plain language: “Refund $412.50 to the customer’s original card for order 88123.”
  • The evidence: the customer’s message, the order details, the policy passage the agent relied on.
  • The agent’s reasoning, briefly, so the reviewer can spot a wrong assumption.
  • What happens next on approve and on reject.
  • One-click approve, inline edit, and reject with a reason.

Route approvals to where reviewers already work, such as the ticketing system or a chat channel, rather than a separate dashboard nobody checks. Batch low-urgency approvals so reviewers can clear them in one session.

Watch for automation bias. When an agent is right most of the time, reviewers naturally start approving without reading. Countermeasures include keeping approval volume low enough to review properly, highlighting the specific fields that drive risk, and occasionally inserting known-bad test proposals to check that reviews are real. Be transparent with reviewers if you do the latter.

Measuring and tuning oversight

Oversight should change as the agent proves itself, in either direction. Track:

  1. Approval rate per tool and tier. If one action is approved nearly every time with no edits over a long period, it may be a candidate for moving to audit sampling.
  2. Edit rate and edit type. Frequent edits to the same field point to a fixable agent problem.
  3. Rejection reasons. Categorize them and feed them into your eval suite.
  4. Time to decision. Long waits mean the workflow, not the agent, is the bottleneck.
  5. Post-approval incidents. Errors that reviewers approved show where the review screen is missing information.

Relaxing a control should be a deliberate, recorded decision based on this data, made by an accountable owner. That record is useful for governance reviews too. See our guide to AI governance for agentic systems.

FAQ

Which AI agent actions should require human approval?

Actions that are high impact, customer-facing, or hard to reverse: payments and refunds above a threshold, deletions, permission changes, external communications, and production deployments. Read-only and easily reversible internal actions usually don’t need approval and can be covered by audit sampling instead.

Can I just tell the agent to ask before taking risky actions?

Not as your only control. Instructions in a prompt can be ignored, misread, or overridden by prompt injection. Enforce approvals in the orchestration layer by intercepting tool calls before they execute, so the model can’t bypass the gate.

Doesn’t human-in-the-loop defeat the purpose of automation?

Not if it’s targeted. Most agent actions in a well-scoped system are low risk and run without review. Approval gates apply only to the small set of consequential actions, and the agent still does the research, preparation, and drafting that take most of the time.

How do I stop reviewers from rubber-stamping approvals?

Keep approval volume manageable, show clear evidence and plain-language summaries, and highlight the fields that carry risk. Track approval and edit rates to spot reviews that have become automatic. Definitions of related terms are in our glossary.

Working with TechnoKeen

TechnoKeen designs risk tiers, approval flows, and review interfaces as part of the agents we build, so oversight is effective rather than ceremonial. If you’re deciding where humans belong in your agent’s workflow, talk to us or try the agent readiness assessment.

  • #human-in-the-loop
  • #agent oversight
  • #approval workflows
  • #escalation

TechnoKeen Engineering

TechnoKeen is an enterprise agentic AI company. Our engineers design, deploy, and govern AI agents for organizations in regulated and complex industries, and share what we learn in the field.

About TechnoKeen →

Keep reading

Ready to put agents to work?

Book a 45-minute executive briefing. We will review your priority workflows, current AI efforts, and risk posture, then outline a clear path to agents in production.