0Pricing
AI Agents · Lesson

Human-in-the-Loop Approval Gates

Pause-request-approve patterns for high-stakes agent actions.

When Agents Need Human Approval

For high-stakes actions — sending a contract, deleting production data, spending budget, sending a public announcement — an agent should not act autonomously. It should pause and request human approval before proceeding.

This is the Human-in-the-Loop (HITL) pattern.

Defining High-Stakes Actions

Define a classification function that identifies which actions require human approval. The threshold can be tuned per deployment based on risk tolerance.

HIGH_STAKES_ACTIONS = {
    'send_email',
    'delete_records',
    'publish_content',
    'transfer_funds',
    'modify_production_config',
    'export_all_data',
    'send_push_notification_to_all'
}

HIGH_STAKES_THRESHOLDS = {
    'transfer_funds':    1000,    # USD — require approval above this
    'delete_records':    10,      # rows
    'send_email':        50,      # recipients
    'push_notification': 1000     # users
}

def requires_approval(action: str, parameters: dict) -> bool:
    if action not in HIGH_STAKES_ACTIONS:
        return False
    threshold = HIGH_STAKES_THRESHOLDS.get(action)
    if threshold is None:
        return True   # all instances require approval
    # Check parameter against threshold
    amount = parameters.get('amount') or parameters.get('count') or 0
    return float(amount) >= threshold

All lessons in this course

  1. Immutable Action Logging for Agents
  2. Policy Enforcement for Agent Actions
  3. Regulatory Compliance: GDPR and SOC2
  4. Human-in-the-Loop Approval Gates
← Back to AI Agents