Human-in-the-Loop Design Patterns
When should an AI agent pause and ask a human? Approval gate patterns, confidence thresholds, irreversible action checks, and copy-paste implementation code for SOC agent workflows.
🚦 The Core Decision — When Must an Agent Stop?
Four triggers that must always pause an agent
📋 SOC Action Classification — Autonomous vs Approval Required
| Action Category | Example Actions | HITL Requirement | Approval Level |
|---|---|---|---|
| Read-only analysis | Query SIEM, fetch asset info, look up IOC, pull user activity | Fully autonomous | None |
| Enrichment | VirusTotal lookup, WHOIS query, Shodan search, threat intel lookup | Fully autonomous | None |
| Alert triage verdict | True positive / false positive / escalate recommendation | Autonomous at 0.90+ | None if high confidence |
| Ticket creation | Create Jira ticket, ServiceNow incident, email notification | Soft approval | Analyst reviews before send |
| Reversible isolation | Network isolation (if easily reversed), session kill, token revocation with self-service restore | Approval required | L1 analyst approval |
| Firewall / EDR action | Block IP, add to blocklist, quarantine host, kill process | Always approve | L2 analyst or SOC lead |
| Account action | Disable user account, reset password, revoke MFA | Always approve | SOC lead + HR notification |
| Data action | Delete file, move to quarantine vault, wipe endpoint | Always approve | CISO or delegate |
| External communication | CERT-In notification, customer breach notification, law enforcement contact | Always approve | CISO + Legal |
🔧 HITL Gate Pattern Catalogue
Pattern 1 — Synchronous Approval Gate
Agent pauses execution completely and waits for explicit human approval before continuing. Suitable for high-stakes actions where latency is acceptable. The agent holds state until a response is received or a timeout triggers escalation.
Pattern 2 — Asynchronous Approval with Callback
Agent submits an approval request, saves its state, and terminates. When the analyst approves, a webhook resumes the agent from where it left off. Better for long-running workflows where analysts cannot be expected to respond within seconds.
Pattern 3 — Tiered Auto-Escalation
Different action types route to different approval tiers automatically. Low-risk approvals go to any available L1 analyst. High-risk go to SOC lead. Critical go to CISO. Timeout at each tier escalates to the next.
💬 Slack Approval Workflow
The most practical HITL channel for SOC teams — analysts are already in Slack. Interactive buttons let them approve or reject without leaving the chat. Full implementation below.
📊 Approval Queue Dashboard
A dedicated approval queue page in your SOC dashboard. Analysts see all pending approvals, their context, countdown timers, and can approve/reject with one click. Build with your existing SIEM portal or as a standalone page.
${JSON.stringify(a.action.args, null, 2)}No pending approvals
'; } async function decide(approvalId, decision) { const analyst = getCurrentUser(); // Your auth system await fetch(`/api/approvals/${approvalId}/decide`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({decision, analyst}) }); loadApprovalQueue(); // Refresh } // Poll every 10 seconds setInterval(loadApprovalQueue, 10000); loadApprovalQueue();📏 Confidence Thresholds by Action Type
Define the minimum confidence score required for autonomous action per action category. These are starting recommendations — tune based on your false positive history.
| Action Type | Min Confidence for Autonomous | Below Threshold | Reasoning |
|---|---|---|---|
| Alert triage (recommend only) | 0.80+ | Present to analyst as uncertain | Low consequence — analyst reviews recommendation |
| IOC enrichment lookup | Any | Always autonomous | Read-only, no consequence |
| True positive determination | 0.90+ | Escalate to L1 for review | Drives containment actions — needs high confidence |
| Block single IP (known malicious) | 0.92+ | Queue for L1 approval | Reversible but may block legitimate traffic |
| Quarantine endpoint | 0.95+ | Always require L1 approval | Significant business impact if false positive |
| Disable user account | Never autonomous | Always require L2 approval | HR, legal, and business impact |
| CERT-In notification draft | 0.88+ for draft only | Human writes from scratch | Agent drafts, human sends after review |
| Delete file / wipe endpoint | Never autonomous | Always require CISO approval | Irreversible data loss |