Prompt

How do I create a human-in-the-loop approval step for agent actions?

Artificial Intelligence / AI Agents1 observationLast seen Oct 9, 2026

Latest observation

Oct 9, 2026OpenAI APIWeb search: off

A good human-in-the-loop approval step usually looks like this:

  1. Agent proposes an action
  2. System pauses
  3. A human reviews details
  4. Human approves / rejects / edits
  5. System continues with the approved action

Core design

1) Make actions explicit and structured

Don’t let the agent execute free-form text. Have it emit a structured “proposed action,” for example:

{
  "type": "send_email",
  "to": "customer@example.com",
  "subject": "Order update",
  "body": "Your order has shipped."
}

This makes it easy to display to a reviewer and to safely execute only after approval.

2) Insert a checkpoint before execution

When the agent wants to act, route it to an approval queue instead of directly running the action.

Typical flow:

  • Agent generates action proposal
  • Save proposal in database
  • Notify reviewer
  • Wait for decision
  • On approval, execute action
  • On rejection, stop or ask agent to revise

3) Give humans enough context

Show:

  • The proposed action
  • Why the agent wants to do it
  • Relevant input/context
  • Risk level
  • Potential side effects
  • A way to edit fields before approval

4) Support three outcomes

The reviewer should be able to:

  • Approve: execute as-is
  • Reject: discard or ask the agent to try again
  • Edit: modify the proposal, then approve

5) Log everything

Store:

  • Proposed action
  • Who reviewed it
  • Timestamps
  • Final decision
  • Executed payload
  • Result / errors

This is important for auditing and debugging.

Recommended architecture

A simple pattern is:

  • Agent
    • plans action
  • Policy layer
    • decides whether approval is required
  • Approval service
    • stores pending actions
    • presents them to humans
  • Executor
    • runs only approved actions

Pseudocode example

def handle_agent_action(action):
    if requires_approval(action):
        ticket_id = save_pending_action(action)
        notify_reviewer(ticket_id)
        decision = wait_for_human_decision(ticket_id)

        if decision.status == "approved":
            return execute_action(decision.action or action)
        elif decision.status == "edited":
            return execute_action(decision.edited_action)
        else:
            return {"status": "rejected"}
    else:
        return execute_action(action)

Good approval triggers

Use human approval for:

  • Sending emails/messages
  • Changing customer/account data
  • Refunds or financial transactions
  • Deleting records
  • External API calls with side effects
  • Anything irreversible or high impact

Useful safeguards

  • Set thresholds: “approve if amount > $100”
  • Require 2-person approval for sensitive actions
  • Show diffs for edits
  • Add timeouts and escalation
  • Allow “approve once / always approve similar actions” only with care

Example UI fields

  • Action type
  • Target resource
  • Proposed parameters
  • Risk score
  • Explanation
  • Approve / reject / edit buttons

If you want, I can also give you:

  1. a LangChain/LangGraph approval-step example,
  2. a FastAPI + queue implementation, or
  3. a database schema for pending approvals.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.