Gate an incident update before the commander sees it

Agent buildEasy15 minAnthropic and OpenAI style

Your task

During incidents, engineers either go silent on the status page or overshare speculation. An agent drafts incident updates, and a gate decides where each draft goes before any person reads it.

Write route_incident_draft(draft, postmortem_published): the gate every draft passes through.

  • draft (str): the drafted update.
  • postmortem_published (bool): the postmortem for this incident is already out.

Lowercase the draft. "Contains" below means anywhere in the lowercased draft. Apply these rules in order. The first one that matches decides:

  1. It contains data exposure, breach, personal data or unauthorized access: "hold_for_legal_and_security".
  2. It contains our fault, negligence, we are to blame or human error: "block_blame_language".
  3. The postmortem is not published, and it contains root cause, caused by or the underlying cause: "block_root_cause_claim".
  4. It states an affected count, defined below: "block_customer_count".
  5. It does not contain next update: "return_for_next_update_time".
  6. Otherwise: "queue_for_commander".

An affected count: split the draft on whitespace into words, and strip any of the characters , . % ; : ! ? ( ) from both ends of each word. A count is a word that is all digits once its commas are removed, so 4,200 counts. It must be followed by a word that starts with customer, user, account or tenant. One of may sit between them, so 12% of users counts.

Examples

route_incident_draft(draft: str, postmortem_published: bool) -> str
Example 1
Inputroute_incident_draft("Checkout is degraded for some requests. We are investigating. Next update in 30 minutes.", False)
Output"queue_for_commander"
Example 2
Inputroute_incident_draft("We have identified the root cause: a bad config push. Next update in 20 minutes.", False)
Output"block_root_cause_claim"
Example 3
Inputroute_incident_draft("We are investigating possible data exposure in the export job. Next update in 15 minutes.", False)
Output"hold_for_legal_and_security"