Library

Volume 2 · Agentic AI Systems

Notebook
Sign in

Section 31

Human-in-the-Loop Controls

724 words · about 3 min

31.1 Action Classification Framework

Action Type Risk Level Approval Examples
Read-only None Auto-approved Query logs, check metrics, read configs
Diagnostic Low Auto-approved Run diagnostic scripts, trace requests
Reversible Medium Approval required Scale up/down, restart pods, toggle feature flags
Irreversible High Multi-approval Delete resources, modify production data, rollback deployments
Critical Very high Named approver / incident commander only Database migrations, network changes, DNS updates

31.2 Approval Gateway Implementation

class ActionApprovalGateway:
    def classify_risk(self, action: "AgentAction") -> "RiskLevel":
        """Classify action risk based on type, scope, and context."""
        if action.is_read_only():
            return RiskLevel.NONE
        if action.scope == "production" and action.is_destructive():
            return RiskLevel.HIGH
        if action.is_reversible():
            return RiskLevel.MEDIUM
        return RiskLevel.HIGH

    async def request_approval(self, action: "AgentAction") -> bool:
        """Route approval based on risk level."""
        risk = self.classify_risk(action)
        if risk == RiskLevel.NONE:
            return True
        if risk == RiskLevel.MEDIUM:
            return await self.notify_and_wait(action, timeout=300)
        return await self.require_explicit_approval(action)

31.3 Confidence-Based Autonomy

  • The agent reports a confidence score (0-1) alongside every proposed action.
  • High confidence (>0.9) + low risk → auto-execute.
  • Low confidence (<0.7) or high risk → human review.
  • Medium confidence → execute with automatic rollback capability armed.
Agent detects issue
  │
  ├── Confidence > 90% + Low Risk → Auto-remediate
  │     └── If auto-remediation fails → Escalate to on-call
  │
  ├── Confidence > 70% + Medium Risk → Propose with 5-min auto-approval window
  │     └── If no response → Escalate to on-call
  │
  └── Confidence < 70% or High Risk → Direct escalation to on-call
        └── If no response in 15 min → Escalate to manager

31.4 Autonomy Is Earned, Not Granted — Maturity Ladder

For regulated or high-consequence domains, autonomy should be rolled out in stages, with continuous comparison against human baseline performance before advancing:

Level 0 — Shadow Mode:        Agent runs in parallel with humans; no actions taken; outputs compared.
Level 1 — Suggestion Mode:    Agent suggests, human approves every single action.
Level 2 — Batch Approval:     Agent queues low-risk actions for batch human approval.
Level 3 — Auto-Execute + Audit: Agent auto-executes low-risk/high-confidence actions; full audit trail; human reviews exceptions.
Level 4 — Full Autonomy:      Reserved for well-understood, low-risk, high-volume tasks; continuous monitoring; instant rollback.

Safety invariants that never relax, regardless of autonomy level: sensitive-data access is always logged; financial or otherwise high-stakes actions above a defined threshold always require human approval; confidence below threshold always routes to a human; every agent action is reversible or has an explicit rollback procedure.

31.5 Governance Table Example

Action Approval Required Rationale
Suggestion/recommendation display None Read-only, advisory
Auto-submit low-risk batch item Batch approval Low individual risk, high volume
Submit a formal/legal document Individual approval Legal/compliance exposure
Update a sensitive record Individual approval Sensitive-data modification
Change domain rules/config Manager + compliance sign-off System-wide impact
Deploy a model update Architecture review board Production risk

Section 31 — Interview Q&A

Q1: How would you design an approval workflow that doesn’t become a bottleneck at scale? Route by risk tier, not uniformly: auto-approve read-only/diagnostic actions entirely; batch-approve reversible, low-risk actions (a human reviews 50 items at once rather than 50 separate approvals); reserve individual, synchronous approval only for irreversible or high-blast-radius actions. Add a timeout-driven escalation path so an unanswered approval doesn’t silently stall the agent — it escalates to the next tier (on-call → manager) automatically.

Q2: How do you build trust with users/operators who don’t yet trust an autonomous agent? Start at “Suggestion Mode” — the agent proposes and explains its reasoning, but a human makes every decision. Track agreement/override rates as a trust metric. As the agreement rate stabilizes above a threshold over a meaningful sample size, graduate specific, narrow action classes to batch approval, then to auto-execute-with-audit. Never skip straight to full autonomy — and always keep a fast, obvious path to roll autonomy back down a level if a failure occurs.

Q3: What safety invariants should never be relaxed even at the highest autonomy level? Sensitive-data access logging, a hard dollar/impact threshold above which human approval is mandatory regardless of confidence, a hard floor on model confidence below which the action always routes to a human, and a guarantee that every action taken either is reversible or has a tested rollback procedure. These are architectural constraints, not configuration — they should be enforced at the gateway layer, not left to the agent’s own judgment.