04. Agentic Workflows
Human-in-the-Loop and Autonomous Execution
Human-in-the-loop (HITL) pauses agents for approve, edit, or reject before risky actions. Autonomous execution lets the agent run multi-step work alone inside budgets and allowlists. Production systems mix both on a spectrum.
What you will learn
- Define HITL and autonomous execution clearly
- Place products on an execution autonomy spectrum
- Design approval gates in a workflow
- List controls required before raising autonomy
- Answer interview questions with short, solid answers
Definition
Human-in-the-loop means a person is a required step in the control flow for some decisions โ typically approving, editing, or rejecting a proposed action before side effects. Autonomous execution means the agent continues multi-step tool use without asking at every turn, within declared scopes, budgets, and stop rules.
HITL is not โthe model is chatty.โ Autonomy is not โno safety.โ Both are execution policies on top of the same ObserveโThinkโAct machinery.
Introduction
This lesson (#6 in Agentic Workflows) follows Workflow Patterns. Gates and autonomy levels are how you decorate those patterns for production risk.
Next: Error Handling, Recovery and Feedback Loops โ what happens when autonomous steps fail.
Why the mix matters
- Regulated and high-cost actions need humans
- Low-risk reads can run autonomously for speed
- Users trust agents that escalate correctly
- Interviewers expect nuance โ not โfully autonomous AIโ slogans
HITL patterns
Implement HITL as first-class workflow nodes, not informal Slack messages only.
- Approve / deny - binary gate before a tool
- Edit then approve - human fixes args or draft text
- Choose among options - model proposes N plans
- Async review - queue for specialists; agent waits Blocked
- Policy HITL - only trigger when risk score / amount / env matches rules
Autonomous execution
Autonomy is graded. โAutonomousโ in products usually means bounded autonomy: multi-step loops inside allowlists with budgets โ not unrestricted production access.
- L1 Draft - suggestions only; human executes
- L2 Supervised - tools run; HITL on risky calls
- L3 Bounded autonomy - multi-step in scoped tools/budgets
- L4 High autonomy - rare; needs strong ops and compliance
- Always - correlating traces and a kill / pause switch
When to require HITL
- Irreversible deletes, payments, legal sends, prod deploys
- Cross-tenant or admin privilege actions
- Low model confidence or conflicting tool results
- New tools/environments still in soak
- Customer-visible messages in sensitive domains
When autonomy is appropriate
- Read-only research and summarization
- Idempotent retries of safe tools
- Internal sandboxes with cheap blast radius
- Overnight jobs with strict allowlists and spend caps
- After HITL approved a playbook the agent may finish
Designing the hybrid
- Default deny for writes; allowlist reads
- Risk function: tool ร environment ร amount ร confidence
- Timeouts on HITL waits with escalate/cancel policy
- Show humans the proposal, evidence, and blast radius
- Never hide autonomous side effects from audit logs
Program / implementation notes
Model HITL as a Blocking task state with assignee and expiry. Store approval decisions immutably. Feature-flag autonomy level per environment.
- Separate โcan call toolโ from โmay skip HITLโ
- Use dry_run / preview tools before gated writes
- Page on-call if HITL queue backs up critically
- Next: Error Handling, Recovery and Feedback Loops
Advantages and limitations
- Advantage: HITL reduces catastrophic mistakes
- Advantage: autonomy improves speed and coverage
- Advantage: spectrum language beats marketing extremes
- Limitation: HITL adds latency and ops load
- Limitation: rubber-stamp humans stop adding safety
- Limitation: over-autonomy amplifies tool errors
Key points
- HITL = human gate in the control flow before risk.
- Autonomous execution = multi-step action without per-step asks, inside bounds.
- Use a spectrum (draft โ supervised โ bounded โ high).
- Gate irreversible, costly, or low-confidence actions.
- Autonomy still needs allowlists, budgets, traces, kill switch.
- Audit who approved what โ model or human.
FAQs
Is chat feedback the same as HITL?
Only if the workflow actually blocks on that feedback before side effects. Casual chat after the action is not a gate.
Can an autonomous agent still use HITL?
Yes. Many โautonomousโ runs are mostly free until a risk threshold trips a gate.
What if humans approve everything blindly?
Safety collapses. Improve UX with clear diffs/blast radius, sample audits, and reduce unnecessary gates so attention stays on real risk.
How is this different from reactive vs proactive?
Reactive/proactive is about who starts work. HITL/autonomy is about who must approve actions while work runs.
Interview questions
- What is human-in-the-loop in AI agents?
Answer A design where a person must approve, edit, or reject certain agent decisions before side effects execute.
- What is autonomous execution?
Answer Running multi-step tool use without asking the human each time, typically inside allowlists, budgets, and stop rules.
- When should you require HITL?
Answer For irreversible, high-cost, privileged, customer-sensitive, or low-confidence actions โ and while new tools are soaking.
- How do you raise autonomy safely?
Answer Start draft-only, add supervised tools, then bounded multi-step autonomy with evals, spend caps, traces, and a kill switch.
- How is HITL implemented in a workflow?
Answer As a blocking gate node: agent proposes, state becomes waiting-for-human, decision is audited, then execute or revise/reject.
- Are โfully autonomous agentsโ realistic?
Answer Rarely without bounds. Production claims should describe scoped autonomy plus monitoring, not unlimited unsupervised power.
- HITL vs oversight dashboards?
Answer Dashboards observe after or during runs; HITL interrupts the control flow before selected actions. You often need both.
Related topics
Practice task
Complete each numbered practice step in a notebook or doc before opening the next lesson.
- Write one-sentence definitions of HITL and autonomous execution.
- For a refunds agent, list five actions and mark HITL required or not โ justify.
- Draw propose -> HITL gate -> execute/reject with an audit log box.
- Pick an autonomy level (L1โL4) for overnight test-fix and list required controls.
- Answer interview questions 1, 3, and 4 in two sentences each.