User: "Delete my dentist appointment"Agent: "**Confirmation Required**The following actions will modify or delete data:- Delete calendar event (ID: evt_abc123)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."
User: "Delete all my tasks"Agent: "**Confirmation Required**The following actions will modify or delete data:- Delete task (ID: task_123)- Delete task (ID: task_456)- Delete task (ID: task_789)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."
def _build_confirmation_message(actions: List[dict]) -> str: """Build a human-readable confirmation message.""" destructive_actions = [ a for a in actions if a.get("tool") in DESTRUCTIVE_TOOLS ] if not destructive_actions: return None lines = ["**Confirmation Required**\n"] lines.append("The following actions will modify or delete data:\n") for action in destructive_actions: tool = action.get("tool", "") args = action.get("args", {}) item_type = DESTRUCTIVE_TOOLS.get(tool, "item") if "event_id" in args: lines.append(f"- Delete {item_type} (ID: {args['event_id']})") elif "task_id" in args: lines.append(f"- Delete {item_type} (ID: {args['task_id']})") else: lines.append(f"- Delete {item_type}") lines.append("\nReply **yes** to confirm, **no** to cancel, or **edit** to modify.") return "\n".join(lines)
User: "Delete my meeting on Friday"Agent: [Searches for meeting, finds event_123]"**Confirmation Required**The following actions will modify or delete data:- Delete calendar event (ID: event_123)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."User: "yes"Agent: [Executes delete_calendar_event(event_id="event_123")]"Event deleted successfully."
User: "Delete the project task"Agent: "**Confirmation Required**The following actions will modify or delete data:- Delete task (ID: task_456)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."User: "no"Agent: "Operation cancelled."
User: "Delete all my tasks"Agent: [Finds 3 tasks]"**Confirmation Required**The following actions will modify or delete data:- Delete task (ID: task_123)- Delete task (ID: task_456)- Delete task (ID: task_789)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."User: "edit"Agent: "Please specify what you'd like to change."User: "Just delete the first task"Agent: [Re-plans with single deletion]"**Confirmation Required**The following actions will modify or delete data:- Delete task (ID: task_123)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."User: "yes"Agent: "Task deleted successfully."
Non-destructive operations execute immediately, only destructive ones wait:
User: "Show my calendar and delete the dentist appointment"Agent: [Executes list_calendar_events immediately]"You have 3 events today:1. Team standup at 9am2. Dentist appointment at 2pm3. Project review at 4pm**Confirmation Required**The following actions will modify or delete data:- Delete calendar event (ID: event_abc)Reply **yes** to confirm, **no** to cancel, or **edit** to modify."User: "yes"Agent: "Event deleted successfully."
The system never deletes without explicit user intent:
User: "I don't need the meeting anymore"Agent: "Would you like me to delete the meeting? Please confirm."User: "yes"Agent: [Triggers confirmation flow]