Cap a queue agent's actions by rollout phase
Your task
Your support queue sometimes blows through its response targets (service level agreements, or SLAs) before anyone notices. An agent predicts breaches, and its autonomy grows with each rollout phase the team approves.
Write decide_queue_action(phase, minutes_to_breach, minutes_since_alert, human_acked): the rule your agent follows for each ticket at risk.
phase(str): the rollout phase, such as"shadow".minutes_to_breach(int): predicted minutes until the ticket breaches its SLA. It may be negative.minutes_since_alert(int): minutes since the agent first alerted on this ticket.human_acked(bool): a person has acknowledged the alert.- Return
"log","alert","reprioritize"or"page". They form a ladder in that order, from least action to most.
Rules:
- The phase sets a cap on the ladder:
shadowcaps at"log",alertat"alert",assistat"reprioritize"andautonomousat"page". Phases match exactly, and any other phase, an empty one included, caps at"log". - The signal sets the action the agent wants. The first match wins:
minutes_to_breachabove 60:"log".human_acked:"alert".minutes_to_breachat most 15 andminutes_since_alertat least 15:"page".- Otherwise:
"reprioritize".
- Return the lower of the wanted action and the cap.
Examples
decide_queue_action(phase: str, minutes_to_breach: int, minutes_since_alert: int, human_acked: bool) -> strExample 1
Input
decide_queue_action("shadow", 10, 30, False)Output
"log"Example 2
Input
decide_queue_action("assist", 40, 5, False)Output
"reprioritize"Example 3
Input
decide_queue_action("autonomous", 10, 30, False)Output
"page"