AgendaBot
In DevelopmentASP.NET Core backend where an AI agent books barbershop appointments over WhatsApp
Role: Backend developer
Solo · Since Oct 2026 · Public repo
A .NET backend for the way many small businesses in the Dominican Republic actually take bookings: by hand, over WhatsApp. An LLM agent reads the customer's message, checks real availability, proposes a slot and books it only after the customer says yes. A background job sends a reminder the day before.
Problem
Letting a language model write to a calendar is risky: it can double-book, invent a free slot, or confirm something the customer never agreed to. And a WhatsApp webhook has to answer Meta fast, survive retries and keep the LLM bill under control.
Solution
The agent's write tools only leave a pending proposal; the server executes it only if the customer wrote something after it, so the model can't propose and confirm on its own. Bookings run in a serializable SQL Server transaction. The webhook verifies Meta's signature, deduplicates by message id and hands the slow work to a background queue.
Not done yet
There is no hosted demo. The agent needs SQL Server and a Gemini key, and I found no free place to run both, so the recording on this page is the demo. You can run the same chat locally with docker compose and the sample barbershop seed.
Architecture highlights
- Double-booking test fires 8 identical bookings in parallel against a real SQL Server: with Serializable exactly 1 wins; with ReadCommitted all 8 got in
- The two-turn confirmation rule lives in C#, not in the prompt, and has a test that fails if the check is removed
- Agent built on Microsoft.Extensions.AI IChatClient: Gemini (free tier) or Claude by configuration, a scripted fake model in tests
- The evals caught a real bug: on the customer's "yes" the model re-proposed and confirmed in the same turn, the server rejected it, and the model still told the customer it was booked. Fixed by putting the pending proposal in each turn's prompt
- WhatsApp webhook validates X-Hub-Signature-256, deduplicates retries with a unique index and processes through a Channel<T> + BackgroundService
- LLM cost caps: per-number and per-IP rate limits, a daily cap for the public demo, max 6 tool calls per message
More highlights (2)
- Public demo page prints a receipt of every tool call the agent made, including the ones the server rejected
- Tests run against real SQL Server via Testcontainers in GitHub Actions, plus 13 scripted evals against the real model graded by database state