A voice receptionist for a clinic
For engineers
Scenario lesson and practice set combining Realtime voice agents, AI in clinical work, Health and sensitive data and Human in the loop. Completing it counts as evidence for every listed skill.
A phone receptionist that talks to patients is four problems at once: a live voice product, a health-care service, a pile of sensitive data and an agent that can change a schedule. Each one is manageable. The mistakes come from solving only one of them.
The case
Lakeside Family Clinic gets about the same calls every day: book, move or cancel a visit, ask about opening hours, request a refill, and now and then say something worrying. Front-desk staff are tied up and callers wait. The clinic wants a voice agent, built on a realtime model, to answer first. Staff stay in charge of anything clinical.
Why it matters
A voice agent is judged in real time by a person who may be unwell, in a hurry or hard of hearing. A cut-off sentence, a wrong appointment or a cheerful "it sounds like reflux" is not a UX bug. It can delay care or expose a patient's data. The clinic is also liable for what its vendor does with call audio.
How the pieces fit
Voice. Decide first whether to use a speech-to-speech model or a chain of speech-to-text, a language model and text-to-speech. The native model is often faster and more natural. The chain gives you exact scripted text, a clean transcript and the freedom to swap one stage. A clinic that must read a fixed greeting and keep transcripts usually values control over speed. The browser call button connects through a short-lived token minted by your server, never through a long-lived API key in page code.
Callers read out dates of birth and phone numbers with pauses. Tune turn detection so slow speakers are not cut off, and use end-of-turn detection that judges whether a sentence is complete. When a caller interrupts, stop playback and trim the stored reply to what they actually heard. Before any tool with a side effect, such as cancelling, read the details back and wait for a clear yes. Cover tool delays with a short filler phrase.
Clinical line. Booking and hours are administrative. Symptom assessment, diagnosis hints and dosing advice are clinical, and software that does them can be a regulated medical device. Keep the agent on the administrative side and write that boundary into its instructions and its tests. Validate it on the callers the clinic really serves, split by language, accent and line quality, and keep watching after go-live. A good overall rate can hide a group that fails.
Sensitive data. A patient's name with a clinic and a time is health information. In the US, a vendor that handles it for the clinic is a business associate and needs a signed agreement before audio is sent. In the EU, health data is special-category data under GDPR Article 9 and needs a legal basis. Voiceprints used to identify callers are biometric data with extra consent rules, so verify with details plus a call-back instead. Store only what you need: no audio unless you can say why, masked identifiers in logs, and a retention limit.
Human in the loop. Sort every tool by risk. Reading hours runs freely. Cancelling needs the caller's confirmation. Releasing a refill needs a nurse. Deleting a record is blocked. Escalation rules are policy, not mood: words suggesting a possible emergency stop the booking and send the caller to emergency services, whatever the model's confidence. When the agent hands over to staff, the summary says what was verified, what was promised and what is open. When a nurse must approve, the prompt shows who, which drug and which dose. A button that says "Approve all 14" is a rubber stamp. Every action logs the state before and after so a mistake can be undone.
Before and after
Before: one realtime session, the provider key in the page, a log with names and audio kept for a year, and a refill sent straight to the pharmacy queue. The agent tells a worried caller their symptoms are probably minor.
After: a scripted greeting, a server-minted token, masked 90-day transcripts, a nurse approval that shows the drug and dose, and a hard rule that chest pain ends the booking flow with an emergency instruction.
What goes wrong
- Teams tune the voice and forget the compliance paperwork, so audio flows to a vendor with no agreement.
- A strong demo with staff voices hides failures on accents and phone noise.
- Approval prompts without details are clicked through, so the gate protects nobody.
- A handoff summary that says "verified" when it was not lets staff reveal private details.
Work through the steps below in order. Each one is the point where a different skill decides what happens next.
Steps
Choose the voice architecture
Pick a chained pipeline when the clinic needs a fixed greeting, word-for-word transcripts and the freedom to change one stage. Pick a speech-to-speech model when natural, fast conversation matters more than step-level control. Connect the browser with a short-lived token from your server, never with a long-lived API key in page code.
Architecture comparison for the clinic Need Chained pipeline Speech-to-speech Fixed legal greeting Exact text played verbatim Needs a scripted first turn Transcript for disputes First-class output Side product Swap the language model Replace one stage Replace the whole model Response speed Three hops, slower Often faster Make the call feel natural and safe
Raise the silence window and use end-of-turn detection so callers reading digits are not cut off. On barge-in, stop playback and trim stored history to what the caller heard. Read back booking details and wait for a clear yes before cancelling or moving a slot. Speak a short filler while a tool runs.
Draw the clinical line
List what the agent may do (book, move, cancel, give opening hours) and what it may not (assess symptoms, suggest a diagnosis, advise on doses). Test the boundary with worried-caller scripts. Validate the tool on the clinic's own callers, split by language, accent and line quality, and monitor the same splits after go-live.
Protect the data
Before any audio leaves the clinic, sign a business associate agreement with the vendor (US) or establish the Article 9 condition (EU). Drop audio storage unless it has a stated purpose, mask identifiers in logs, and set a retention limit. Verify callers with details and a call-back, not a voiceprint, unless there is explicit consent and an alternative.
Minimal logging configuration recording.yaml
store_audio: falsestore_transcript: truetranscript_retention_days: 90mask_fields: [caller_name, date_of_birth, phone]vendor_training_opt_in: falseGate the actions
Classify each tool: free, confirm with caller, nurse approval or blocked. A refill is released by a clinician, never by the agent. Write the emergency-symptom rule as a policy trigger that ends the booking flow and tells the caller to contact emergency services.
Escalation and approval policy - Read-only tools about public information run freely.
- Cancelling or moving a slot requires a read-back and a clear yes from the verified caller.
- Refill requests are queued as pending and released only by a nurse.
- Any mention of chest pain, trouble breathing, stroke signs or thoughts of self-harm stops the booking flow and directs the caller to emergency services.
- Record deletion is never available to the agent.
Hand over, approve and audit
The handoff summary states what was verified (including failed checks), what was offered and what is open. The nurse's approval prompt shows patient, drug, dose and what the agent checked, with no approve-all button. Every action records the state before and after so staff can undo it, and a paused refill resumes from saved state without sending twice.
Skills this scenario uses
Where to study
- Realtime API guide (OpenAI API) (opens in a new tab)DocsFree
Session setup, transports, turn detection and tool calls for speech-to-speech agents.
- LiveKit Agents documentation (opens in a new tab)DocsFree
A framework for building voice agents with chained or realtime models, turn detection and interruption handling.
- Pipecat documentation (opens in a new tab)DocsFree
An open-source framework for assembling voice pipelines from speech, language and audio components.
- Clinical decision support software guidance (FDA) (opens in a new tab)DocsFree
The criteria for when clinical decision support software is a regulated device.
- 45 CFR Part 164: HIPAA Privacy, Security and Breach Notification Rules (eCFR) (opens in a new tab)StandardFreeUS
The rule text on business associate contracts and de-identification.
- GDPR Article 9: special categories of personal data (opens in a new tab)DocsFreeEU
Health and biometric data, and the conditions that allow processing them.
- LangGraph: human-in-the-loop concepts (opens in a new tab)DocsFree
How interrupts and persisted state let an agent wait for a person and resume.
- NIST SP 800-66 Rev. 2: Implementing the HIPAA Security Rule (opens in a new tab)DocsFreeUS
Practical safeguards for systems holding health data.