Skip to content
AgenticAIWiki
  1. Learn
  2. Part 6
  3. 32. Designing AI products
  4. 32.3

Lesson 32.3 · 3 of 6 · 5 min read · Reviewed 24 Nov 2026

Human handoff and undo

By the end, you can

  • Design human handoff and undo for AI features.
  • Decide where people must stay in the loop.

Levels of autonomy

Level Example Fits
Suggest Draft a reply for the agent to edit Most new features
Act with approval “Refund 40? [Confirm]” Money, account changes
Act, then allow undo Archive emails, with Undo Low-risk, reversible actions
Act alone Tag tickets by topic Low-risk, high volume, well tested

Move a feature up a level only when evalsEval: A repeatable test that measures how well an AI system performs on a set of cases with defined success criteria. and real use show it’s reliable.

Good handoff

  • A visible “talk to a person” option, not hidden after five failed tries.
  • The human sees the conversation, the facts gathered, and what the AI tried (49.3).
  • The user is told what happens next and how long it takes.

Undo and previews

  • Show the change before it happens (a diff, a summary of the email).
  • Keep drafts rather than sending.
  • Use soft deletes and reversible operations where you can.
  • Log every action with who approved it (chapter 65).

Enforce in code

Approval steps must be enforced by your system (hooks, permissionsPermission rule: An allow, ask or deny rule that controls which tools, commands or paths a coding agent may use., gated tools), not only requested in the prompt (50.3).

Key points

  • Give users an easy way to reach a person, and pass the context along so they don't repeat themselves.
  • Put human approval before high-impact, irreversible actions.
  • Offer undo, drafts and previews so users can recover from AI mistakes.
  • Design the handoff from both sides: the user's experience and the human agent's screen.
Hands-on labRuns in the Playground

Gate risky actions behind approval

Give each AI action the right autonomy level: act with undo, draft, or ask first.

You will have: A level() rule, a run() that enforces it, and a log showing approvals, drafts and one undo.

Steps

  1. Fill in level(): high impact or irreversible means approve; medium means suggest; low and reversible means act with undo.
  2. Make run() refuse approve-level actions until approved, and save suggest-level ones as drafts.
  3. Run every action, then the refund again with approval.
  4. Undo the archived email.

Done when

  • cancel_subscription needs approval.
  • draft_reply is saved as a draft.
  • The undo line restores archive_email.

Open in the Playground No API key needed.

Starter code (Python)
# Give each AI action the right level of autonomy, with previews, approval and undo.
ACTIONS = {
    # name: (reversible, impact)
    "tag_ticket": (True, "low"),
    "archive_email": (True, "low"),
    "draft_reply": (True, "medium"),
    "refund_40": (False, "high"),
    "cancel_subscription": (False, "high"),
}


def level(name):
    reversible, impact = ACTIONS[name]
    # TODO: high impact or irreversible -> "approve"; medium -> "suggest"; low and reversible -> "act+undo"
    return "act+undo"


undo_stack = []


def run(name, approved=False):
    lv = level(name)
    # TODO: if the level is "approve" and approved is False, return "<name>: needs approval (preview shown)"
    # TODO: if the level is "suggest", return "<name>: saved as a draft for review"
    undo_stack.append(name)
    return f"{name}: done" + (" (Undo available)" if lv == "act+undo" else " (approved)")


for a in ACTIONS:
    print(run(a))
Show a solution
# Give each AI action the right level of autonomy, with previews, approval and undo.
ACTIONS = {
    # name: (reversible, impact)
    "tag_ticket": (True, "low"),
    "archive_email": (True, "low"),
    "draft_reply": (True, "medium"),
    "refund_40": (False, "high"),
    "cancel_subscription": (False, "high"),
}


def level(name):
    reversible, impact = ACTIONS[name]
    if impact == "high" or not reversible:
        return "approve"   # preview, then a person confirms
    if impact == "medium":
        return "suggest"   # a draft a person edits and sends
    return "act+undo"      # do it, and offer Undo


undo_stack = []


def run(name, approved=False):
    lv = level(name)
    if lv == "approve" and not approved:
        return f"{name}: needs approval (preview shown)"
    if lv == "suggest":
        return f"{name}: saved as a draft for review"
    undo_stack.append(name)
    return f"{name}: done" + (" (Undo available)" if lv == "act+undo" else " (approved)")


for a in ACTIONS:
    print(run(a))
print(run("refund_40", approved=True))
restored = undo_stack.pop(undo_stack.index("archive_email"))
print("undo restored:", restored)
Quick checkAn AI assistant can cancel customer subscriptions. Which design is safest?
How sure are you?
Pick an answer and how sure you are