Hub / Guides / Human in the loop
Human in the loop
High-impact tools? Gate the action.
Yes. Risky agent actions like deletes, payments, and production changes can wait for a named approver, because we set an approval policy on each tool and an owner on each card. Routine work keeps moving. Paused runs resume where they stopped, and a timeout escalates to one accountable person instead of quietly proceeding.
Why isn't a "don't touch prod" instruction enough?
Because an instruction is a request, and a gate is a rule the runtime enforces. The clearest example is the July 2025 Replit incident, where an agent deleted a live production database during an explicit code freeze and then wrongly reported that rollback was impossible (The Register). Replit later shipped separation between development and production databases (Fast Company).
The user's own summary, as quoted by The Register, is the whole lesson: "There is no way to enforce a code freeze in vibe coding apps." If the only thing between your agent and a destructive call is a sentence in the prompt, you don't have a gate.
Which actions should need a human?
Microsoft's guidance for agents is a good default list. It calls for human-in-the-loop gates on high-impact, irreversible, or sensitive actions: writes, deletes, payments, production changes, and external sends. It also says to authorize every action, not just the start of a session, and to log every tool invocation with the identity used and the rationale (Azure shared responsibility).
That second point matters more than it looks. An agent that was approved at 9 a.m. to "clean up the staging data" shouldn't carry that approval into a production delete at noon. Approval belongs to the action, not to the session.
What do the major frameworks give us today?
More than most teams use. A quick map, from each project's own docs:
- LangChain and LangGraph offer human-in-the-loop middleware with a per-tool
interrupt_onpolicy. The reviewer can approve, edit, reject, or respond, and a checkpointer persists state so a paused run resumes later (LangChain HITL). The docs warn against using "respond" to deny a tool that has side effects. On the server,interrupt(...)pauses a node and resume returns the human's input (LangGraph interrupts). - OpenAI Agents SDK lets you mark a tool
needs_approval, either always or through a per-call function. Pending approvals surface as interruptions, the run state can be serialized, approved or rejected, and resumed, and it works across handoffs and nested agents-as-tools (Python, JS). - CrewAI and AutoGen take a different shape. CrewAI's
human_inputreviews a task's output in the crew loop, and AutoGen'sUserProxyAgentgates inside the conversation itself.
One vendor comparison we read notes that none of LangGraph, CrewAI, AutoGen, or Pydantic AI ships a built-in fail-closed approval timeout or a rule against an agent approving its own request; both are left to your app (comparison). Treat that as a prompt to check your own setup, since the source sells its own product.
What does a working approval gate need?
Four things, and frameworks cover roughly the first two:
- A policy per tool. Every tool is tagged allow, needs approval, or blocked. New tools default to needs approval.
- A durable pause and resume. The run's state survives while the reviewer is away, so approval doesn't mean starting over.
- A timeout with a named escalation. If nobody answers, the request goes to a specific next person. It never quietly proceeds, except for actions you have marked low-risk in advance.
- Exactly one accountable owner. Microsoft's agent center-of-excellence guidance puts it plainly: if two roles are accountable, no one is (CoE roles).
The open-source AgenRACI spec writes the last two down as a charter per action type, with an approver, an on_timeout rule, and a linter that checks for exactly one accountable role (AgenRACI spec). It's a spec and linter, not runtime enforcement, but it's a useful template.
Where should approval live in a multi-agent fleet?
Framework approval lives inside one process. In a fleet, the risky step often crosses agents: one drafts a change, another reviews it, a third merges it. That handoff needs its own record, so the reviewer can see what is waiting, who it's waiting on, and how long it has waited.
In the open-source 0xRay agent kit, each handoff is tagged with a kind, such as ready, reviewer fail, live pass, merge, or CI fail, plus the pull request and commit it applies to. An unacknowledged handoff escalates on the same agent role in three steps, 15 minutes apart by default, and the coordinating agent is woken at the third. Each card carries an accountability field, and the live board flags cards where it's missing. Our guide to map the agentic control plane shows where that record sits next to orchestration and tracing.
How do approval gates fit with release gates?
They guard different moments. An approval gate stops a single risky action at runtime. A release gate stops unfinished work from merging or shipping. You want both, and you want the same named owner to see both on one queue. We cover the merge side in release gates for agents.
What does 0xRay set up for this?
Through AI Fleet OPS, we stand up the open-source agent kit with your team and wire ownership, review gates, and a live work queue. For approval, that means tagging your high-impact tools, setting one accountable owner per action type, and wiring a timeout that escalates to a person instead of proceeding. We don't promise full autonomy; we make sure the risky steps wait for the right human. If you're new to the category, start with what AI fleet ops means.
How do you request a consult?
Email consult@0xray.dev.
What else do operators ask?
What is human-in-the-loop for AI agents?
It's a rule that pauses an agent before a chosen action until a named person approves, edits, or rejects it, then resumes the run.
Which agent actions need human approval?
Start with writes, deletes, payments, production changes, and external sends, following Microsoft's guidance for high-impact or irreversible actions.
What should happen if nobody approves in time?
Escalate to a named next person. Only actions you marked low-risk in advance should ever proceed on timeout.
Can an AI agent be the accountable owner?
We don't recommend it. Agents can do and advise on the work, but keep exactly one accountable human per action type.