Human-in-the-loop

Also known as: HITL · human in the loop

On this page 8

Human-in-the-loop (HITL) is a system design pattern in which an automated process deliberately hands control to a person at defined points, so that a human reviews, approves, edits or rejects a decision before it takes effect. In AI agents, human-in-the-loop means that an agent which plans and calls tools stops at checkpoints for consequential actions, such as sending an email, changing a production database or spending money, and resumes only after a person responds.

The pattern exists because agents built on language models are probabilistic, not guaranteed correct. HITL converts an autonomous loop into a supervised workflow, trading some speed and throughput for accountability, error containment and trust. It is a central control in artificial intelligence governance and appears in regulation, safety engineering and everyday agent frameworks.

How human-in-the-loop works inside an agent

Human-in-the-loop works by inserting an interrupt into the agent loop whenever a proposed step matches a review policy. The agent reasons, selects a tool, and produces a pending action with its arguments; the runtime then serializes the agent state, presents the proposal to a reviewer and waits.

The reviewer can approve, edit, reject or redirect the step. An approval executes the tool call unchanged, an edit executes a corrected version, and a rejection returns feedback to the model as an observation, so the agent can replan with human input. Because the state is persisted, the pause can last seconds or days without losing context, a property often called durable execution.

The following table lists the components that a working HITL checkpoint requires.

ComponentRoleTypical implementation
Review policyDecides which steps need a humanRules on tool name, risk score or cost
Interrupt mechanismHalts execution before the side effectFramework breakpoint or approval hook
State persistenceKeeps the plan and history during the waitCheckpointed graph state in a database
Review interfaceShows the proposal with contextChat card, ticket, dashboard or email
Resume pathFeeds the decision back to the agentApproved arguments or rejection message
Audit logRecords who decided what and whenImmutable event store with timestamps
Components of a human-in-the-loop checkpoint

Levels of human oversight

Human oversight is a spectrum, and human-in-the-loop is the strictest common level below fully manual operation. Practitioners distinguish it from human-on-the-loop, where a person monitors and can intervene but the system acts without waiting, and from human-out-of-the-loop, where no person is involved at run time.

The table below compares these levels by who acts first and where each fits.

LevelWho acts firstLatency costSuitable for
Human-in-the-loopHuman approves before actionHighIrreversible or high-impact steps
Human-on-the-loopSystem acts, human can stop itLowReversible, monitored operations
Human-out-of-the-loopSystem onlyNoneLow-risk, well-tested tasks
Human-in-commandHuman sets goals and limitsVariesGovernance of the whole system
Oversight levels compared

Many deployments mix levels within one agent: reading files runs unattended, while writes, payments and outbound messages require approval. This graduated autonomy is the practical form of HITL in modern agent frameworks and coding agents.

Where to place approval checkpoints

Checkpoints belong where an error would be costly, irreversible or externally visible. The guiding question is not whether the model might be wrong, since it always might, but what a wrong action would cost and whether it could be undone.

The decision table below maps common agent actions to a sensible oversight choice.

Agent actionRecommended oversightReason
Reading documents or search resultsNo approvalNo side effects
Drafting a replyReview before sendingExternal and hard to retract
Running shell commandsApproval or sandbox allowlistCan delete data or leak secrets
Merging code to mainMandatory human reviewAffects every user of the codebase
Issuing a refund or paymentApproval with amount shownFinancial and often irreversible
Granting access permissionsApproval by an authorized ownerSecurity impact persists
Decision table for checkpoint placement

Good checkpoints present the exact action and its arguments, the agent’s stated reason and the relevant context in one view. A reviewer who must reconstruct context from logs will approve slowly or, worse, approve without reading.

Human-in-the-loop beyond run-time approval

The term also covers human involvement during model development, not only at run time. In machine learning, HITL describes active learning, where a model asks people to label the examples it is least certain about, and feedback collection that later feeds techniques such as RLHF.

In agent systems the two meanings connect. Approval and rejection decisions are valuable training signals: a log of edited tool calls shows exactly where the agent misjudges a task, and teams use these logs to refine prompts, tool descriptions and evaluation sets. Human escalation, where an agent hands a conversation to a support employee when confidence is low, is another common variant.

Limitations and common failure modes

Human-in-the-loop is only as strong as the attention of the reviewer. The best-documented risk is automation bias, the tendency to accept machine suggestions without scrutiny, which grows as an agent is right most of the time.

The table below summarizes typical failures, their causes and remedies.

SymptomCauseFix
Rubber-stamp approvalsToo many low-value promptsReduce checkpoints to risky actions
Uninformed decisionsProposal lacks contextShow arguments, diff and rationale
Stalled workflowsNo reviewer availableTimeouts, escalation and on-call routing
Bypassed controlsAgent splits a risky step into small onesPolicy on cumulative effect, not single calls
Prompt injection approvalMalicious content shapes the proposalHighlight untrusted inputs to reviewers
Failure modes and fixes

HITL also does not scale linearly: if every step needs approval, throughput collapses to human speed. Teams therefore treat it as one layer of defense alongside sandboxing, least-privilege credentials, rate limits and automated evaluation, not as a substitute for them.

Regulatory and governance context

Regulators increasingly require meaningful human oversight for consequential automated decisions. The EU AI Act obliges providers of high-risk systems to design them so that natural persons can understand, monitor and override outputs, and the GDPR gives individuals rights regarding decisions based solely on automated processing.

The word meaningful matters: oversight must be performed by a competent person with the authority and information to disagree. A checkbox that nobody reads does not meet that standard, which is why audit logs and reviewer training form part of a credible HITL design.

Explained without jargon

Human-in-the-loop means that an AI system asks a person before doing anything important. The AI can gather information and prepare work on its own. Before it sends a message, deletes a file or pays an invoice, it stops. Then it waits for someone to say yes or no.

Think of a new assistant who drafts letters. A manager signs each one before it goes out. The work is faster than doing everything by hand. Yet a person still carries responsibility for what leaves the office. The key point is balance: ask for approval on the steps that matter, not on every small one.

A typical use case

An online retailer deploys an agent to handle refund requests. The agent reads each customer message, checks the order history and the return policy, and prepares a decision. Refunds under 50 dollars for orders matching policy run automatically, while larger amounts or exceptions appear in a review queue with the order details, the proposed amount and the agent’s explanation.

A support lead reviews about 40 of these proposals per shift, approving most in under a minute and correcting a few where the agent misread a shipping date. The corrected cases are added to the evaluation set each week. The result is that customers receive faster answers, while every significant payout has a named approver in the audit log.