Skip to content
All writing
AI Agent

We built an AI agent that texts back when you miss a call

The build story behind our missed-call text-back agent for emergency service businesses, including what live testing broke and what carrier registration really takes.

By Tealfig

Here is a test we ran this weekend: call a business number, hang up before anyone picks up, and start a timer. Four seconds later the phone that placed the call was in a text conversation. The agent asked what was going on, collected the address and timing, saved a qualified lead with a clean summary, and alerted the owner. Later in the same conversation we texted “there’s water all over my floor” and it dropped everything, flagged an emergency, and told a human to call right away.

That agent is now a service we offer: missed-call text-back. This post is the build story, including the parts that only showed up after it went live on a real phone number.

Why missed calls are the expensive ones

For emergency-driven trades like plumbing, electrical, HVAC, and locksmiths, the phone is the business. When a call rings out, the caller does not leave a voicemail. They call the next result on Google, and whoever answers first usually gets the job. Slow follow-up is one of the most expensive habits in small business, which is the same reason we build speed-to-lead automation for web leads. This is the phone version of that problem.

The fix has a simple shape: when the call is missed, text the caller back before they finish dialing your competitor.

What the agent actually does

  1. A call comes in and rings the owner’s phone. If a human answers, nothing else happens.
  2. If nobody picks up, the caller gets a text from the same business number within seconds. That first message is deterministic: no AI sits between the missed call and the text.
  3. The agent then runs the owner’s intake questions one message at a time: what is going on, where are you, how soon do you need someone, who are we texting with. If the caller answers three questions in one message, it does not re-ask them.
  4. When the required answers are in, it writes a lead record with a plain-English summary and notifies the owner.
  5. If at any point the situation sounds like an emergency, the conversation stops being an intake and becomes an escalation: the caller gets an immediate acknowledgment and the owner gets an alert to call now.

The part that matters: deciding what is an emergency

The product is not really chat. It is urgency triage, and we did not trust a single mechanism with that job. There are two layers:

Keywords guarantee. The owner approves a list of emergency signals for their trade (“flooding”, “smell gas”, “sparking”). A hit escalates immediately and deterministically. This layer works even if the AI provider is down, which we verified by running the test suite with the model deliberately failing.

The model catches the rest. The AI reads every message and classifies urgency each turn. It can raise urgency, never lower it, so it cannot talk itself out of a keyword hit. During live testing one of us typed “the waters all over my floor” and the plural broke the keyword match. The model flagged it anyway. That is the whole argument for two layers in one anecdote: keywords cover the phrases you predicted, the model covers the infinite ways real people actually describe a crisis.

For life-safety situations like a gas smell, the agent never composes advice. It sends one fixed, owner-approved message: leave the area, call 911 or your utility, and a human has been alerted.

What going live taught us

Tests passed, personas passed, and then real phones found two bugs in an afternoon.

First, voicemail. The system forwards the call to the owner before declaring it missed, and the owner’s voicemail picked up, which technically “answers” the call. Result: no call ever counted as missed. The fix is a screening prompt on the forwarded leg (“press any key to accept”). A person presses a key and the call connects. A voicemail cannot, so the leg dies and the text-back fires.

Second, and scarier: after a lead was captured we had the agent stop consulting the AI on later messages, to save inference costs on a finished conversation. Then a “finished” conversation turned into an emergency, and the caller got a polite brush-off instead of an escalation. That optimization is gone. Every message gets an urgency read now, permanently, and the regression test that pins this behavior cites the production conversation that found it.

The unglamorous part nobody mentions: compliance

Honest advice for anyone building on SMS: the code is the easy half. US carriers require A2P registration for business texting, and they rejected our first campaign submission twice. What finally cleared review was publishing a page that shows the number alongside the consent language, so a reviewer could verify how callers opt in. Budget real time for this step.

The engine treats compliance as code, not configuration. STOP opts a number out permanently and is checked before every single outbound message. HELP always answers. Non-emergency messages hold during quiet hours and deliver in the morning; emergencies always send. None of that can be disabled by a config file.

The stack

It runs on the same foundation as everything in our AI agents practice: Cloudflare Workers, one Durable Object per conversation keyed by the caller’s phone number, D1 as the system of record, Workers AI behind AI Gateway, and Twilio spoken to with plain HTTP, no SDK. We wrote up the general pattern in how we build production agents on Cloudflare. Operating cost is a few dollars a month, most of it the phone number.

One design rule made the whole thing reusable: nothing in the engine knows it is a plumbing agent. The trade lives in one configuration file: services, intake questions, emergency keywords, escalation wording, business hours. Swap the file and the same engine works for an electrician, a locksmith, or a towing company.

Want this answering your missed calls?

We deploy and manage this for local service businesses, including the carrier registration. Start with the missed-call text-back service page, or book a call and we will look at your call volume together. San Diego businesses can meet us in person; everyone else gets the same build over a screen share.

See what is worth automating first

Book a call and we will map where your hours leak, then rank the fixes by payback.