Overview
Automatically inspect the working status of all agents every 15 minutes, and immediately alert when slacking, being stuck, or aborting is detected.
Trigger
- Cron: every 15 minutes
- Manual:
task-supervisor check
Inspection process
Step 1: Get the list of active sessions
sessions_list(activeMinutes=20, messageLimit=1)
Step 2: Check one by one
For each agent session:
- Whether active — updatedAt within 15min?
- Whether aborted — lastMessage.stopReason == "aborted"?
- Whether completed — has a group report been sent?
- Whether slacking — received a task but produced no output file?
Step 3: Anomaly classification
| Level | Situation | Action |
|---|---|---|
| 🔴 P0 | session aborted/crash | Resend task + alert |
| 🟡 P1 | No progress for 15min | Send reminder |
| 🟢 OK | Working normally | Do not disturb |
Step 4: Report
Send to the group (accountId=default, target=-1003890797239):
🔍 监工巡检 [HH:MM]
━━━━━━━━━━━━━━
✅ 小quant: [状态]
✅ 小content: [状态]
❌ 小code: [问题] → [处理]
...
Step 5: Automatic handling
- Aborted session: automatically resend the most recent task using sessions_send
- Timed-out agent: send a reminder message
- All normal: stay silent and do not report (do not disturb Daniel)
Key rules
- Do not report when all normal — only alert when a problem is found
- Do not repeat reminders — remind the same agent only once within 15min
- Late-night mode — 23:00-08:00 do not remind, only record
- Concise reporting — ≤200 words, only state the problem and handling