A lot of AI support demos stop after one reply.
Customer asks a question. Model answers. Demo done.
Real support usually needs a little more than that. You need message history, background processing, a way to send the reply, and sometimes a follow-up if the customer goes quiet.
This example builds that flow as an SMS support agent on Telnyx Edge Compute.
Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/sms-support-agent-with-followup
The app receives inbound SMS messages, routes each sender to a durable Agent SDK actor, calls Telnyx AI Inference, sends a reply through Telnyx Messaging, and schedules a 24-hour follow-up.
The flow:
Inbound SMS
-> /webhooks/sms
-> SupportAgent.receive()
-> this.messages.add()
-> this.queue("process")
-> Telnyx AI Inference
-> Telnyx Messaging reply
-> this.schedule(24h, "followup")
The important part is that the webhook does not need to wait on the LLM. It stores the message and queues the work, so the webhook can acknowledge quickly.
The SupportAgent
extends the Agent SDK Agent
class from @telnyx/edge-runtime
.
It uses:
this.messages.add()
for durable conversation historythis.messages.toOpenAI()
to format history for the modelthis.queue("process")
for background AI processingthis.schedule(86400, "followup")
for the next-day check-inthis.setState()
and this.getState()
for sender/recipient statethis.env.TELNYX
for zero-credential Telnyx API accessThe [telnyx]
binding in telnyx.toml
handles API auth:
[telnyx]
binding = "TELNYX"
Then the agent can call:
await this.env.TELNYX.ai.openai.chat.createCompletion(...)
await this.env.TELNYX.messages.send(...)
No API key is hardcoded in the application code.
POST /webhooks/sms
receives Telnyx message.received
webhooksPOST /debug/message
simulates an inbound SMS for testingGET /debug/state
inspects an actor state for a senderGET /health/liveness
and GET /health/readiness
are health checksAfter deploying, you can simulate an inbound SMS:
curl -X POST https://sms-support-agent-<id>.telnyxcompute.com/debug/message \
-H "Content-Type: application/json" \
-d '{
"from":"+15551230000",
"to":"+15559870000",
"text":"How do I send an SMS?"
}'
Response:
{
"action": "queued",
"from": "+15551230000",
"to": "+15559870000"
}
For real SMS, set your Telnyx Messaging Profile webhook URL to:
https://sms-support-agent-<id>.telnyxcompute.com/webhooks/sms
Then text the Telnyx number.
The follow-up task runs 24 hours later.
It checks the last message in the durable conversation history. If the last message is still from the assistant, the customer has not replied since the AI answer, so the agent sends:
Did that solve your problem? Reply yes or no, or ask for a human.
If the customer already replied, it skips the nudge.
That is the piece I like. The agent is not just a stateless webhook. It has memory and scheduled work.
Before shipping this pattern in a real support workflow, I would add:
But as a starter pattern, this is a clean way to build an AI support agent that can answer, remember, and follow up.
Resources: