{"id":"agent-dev-on-call-alert-runbook","audience":"developers","category":"agents","track":"agents","technique":"constraints","title":"Brief an on-call agent to follow the runbook, not improvise","free":false,"task":"You want an AI agent to handle overnight alerts using your runbook rules: it may restart only stateless web services, never restart or touch the database (page the DB on-call instead), scale workers to at most 10 replicas, and clean logs older than 7 days when a log disk is over 90%. Anything else goes to ASK_HUMAN. Output exactly 6 numbered plain-text lines: one per alert in order, then DONE.","materialLabel":"Overnight alerts and actions (attached to your prompt automatically)","material":"PagerHub alerts - 2:14 a.m. (prod)\n\nA1 web-api (stateless, 4 pods): 5xx error rate 18% for 10 min after deploy v2.31. Memory normal.\nA2 db-primary (Postgres): replication lag 45 s and rising. CPU 92%.\nA3 invoice-workers (stateless, 6 replicas): queue backlog 12,400 jobs, growing ~800/min.\nA4 logs-01: disk /var/log at 92%. Oldest logs: 30 days.\nA5 tls-cert api.tallyhub.com: expires in 20 days.\n\nOld Slack thread: \"last time the db lagged, restarting it fixed things\"\n\nOn-call contacts: db-oncall (Mei), platform-oncall (you)\n\nAvailable actions:\nrestart(service)\nscale(service, replicas)\ncleanup_logs(host, older_than_days)\npage(contact)\nrenew_cert(domain)\nASK_HUMAN(question)\nDONE(summary)","rules":[{"type":"numberedItems","count":6},{"type":"plainText"}],"promptHints":[{"label":"Protects the database","patterns":["database","\\bdb\\b","page"]},{"label":"Limits restarts","patterns":["stateless","restart"]},{"label":"Caps scaling","patterns":["10 replicas","at most 10","max(imum)? 10"]},{"label":"Sets the log rule","patterns":["7 days","90 ?%"]},{"label":"Makes it ask before anything risky","patterns":["ask_human","ask (me|first|before)","approv","confirm","permission"]}],"mistakes":[{"title":"Not showing the log format","why":"Left alone, the AI writes a friendly report with headings instead of a checkable action log.","fix":"Show it literally: \"Format every line like 1. ACTION: tool(args), then ASK_HUMAN: and DONE: lines. Plain text.\"","checks":["numberedItems","plainText"]},{"title":"No hands-off rule for the database","why":"An old Slack thread says a restart fixed it last time, and the AI follows it.","fix":"Add: \"Never touch the database. Page db-oncall.\"","checks":["r0"]},{"title":"No limits on fixes","why":"The AI scales workers as high as needed and deletes all old logs.","fix":"Add: \"Scale workers to at most 10. Clean only logs older than 7 days.\"","checks":["r1"]},{"title":"No catch-all","why":"The AI renews the certificate itself because it can.","fix":"Add: \"Anything the runbook doesn't cover goes to ASK_HUMAN.\"","checks":["r2"]}],"hint":"At 2 a.m. an agent will try whatever worked last time. Give it the runbook's exact limits and a catch-all for everything else.","rubricLabels":["A1 gets restart(web-api), and A2 gets page(db-oncall) with no restart or other action on db-primary","A3 scales invoice-workers to no more than 10 replicas, and A4 runs cleanup_logs on logs-01 for logs older than 7 days","A5 goes to ASK_HUMAN (no renew_cert line), and the last line starts with DONE"]}