Scenario-Based AI Engineering Questions

Course Content

Scenario-Based AI Engineering Questions

26 sections · 146 lessons

Your autonomous AI agent books meetings, sends emails, and updates CRM entries. One hallucinated action accidentally emails the wrong customer. How do you add approval, rollback, and safety layers to autonomous AI agents?


The policy table the model never gets a vote onauto-runrun withundo, cappedhuman approvalapproval plus limitsSmall blast radiusLarge blast radiusReversibleIrreversible or externalA sent email has no compensating action, so it lands in the bottom row by definition.
Classifying by reversibility and reach turns "is this important?" into a rule that code can enforce.

What you need to know

Classify actions, not the agent

"Is this action important?" is too vague. Two concrete questions work better: can it be undone, and how much can it affect?

Small blast radiusLarge blast radius
ReversibleUpdate an internal CRM field — auto-runBulk-update 500 CRM records — run with undo and a cap
Irreversible or externalSend one email — approvalEmail a whole segment — approval plus limits

This table lives in code. The model can ask for an action; it cannot decide whether that action needs permission.

Python
POLICY = {    "crm.update_field": "auto",    "crm.bulk_update":  "auto_with_undo",    "calendar.book":    "approve",    "email.send":       "approve",}def execute(action, args, run):    tier = POLICY.get(action, "approve")                    # unknown tools need approval    if tier == "approve":        return approvals.request(action, args, reason=run.reasoning, sources=run.sources)    before = snapshot(action, args)    result = TOOLS[action](**args, idempotency_key=run.step_id)    action_log.write(run.id, action, args, before, result, undo=COMPENSATE[action])    return result

Unknown tools fall into the approval tier by default. The idempotency key stops a retry from doing the same thing twice.

If a tool has no compensating action — a sent email cannot be unsent — it belongs in the approval tier by definition.

Approval that people actually read

Show the exact payload: recipient, subject, body. Add the agent's reasoning and the sources it used. Let the reviewer edit, not only approve or reject, and expire requests nobody answers.

The fix for this incident

  1. Delayed outbound queue — hold every email for 60 seconds with a visible "Undo send". Cheap, and it stops many wrong-recipient mistakes.
  2. Deterministic entity resolution — before sending, look up the customer named in the task in the CRM yourself, and assert the recipient address belongs to that record. A mismatch blocks the send.
  3. Blast-radius limits — maximum sends per run, per-tool rate limits, a spending cap and a kill switch.
  4. Volume alerts — an agent sending 12,000 emails should trip an alarm long before it finishes.

The wrong-customer email is an entity-resolution bug. It deserves a database check, not a better prompt.

A real-life example

Scenario, numbers made up. A sales team's agent follows up on meetings. Asked to "send the revised quote to Sharma Textiles", it picks the contact for "Sharma Traders", a different customer, and emails a confidential price sheet.

The team adds three things. A recipient check compares the email's domain and contact id against the CRM account named in the task; in the first month it blocks 14 sends. A 60-second undo window catches 6 more mistakes spotted by humans. Bulk actions are capped at 50 per run. The next quarter has zero wrong-recipient emails, and approval requests fall to one in eight actions because internal CRM updates stay on auto.

Follow-up questions to expect

  • "Won't approvals annoy users?" — Only irreversible actions need them. Track the override rate per action type; when humans approve almost everything unchanged for weeks, move that action to auto with undo.
  • "What goes in the action log?" — Run id, tool, arguments, before-state, after-state, who approved, and the compensating action. That makes rollback and audits possible.
  • "How is this different from a saga?" — It is the same idea: a sequence of steps where each step has a registered undo, so a partial failure can be rolled back step by step.