Work public

voice-agent

AI phone agent for medical practices. Appointment booking, emergency detection, call routing. 156 tests, deployed on Fly.io. Python and Vapi.

  • voice
  • agents
  • healthcare
  • fly-io
  • python
  • vapi
  • fastapi
Repo
github.com/mj-deving/voice-agent
Published
2026-05-26

The problem

Medical practices field hundreds of inbound calls a day. Most are appointment requests. Some are emergencies. The cost of getting the second category wrong is human.

A voice agent that handles the first ninety percent has to do two things well. It has to fail safely on the last ten percent. Failing safely means recognizing the call is outside its competence and routing it to a human fast, without making the caller repeat themselves.

How it works

The agent runs on Vapi for the voice layer. The control loop is a FastAPI service that holds appointment state, runs emergency-keyword detection on transcribed turns, and decides routing in real time. A confidence threshold below the answer floor triggers a hot-warm handoff to a human line with the conversation context attached.

The test suite is 156 tests. The emergency-detection path has its own adversarial test cases derived from real distress phrasing in three languages. Deployment runs on Fly.io with regional pinning for latency and data residency.

Stack

Python, FastAPI, Vapi, deployed on Fly.io. Production-realistic: the system is built to fail safely first and to perform well second.