By Oliver · AI Architect, BuildAClaw · November 8, 2026 · 9 min read
How to Build an AI Agent That Phones You When It Gets Stuck Instead of Silently Stalling
A crashed agent is easy to spot. A stalled one looks fine for 11 hours. Here is the stuck-detection and escalation setup we run on local Mac Mini M4 agents.
The worst agent failure I have seen was not a crash. It was a login prompt. An invoice-chasing agent hit a re-authentication screen at 6:40 PM on a Thursday, retried the same click, got the same result, and then sat there until 7:15 the next morning. Nothing errored. The process was alive and the dashboard was green. Fourteen invoices went unsent because the agent never told anyone it was blocked.
That is the failure mode this article fixes. Agents that crash are loud. Agents that stall are quiet, and quiet failures cost more because nobody is looking. We now build every agent with the same rule: if it cannot make progress, it must interrupt a human, on a channel the human actually notices.
Our numbers across 9 local agent deployments:
- Median silent-stall time before alerting: 9 hours 20 minutes
- Median stall time after adding the ladder below: 7 minutes to first alert
- Share of stalls caused by one of five blockers: 81% (auth expiry, rate limit, missing input, UI change, ambiguous instruction)
In our lead research of 138 OpenClaw users, setup and integration pain dominated. Stalls are the downstream version of that pain. An integration breaks quietly, and the agent has no way to say so. Let's build one that can.
1. Define "stuck" With Numbers, Not Vibes
You cannot alert on stuck until you can measure it. Activity is not progress. A looping agent is very active: it burns tokens, calls tools, and writes logs. So you measure progress, which means a state change you care about.
We use three detectors. Any one of them fires the alert path:
- Checkpoint timeout. The agent writes a checkpoint (task closed, file saved, message drafted) after each meaningful step. If no checkpoint appears within 3x the p95 step time, it is stuck. For a step that normally takes 90 seconds, that is 4.5 minutes.
- Repeat detector. Hash each tool call (name plus arguments). If the same hash appears 3 times in a row, the agent is looping. Stop it on the third.
- Confidence floor. Ask the model to emit a self-rating (1-5) with each plan step. Two consecutive ratings of 2 or below mean it is guessing. This catches ambiguous instructions that never throw errors.
The detectors live outside the agent loop. This matters. A stuck agent cannot be trusted to notice it is stuck, any more than a person in a loop can. Run the watchdog as a separate process on the same Mac Mini, reading the agent's checkpoint file every 30 seconds. A launchd job with StartInterval set to 30 is enough.
Key insight: The watchdog must be dumber than the agent. No LLM, no retries, no cleverness. A 60-line script that compares timestamps will outlast any prompt you write.
2. Build the Escalation Ladder (So You Don't Learn to Ignore It)
If every hiccup phones you, you will mute the number within a week. I did it myself. Early on I sent every stall as a push notification, got 23 alerts in two days, and started swiping them away. Alert fatigue is a reliability bug.
The fix is a ladder where each rung is louder and rarer:
| Rung | Trigger | Channel | Expected response |
|---|---|---|---|
| 0 | Agent self-reports a blocker | Telegram or WhatsApp message | Reply within the hour |
| 1 | Watchdog fires, no reply in 10 min | SMS | Reply within 15 min |
| 2 | No reply in 20 min, or severity is high | Automated phone call | Answer and say a keyword |
| 3 | No answer to call in 15 min | Call a backup person | Anyone takes ownership |
Severity is set per task, not per error. A stalled newsletter draft is rung 0 and stays there. A stalled payment-reconciliation run starts at rung 1. A stalled customer-facing reply during business hours starts at rung 2. You decide this once, in a config file, and the agent never has to judge it live.
Quiet hours and acknowledgment
Add two rules. First, quiet hours: between 10 PM and 6 AM, only severity-high tasks may escalate past SMS. Second, acknowledgment stops the ladder. Any reply, even "looking", pauses escalation for 30 minutes. Without that, you will answer the SMS and still get a phone call 5 minutes later, which feels broken.
3. Write Alerts You Can Answer in One Word
A bad alert says "Agent stalled." It forces you to open a terminal, read logs, and rebuild context. A good alert lets you resolve the problem from your phone while standing in line for tacos.
Every alert carries four fields, generated by the agent when it self-reports and by a template when the watchdog fires:
- What I was doing: "Sending Thursday's overdue invoice batch (14 of 14 remaining)."
- What I tried: "Clicked Send 3 times. Page returned a login screen."
- The blocker: "Accounting session expired."
- My recommendation, with replies: "Reply
1to wait for you to re-login,2to retry in 1 hour,3to skip these 14 and continue."
That last field is the one most people skip, and it is the one that makes the alert cheap to answer. Constrain replies to a short keyword list. Parse the reply with plain string matching, not another model call. If the reply does not match, send the options again rather than guessing.
For voice calls, keep the script under 20 seconds. "Your invoice agent is blocked. Accounting login expired. Press 1 to wait, 2 to retry in an hour, 3 to skip." Digit presses come back as a webhook to your Mac Mini, which routes them to the agent. No transcription, no ambiguity.
Reply-time data from our test runs (112 alerts):
- Vague alert ("agent stalled"): median 41 minutes to resolution
- Four-field alert with numbered replies: median 4 minutes to resolution
- Phone call with digit press: median 90 seconds from ring to decision
4. Wire It Up on a Mac Mini M4 (Local-First)
Here is the architecture. Everything that touches your data stays on your machine. Only the alert text leaves.
- Agent process: OpenClaw running your model of choice locally, such as Llama 4 Scout or Gemma 4 for routine steps. It writes checkpoints to
~/agents/state/checkpoint.jsonafter every completed step. - Watchdog process: a small script under
launchdthat reads the checkpoint file every 30 seconds, runs the three detectors, and writes anincident.jsonwhen one fires. - Notifier process: reads
incident.json, walks the ladder, and sends via your chat bot, an SMS API, and a voice API. Twilio is the common choice for SMS and voice. The call is one HTTPS request. - Reply listener: a tiny local HTTP endpoint behind a tunnel that receives SMS replies and digit presses, then writes the decision to
decision.jsonfor the agent to pick up.
The agent only needs one new behavior: before each step, read decision.json. If a decision is waiting, apply it (wait, retry, or skip) and clear the file. That is the entire contract between human and agent.
Why local matters here
A cloud-hosted agent platform can alert you, but the stall detection runs on their schedule and the logs live on their servers. With a Mac Mini M4 on your desk, the watchdog polls every 30 seconds, you own the incident history, and no task data leaves the building. The Mac Mini idles at roughly 5-7 watts, so running three always-on helper processes costs a rounding error. The only recurring cost is the telephony: in our setups, about $2 to $6 per month at a few alerts a week.
5. Prevent the Five Stalls That Cause 81% of Pages
Detection is the safety net. The best alert is the one that never fires. Our five most common blockers, and the preventive fix for each:
- Auth expiry. Add a preflight check at the start of every run that hits a cheap authenticated endpoint. Fail in the first 10 seconds, not at step 40. Alert on tokens expiring within 48 hours.
- Rate limits. Teach the agent to read
Retry-Afterheaders and sleep. If the wait exceeds 15 minutes, send a rung-0 message instead of sitting silent. - Missing input. If a task needs a file or answer the agent does not have, it should ask on step one, not discover the gap on step nine.
- UI changes. For browser tasks, store a screenshot hash of the key page. A mismatch is a likely layout change, so report it before clicking blindly.
- Ambiguous instructions. This is the confidence-floor detector's job. If the model rates its own plan 2 out of 5 twice, it asks you instead of improvising.
If you want a broader plan for what happens after the alert, including who owns the fix and how you roll back a misbehaving model, read our guide on writing your AI worker's incident playbook. Stuck-detection tells you something is wrong. The playbook tells you what to do next. You can also browse the full Clawticles library for related setup and reliability guides.
Rule of thumb: Every time you get paged, ask whether the agent could have caught it earlier. If yes, add a preflight check. After about 6 weeks, our alert volume dropped by roughly two-thirds from this habit alone.
6. Test the Alarm Before You Need It
An untested alert path is a hope, not a system. Before you trust any agent with real work, run these three drills. Together they take about 30 minutes.
- The frozen-agent drill. Send
kill -STOPto the agent process. Confirm the watchdog fires within your timeout and the first message arrives on your phone. - The loop drill. Give the agent an impossible task, such as clicking a button that does not exist. Confirm the repeat detector halts it on the third identical call, not the thirtieth.
- The ignore drill. Leave the first alert unanswered. Confirm the ladder climbs to SMS, then to a phone call, then to your backup contact on schedule.
Run the drills again after every major change, including model swaps. When we moved one deployment between local models, the checkpoint format shifted slightly and the watchdog silently stopped matching. The drill caught it in a minute. A real incident would have caught it at 2 AM.
Frequently Asked Questions
How do I know if my AI agent is stuck and not just working slowly?
Track progress, not activity. Log a checkpoint each time the agent completes a meaningful step. If no checkpoint lands within 2-3x the normal step time, or the same tool call repeats 3 times with identical arguments, treat the agent as stuck.
Can a local AI agent on a Mac Mini actually place a phone call?
Yes. The agent runs locally, and the alert is a single outbound request to a telephony provider such as Twilio. Only a short alert message leaves the machine. Your files, credentials, and task data stay on your hardware.
Should every stuck agent trigger a phone call?
No. Use an escalation ladder. Send a chat message first, an SMS after 10 minutes of silence, and a phone call only for high-severity stalls or after you ignore two earlier alerts. This keeps alert fatigue low.
What should the agent say when it alerts me?
Four things: what it was doing, what it tried, the exact blocker, and the options it recommends. A good alert lets you reply with one word, like "skip" or "wait", instead of opening a terminal.
Want Agents That Tell You When They're Stuck?
BuildAClaw sets up local, OpenClaw-powered agents on your own Mac Mini M4, with watchdogs, escalation ladders, and phone alerts already wired in. No cloud dependency, no silent stalls, and no 7 AM surprises. We will map your highest-risk workflows and have your first alerting agent running in days.
Schedule a Free Strategy Call →