Overview
Human-in-the-Loop (HITL) introduces explicit checkpoints where an agent pauses and requests review, approval, or edits before continuing. It is not a UI feature — it is a control pattern that affects state, timeouts, escalation paths, and auditability.
But there is a deeper reason HITL matters in agentic engineering: models are RL-trained to use their entire turn productively. They do not have a natural alternative to pushing forward. Without an explicit escape hatch, the agent will always choose to continue — even when continuing means guessing, working around obstacles, or reward hacking.
The HITL Tool
The simplest and highest-impact implementation: give the agent a tool that stops execution and raises a question to the human.
@tool
def ask_human(question: str):
"""Stop execution and ask the human for guidance.
Use this when you encounter uncertainty, missing information,
or a decision that requires human judgment."""
notify_user(question)
response = wait_for_human()
return response
By adding this tool, you change the action space. The agent can now choose between “continue autonomously” and “pause and ask.” This single change prevents the majority of reward hacking failures, because the agent no longer needs to work around every obstacle it encounters.
Most agentic failures come not from the model being incapable, but from the model pushing through situations where it should have asked.
Common Decisions
When designing HITL checkpoints, consider:
- Where to place checkpoints. High-risk actions (destructive operations, external API calls, irreversible state changes), architectural decisions, and any point where the agent’s confidence is low.
- How to present context. Give the human enough information to make a decision quickly: diffs, summaries, tool traces, the agent’s reasoning, and the specific question the agent is asking.
- What happens on timeout. If the human doesn’t respond within a configured window: retry the notification, fall back to a safe default, or abort the session.
- Escalation paths. Not all pauses need the same human. Route infrastructure questions to ops, product questions to PMs, architectural questions to senior engineers.
Checkpoint Types
Pre-action checkpoints. The agent proposes an action and waits for approval before executing. Good for destructive operations.
Post-action checkpoints. The agent executes and then pauses for review before continuing. Good for intermediate results that need human judgment.
Agent-initiated pauses. The agent itself decides to pause using the HITL tool. This is the most important type because it lets the agent flag uncertainty rather than hiding it.
Related Patterns
- Hawk Agent — External oversight that works alongside HITL checkpoints.
- Evaluator-Optimizer — Can trigger HITL when the evaluator detects quality below threshold.
- Rollback and Learnings — HITL is required for the agent to signal failure early enough for clean rollback.