Most reminder examples stop at "send this message later."
This one goes a little further.
The scheduled-reminder-agent example sends an SMS reminder, waits for the user's reply, uses Telnyx AI Inference to classify whether the reply means "snooze" or "acknowledged," and then either marks the reminder done or schedules the next reminder with adaptive timing.
Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/scheduled-reminder-agent
What it does
The app runs on Telnyx Edge Compute with the Telnyx Agent SDK.
The flow:
POST /remind
-> ReminderAgent.scheduleReminder()
-> this.schedule(delay, "sendReminder")
-> Telnyx Messaging sends the SMS
-> user replies by SMS
-> /webhooks/sms
-> ReminderAgent.receiveReply()
-> Telnyx AI Inference classifies intent
-> reminder is acknowledged or snoozed
One actor instance owns one recipient's reminder state.
That means active reminders, snooze count, reply status, and scheduled work live together instead of being split across a webhook server, queue, scheduler, and database.
Agent SDK primitives used
The ReminderAgent extends the Agent SDK Agent class from @telnyx/edge-runtime.
It uses:
-
this.schedule()for durable reminder delivery and reply timeouts -
this.setState()andthis.getState()for per-phone-number reminder state -
this.env.TELNYX.messages.send()for SMS -
this.env.TELNYX.ai.openai.chat.createCompletion()for snooze detection
The [telnyx] binding in telnyx.toml gives the function a pre-authenticated Telnyx client:
[telnyx]
binding = "TELNYX"
So the application code does not hardcode an API key.
Main routes
-
POST /remindschedules a new SMS reminder -
POST /webhooks/smsreceives Telnyx inbound SMS replies -
POST /cancelcancels a pending reminder -
POST /debug/remindschedules a short test reminder -
POST /debug/replysimulates an inbound SMS reply -
GET /debug/stateinspects actor state -
GET /health/livenessandGET /health/readinessare health checks
Try it
After deploying with telnyx-edge ship, schedule a reminder:
curl -X POST https://scheduled-reminder-agent-<id>.telnyxcompute.com/remind \
-H "Content-Type: application/json" \
-d '{
"to":"+15551230000",
"from":"+15559870000",
"message":"Time for your meeting",
"delay_minutes":5
}'
Then simulate a snooze reply:
curl -X POST https://scheduled-reminder-agent-<id>.telnyxcompute.com/debug/reply \
-H "Content-Type: application/json" \
-d '{
"from":"+15551230000",
"text":"snooze for 2 hours"
}'
Inspect the state:
curl "https://scheduled-reminder-agent-<id>.telnyxcompute.com/debug/state?from=+15551230000"
Adaptive snoozing
If the user says something specific like "snooze for 2 hours," the model extracts that delay.
If the user just says "later" or "not now," the agent uses exponential backoff:
30 minutes -> 1 hour -> 2 hours -> 4 hours -> 8 hours
That makes the reminder less repetitive over time.
Production notes
Before using this in production, I would add:
- webhook signature verification
- SMS opt-out and consent handling
- timezone-aware scheduling
- idempotency for reminder creation and outbound sends
- retry handling for failed SMS delivery
- max snooze and escalation rules
- PII-safe logs and retention policies
But as a starter pattern, this is a clean way to build scheduled agent workflows on Edge Compute.
Resources:
- Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/scheduled-reminder-agent
- Agent SDK docs: https://developers.telnyx.com/docs/agent-sdk
- Agent SDK quickstart: https://developers.telnyx.com/docs/agent-sdk/quickstart
- Edge Compute docs: https://developers.telnyx.com/docs/edge-compute
- Messaging docs: https://developers.telnyx.com/docs/messaging
- Telnyx AI Inference docs: https://developers.telnyx.com/docs/inference
- Telnyx AI skills and toolkits: https://github.com/team-telnyx/ai
Top comments (0)