Human-in-the-loop for agents: pause, approve, and resume without losing state
Threads, approval states, and server checkpoints: pause before a mutation and resume the same thread without losing the tool call.

An agent that asks for confirmation on every turn is not human-in-the-loop. It is a slow chat. What matters in production is pausing before an irreversible action, persisting the full thread, and resuming days later without the model "forgetting" what it was about to do or inventing a new tool call.
This article is the technical piece in the capabilities queue: execution states, threads, and API/CLI operations. For when to pause (risk matrix, approval screen, deadlines), see human approval for AI agents. For permissions and tenant context, see identity, permissions, and limits and multi-tenancy for AI agents.
What pausing without breaking the thread means
The model proposes; the runtime decides. When policy triggers pause or approval, what must be persisted is not a friendly chat line but:
The thread identifier (conversation, tasks, pending tool calls).
An explicit state (
processing,waiting_approval,paused_for_approval,completed,failed, and so on).The action proposal with arguments that will hit your API (tool name, payload, expected effect).
Business context (tenant, user, agent version) for audit.
If you only store text in the LLM history, on resume the model may summarize wrong, repeat the call, or change parameters. The solid pattern is a server checkpoint, not a prompt trick.
Frameworks such as LangGraph popularized interrupts: the graph stops at a node, waits for human input, and continues from the same state. On an agent platform, the equivalent is a thread with API-controlled state transitions.
When to pause (short version)
The full matrix lives in the human approval article. Three rows are enough to connect policy to implementation:
Signal | Example | Implementation |
|---|---|---|
Irreversible or costly mutation |
| Pause → |
Above automatic threshold | Amount over role limit | Same pause; rule lives in code, not the model |
Uncategorized action | Tool not on allowlist |
|
A common mistake is pausing reads while letting writes through without a checkpoint. Another is approving in the UI but executing with credentials the reviewer never saw. The server must re-check role, tenant, and idempotency at execution time, as in from OpenAPI to MCP.
Execution states you should be able to name
You do not need a UML diagram per squad, but a shared vocabulary between product, backend, and ops:
State (illustrative) | Meaning | What a user can do |
|---|---|---|
| Agent runs tools and reasons | Pause manually if needed |
| Sensitive action awaits a decision | Approve, reject, or leave in queue |
| Operational stop (cost, maintenance, review) | Resume when appropriate |
| Normal end with output | Evaluate, audit, bill |
| Error or human rejection | Retry with new input or close |
On Devic, agent threads expose state in the API and CLI (devic agents threads get ). Filtering by state (devic agents threads list --state waiting_approval) supports an approval queue without the chat UI.
Pause does not replace permission: if the agent should not propose delete_customer, the right behavior is deny in the harness, not an infinite approval inbox. OWASP LLM06: excessive agency
Narrative: order ORD-42 and the pending invoice
We reuse the thread from OpenAPI to MCP. The support agent has tenant-scoped get_order and issue_invoice.
The user asks to issue November's invoice for order ORD-42.
The agent calls
get_order("ORD-42")— read-only, stays inprocessing.It proposes
issue_invoice({ orderId: "ORD-42", period: "2026-11" }).Policy requires approval (mutation + money). Runtime moves to
waiting_approvaland does not run the tool.Finance opens the queue, sees the real payload (not a model summary), and approves.
The server executes with the same idempotency key, writes audit, and the thread returns to
processinguntilcompleted.
If nobody approves within 48 hours, the proposal expires: state becomes rejected or failed with a reason, and the agent can suggest escalation in a new turn on the same thread, without duplicating the invoice. That is business idempotency plus thread state, not LLM luck.
Another reviewer can take the same threadId if your product grants approval permission. That is team human-in-the-loop, not private DMs.
Resume from API and CLI (Devic pattern)
Daily ops should not require the web console for every pause. With Devic CLI (illustrative names; check current docs):
In a SaaS integration, wrap the same in your backend: the copilot shows the approval screen; your API calls approve or reject with the reviewer JWT; threadId links UI, audit, and per-tenant billing.
Do not mix the widget chat id with the agent thread without an explicit mapping. A stable threadId enables webhooks, SLAs, and metrics ("time to approval") as in agent traceability.
Same thread from another channel
A user may start in the copilot and ask Finance to confirm from a backoffice link. A sound flow:
The thread stays on the agent runtime (
waiting_approval).Your product issues a signed link with
threadIdand approve-only permission.The reviewer does not continue the chat; they only approve or reject the pending tool.
After approve, the agent resumes with structured tool results in history, not a free-text "done" message.
Copying the chat to email and replying "ok" lets the model interpret anything. A server checkpoint prevents that drift.
Mistakes that block the product
Approve-everything clicks. If the screen hides payload and fired rules, pause is theater. Fix: raw data plus server re-validation.
Losing the thread when the browser closes. Fix: API state; list waiting_approval on return.
Resume without explicit reject. Rejection should return a readable tool result (denied: policy X) for the next step.
Pause without cost awareness. Waiting threads still use storage and sometimes context retention. Define TTL and expiry as in the human approval article.
Human-in-the-loop as the only security control. Combine with tool allowlists, tenant sessions, and sandboxing for code.
Fit in the harness
Human-in-the-loop is one harness piece, not the whole product. Together with tool-call limits, evaluations, and cost per thread, it defines operability. See what an agent harness is.
On Devic, pause and approval share the same thread concept as evaluations and cost: you can automate in CI that a golden path hits waiting_approval when required (a natural follow-up to evaluating agent actions with full trajectories).
Checklist: action → pause → approval → resume
[ ] Sensitive actions have fixed rules that force pause (not "the model asks nicely").
[ ] Persistent
threadIdand API-visible states exist.[ ] Approval UI shows tool + arguments + tenant.
[ ]
approveruns the approved arguments with an idempotency key.[ ]
rejectreturns structured feedback to the agent.[ ] TTL exists; expiry never auto-executes the action.
[ ] Another reviewer can act on the same thread with permission.
[ ] Audit: who, when, which agent version.
[ ] Metrics: % threads waiting, time to decision.
[ ] Product doc link: when to ask for confirmation.
Devic documentation
To configure agents, threads, and CLI operations, see Devic docs (agents, threads create, approve, pause, resume). Match commands to your project version.
Turn your SaaS AI-Native
Get a free trial just by signing up
Latest posts





