Sarghaby Araghatta
Home / Knowledge Base / Human-in-the-Loop & Approval Gates
Agents & orchestration · AI Engineering

Human-in-the-Loop & Approval Gates

Checkpoints where an agent must get human approval (or edits) before proceeding — typically before side-effectful, costly, or irreversible steps like sending email, deleting data, or moving money.

Agent runsuntil gatedGated Toolrequires approvalHuman reviewsand approvesAgent resumesfrom checkpointState persistedacross pause
Human Approval in AI Workflows

How it works

The agent operates autonomously until it encounters a gated tool, at which point it pauses its execution. This pause allows the agent to present its intended action to a human for approval, modification, or rejection. Once the human provides input, the agent can resume from the exact state it was in when it paused. Frameworks like LangGraph and the Agent SDK have built-in mechanisms to persist the agent's state, enabling this pause to last anywhere from a few minutes to several days. The system is designed with a tiered approach to tools, where less risky actions can run automatically without human intervention, while more dangerous actions, like sending emails or deleting data, require explicit human approval before proceeding.

When the agent reaches a checkpoint, it effectively creates a boundary that separates safe operations from those that could have significant consequences. This design is crucial because it allows the agent to perform many tasks without oversight, while still ensuring that critical decisions are vetted by a human. The human-in-the-loop model thus acts as a safeguard against errors that could arise from the agent's decision-making process, especially in high-stakes situations. For example, if the agent is about to initiate a financial transaction, the pause allows for a thorough review to prevent costly mistakes.

This mechanism not only protects against errors but also enhances the trustworthiness of the system. By integrating human approval gates, the agent can operate efficiently in less critical areas while reserving human oversight for actions that could have irreversible effects. This balance between autonomy and oversight ensures that the system can adapt and scale while maintaining a safety net for high-impact decisions.

  • Agent runs until it hits a gated tool.
  • Human reviews and approves or edits the action.
  • State is persisted to allow resuming later.
  • Use gates for irreversible or high-impact actions.
  • Let safe actions run unattended.

The software-engineering analogue

You can think of this process as similar to a manual approval stage in a deployment pipeline or a database transaction that waits for a commit. In these cases, a human must review changes before they go live or become permanent. However, the key difference here is that the entity being gated is a nondeterministic agent. This means that the agent's actions are not always predictable, and it might make confident decisions that are incorrect. Thus, the gate serves as a critical safety boundary, not just a formality, ensuring that the agent's potentially erroneous actions do not lead to significant issues.

Why not the obvious alternative

A newcomer might first consider building a fully autonomous system, where the agent runs without any human intervention. This approach seems simpler and looks great in demos, as it showcases the agent's ability to operate independently. However, the downside becomes apparent when a single mistake occurs, such as a hallucinated argument that leads the agent to send an erroneous email to 10,000 customers or inadvertently drop a crucial database table. Such mistakes can have devastating consequences.

The gating mechanism addresses this risk by limiting the potential fallout from any single error. By requiring human approval for high-impact actions, you can cap the downside while allowing the agent to operate freely in less risky areas. This trade-off means sacrificing some speed in end-to-end processes, but it ultimately leads to a more reliable system. Having these approval gates can often satisfy compliance requirements, making it easier to deploy the system in regulated environments.

When to use which

Use approval gates for actions that are irreversible, external, financial, or involve high volumes of data. These actions carry significant risk and should be carefully vetted by a human before proceeding. On the other hand, allow read-only operations and actions that can be easily undone to run unattended. As you gain more trust in the agent's decision-making abilities and expand the evaluation coverage, you can gradually widen the scope of what can run automatically without human oversight.

Gating vs. Full Autonomy While full autonomy seems efficient, it risks costly mistakes; gating ensures safety for high-impact actions.

In production: when it breaks

The scenario Approval gates failed 30% of the time, causing delays in processing.
low responseinaccurate checksfailed notificationsimprove workflowenhance checksfix delivery issuesApproval RateHuman Response TimeAutomated Check AccuracyNotification DeliverySuccessUpdate Approval Workflow
Debugging approval gate failures

Why it happens. When the approval gate is not configured correctly, it can lead to excessive false positives, causing legitimate transactions to be incorrectly flagged for manual review. This often occurs due to overly strict criteria or outdated training data that does not reflect current transaction patterns.

  • Check the current approval criteria and thresholds for flagging transactions.
  • Log the number of transactions being flagged versus those actually requiring manual review.
  • A/B test different approval criteria to see if adjusting thresholds reduces false positives.
The call To fix the issue, adjust the approval criteria to better reflect current transaction patterns, which may lead to a tradeoff in slightly increased risk of false negatives. Monitor the rate of transactions that pass through the approval gate without manual intervention to ensure it remains within acceptable limits.

What it delivers

The human-in-the-loop and approval gate system delivers deployable autonomy. It allows the agent to perform tasks efficiently while ensuring that there is a human backstop for the critical steps where errors could be costly. This setup provides real use, enabling organizations to harness the power of AI while maintaining control over high-stakes decisions.