Muhammad Ahmad Faizan
Back to all work
Voice AI

Clinic Voice Agent — AI Phone Receptionist

A voice AI that answers a clinic’s phone, checks availability and books or cancels appointments, backed by a fast FastAPI tool router.

Tool calls answered in under 3 seconds (target)
FastAPIPythonVapiGroqn8nGoogle Calendar
Clinic Voice Agent — AI Phone Receptionist preview

Overview

A voice agent for a medical or dental clinic. Callers talk to an AI receptionist on Vapi; when the conversation needs an action — check availability, book, cancel — the LLM calls a tool, and this FastAPI backend validates the request, performs it through n8n and Google Calendar, and replies in the exact format Vapi expects.

The Problem

Small clinics miss calls during busy hours and after closing, and every missed call can be a lost patient. Hiring more reception staff is expensive, and simple phone menus frustrate callers.

Solution

Vapi handles speech and conversation using Groq-hosted Llama 3.1. A FastAPI tool router receives each tool call, validates the parameters, forwards the action to an n8n webhook connected to Google Calendar and notifications, and responds quickly so the conversation never stalls. Every booking decision is logged as structured JSON.

Architecture

Clinic Voice Agent — Architecture Caller phone Vapi voice agent Groq Llama 3.1 FastAPI tool router validate · decide Decision log JSON lines n8n webhook Google Calendar availability · booking SMS / email confirmations

Key Features

  • →Natural phone conversations for booking, rescheduling and cancelling
  • →Typed request/response models matching Vapi’s tool-call format
  • →Single intent-based booking endpoint that decides the right action
  • →Structured decision logging and a simple dashboard
  • →Environment-driven configuration with pydantic-settings

Tech Stack

PythonFastAPIPydanticVapiGroqn8nGoogle Calendar API

Key Decisions & Challenges

Latency in a live conversation

A caller notices any pause. The router does minimal work on the request path and forwards actions straight to n8n, targeting a full tool response in under 2–3 seconds.

Unreliable LLM tool arguments

The voice LLM sometimes sends incomplete or malformed parameters. Every tool call is validated against Pydantic models and gets a clear error the agent can recover from in conversation.

Testing & Quality

  • ✓Pydantic validation on every tool payload
  • ✓Health endpoint and structured logs for monitoring

Lessons Learned

  • →Voice AI is mostly a latency problem — keep the request path short
  • →Logging every decision makes voice conversations debuggable

Results

A working demo that books, checks and cancels appointments by phone end to end. It is a portfolio demo, intentionally lean, and not a HIPAA-compliant production system.

What I'd Do Differently

  • ↻Add recorded test calls as regression tests for the booking flow

Related Projects

Need something similar?

I can build a system like this for your business — tell me what you need and I'll reply with a plan and a quote.