Pattern [13]

Human-in-the-Loop

Manual Approval Gates (CI/CD) / Maker-Checker Pattern / Two-Factor Authentication

> Agentic Definition

Integrating human oversight at critical decision points to validate agent actions, provide feedback, or disambiguate requests. The agent pauses execution and requests input from a human "Tool."

> Description

Integrating human oversight at critical decision points to validate agent actions, provide feedback, or disambiguate requests. The agent pauses execution and requests input from a human "Tool."

≈ How It Maps to Manual Approval Gates

Pausing a workflow for authorization or verification.

≠ Key Divergence

In Agentic systems, the human is treated as a "Tool" or an Oracle. The agent generates a prompt for the human ("I plan to send this email. Is it okay?"), and the human's response is injected back into the agent's context as a tool output. The interaction is conversational.

> Key Takeaway

Adapt: Design interfaces for the AI to "talk" to the human, not just the human to talk to the AI. The human is a component in the system loop.

The Code

Before: CI/CD Approval Gate

CI/CD Approval Gate
1# Static Approval Step (YAML pipeline)
2# steps:
3# - name: Wait for approval
4# uses: manual-approval-action
5# # Blocks until button click

After: Agentic Human-in-the-Loop

Agentic Human-in-the-Loop
1# The Agent proactively asks
2if action.risk_level > threshold:
3 # 'human_tool' pauses execution and sends a msg to Slack/UI
4 user_decision = human_tool.ask(
5 "I am about to delete a production database. Proceed?"
6 )
7 if user_decision == "Y":
8 execute()
9 else:
10 agent.think("User rejected. Aborting task.")

Production Notes

  • The ultimate guardrail for high-stakes actions (writes, payments, public posts).
  • Introduces massive latency (human speed vs. machine speed). Use asynchronous notifications (webhooks/Slack) rather than blocking the thread.

Unlock code examples & production notes

Free account — no credit card required.

Sign Up Free

Already have an account? Log in

Frequently Asked Questions

When should I use the Human-in-the-Loop pattern?

Integrating human oversight at critical decision points to validate agent actions, provide feedback, or disambiguate requests. The agent pauses execution and requests input from a human "Tool."

How does Human-in-the-Loop relate to Manual Approval Gates (CI/CD) / Maker-Checker Pattern / Two-Factor Authentication?

Pausing a workflow for authorization or verification. However, there is a key divergence: In Agentic systems, the human is treated as a "Tool" or an Oracle. The agent generates a prompt for the human ("I plan to send this email. Is it okay?"), and the human's response is injected back into the agent's context as a tool output. The interaction is conversational.

What are the production trade-offs of Human-in-the-Loop?

The ultimate guardrail for high-stakes actions (writes, payments, public posts). Introduces massive latency (human speed vs. machine speed). Use asynchronous notifications (webhooks/Slack) rather than blocking the thread.