Dev.to AI 🤖 Ai 👁 0 📖 16 min read

Why AI Voice Agents Are Becoming a Hot Investment in Healthcare

How to Build a Healthcare AI Voice Agent: Architecture, EHR Integration, and HIPAA Challenges A technical breakdown of real-time voice processing, automated appointment scheduling, patient data security, and the engine

How to Build a Healthcare AI Voice Agent: Architecture, EHR Integration, and HIPAA Challenges

A technical breakdown of real-time voice processing, automated appointment scheduling, patient data security, and the engineering challenges behind production-ready healthcare AI agents.

Building an AI voice agent that answers a phone call is relatively straightforward.

Building one that can understand a patient, check a doctor's availability, book an appointment, update the hospital's system, and handle unexpected situations without compromising patient safety is a completely different engineering problem.

According to Invoca's 2026 Healthcare Lead Conversion Benchmarks, only 54% of healthcare calls are answered by a person.

That doesn't mean every remaining caller is lost. Some calls may reach automated systems or voicemail. But it highlights a significant opportunity for improving how healthcare organizations handle incoming calls.

This is one reason healthcare-focused voice AI platforms are attracting attention.

Companies like Assort Health, Prosper AI, and Hippocratic AI are exploring different applications, from appointment scheduling and patient administration to post-discharge follow-ups.

For developers, however, the interesting part isn't how naturally these systems can speak.

It's how they work behind the conversation.

A reliable healthcare voice agent requires real-time audio streaming, speech recognition, conversation management, secure integrations, deterministic workflows, and carefully designed human escalation.

Let's break down how we can approach building such a system.

The architecture and code examples in this article are illustrative implementation patterns, not the internal implementations of the companies mentioned.

1. Understanding the Architecture of a Healthcare Voice Agent

A traditional chatbot follows a relatively simple request-response model.

The user types a message, the application sends it to an AI model, and the model generates a response.

Voice applications introduce several additional problems.

The system must handle streaming audio while keeping the conversation responsive. Patients may speak over the agent, change their requests halfway through a sentence, or provide incomplete information.

Consider this conversation:

Patient: "I'd like to see Dr. Smith tomorrow morning."

Agent: "I found an appointment at 10:30 AM."

Patient: "Actually, could you make that Friday? And I need to check if my insurance covers it."

The agent now needs to maintain conversational state, update the scheduling request, retrieve new availability, and possibly initiate an insurance eligibility workflow.

Generating a natural-language response is only one part of that process.

A reference system architecture

              INCOMING CALL
                    |
             Telephony Provider
                    |
             WebSocket Gateway
                    |
            Audio Stream Handler
                    |
           Speech Recognition
                    |
            Conversation Engine
             /       |        \
            /        |         \
   Safety Rules   LLM Engine   Session State
            \        |         /
             \       |        /
              Tool Orchestrator
                    |
       +------------+------------+
       |            |            |
  Scheduling     Insurance    Human
   Service       Service      Handoff
       |            |
       +------------+
                    |
             EHR Integration
                    |
              Hospital System

      Response Generation + TTS
                    |
              Audio Playback
                    |
                 PATIENT

Each component addresses a different engineering responsibility.

The telephony layer establishes the call.

The speech recognition layer converts audio into text.

The conversation engine determines what the patient is trying to accomplish.

The orchestration layer executes approved actions through backend services.

Finally, text-to-speech (TTS) converts the response into audio.

The important design principle is to separate conversation generation from operational execution.

The AI model can interpret patient requests, but backend services should control what actions are actually permitted.

2. Building a Real-Time Voice Processing Pipeline

One of the first architectural decisions involves handling audio.

There are two common approaches.

Approach A: Speech-to-Text → LLM → Text-to-Speech

Patient Speech
      |
 Streaming STT
      |
  Text Input
      |
     LLM
      |
 Text Response
      |
 Streaming TTS
      |
 Spoken Response

This pipeline gives developers explicit access to transcribed text, which can help with structured intent extraction and debugging.

However, each processing stage introduces latency.

Approach B: Real-Time Speech-to-Speech

An alternative is a real-time multimodal model capable of receiving and generating audio directly.

This can simplify parts of the pipeline and potentially improve conversational responsiveness.

However, the application still needs a separate layer for tool authorization, workflow validation, auditability, and safety controls.

In healthcare, a natural-sounding conversation is not enough. The system must produce operationally correct outcomes.

Connecting the phone call to the AI

A telephony platform such as Twilio can stream call audio to an application using WebSockets.

For example, Twilio supports bidirectional Media Streams through its <Connect><Stream> mechanism.

A simplified connection configuration looks like this:

<Response>
  <Connect>
    <Stream
      url="wss://voice.example.com/media"
    />
  </Connect>
</Response>

The application receives audio events over the WebSocket connection and sends supported audio messages back for playback.

Twilio's Media Streams documentation describes the underlying streaming capabilities.

A production implementation also needs to validate incoming connections, support the provider's audio protocol, manage active sessions, and recover from stream interruptions.

Handling conversational latency

Latency has a direct impact on user experience.

If the agent takes several seconds to answer every question, the call quickly becomes frustrating.

Engineers should measure several separate components:

Component What to measure
Speech recognition Delay between speech and usable transcription
Model processing Time to generate the first useful response
Tool execution Latency of scheduling and EHR requests
Speech synthesis Time until generated audio can begin playing
Overall response Time between the caller finishing and hearing the agent

Instead of optimizing only average latency, measure p95 and p99 response times.

It's also important to support barge-in, where the caller interrupts the agent while it is speaking.

When that happens, the system may need to stop outgoing audio, cancel a pending response, and process the new input without losing the current conversation context.

This is one reason voice applications require more careful state management than ordinary text chatbots.

3. Why Conversation State Should Not Live Only in the LLM

A common approach when building early AI agents is to send the entire conversation history to an LLM and ask it what to do next.

That may work in a prototype.

But healthcare workflows should not rely entirely on a language model remembering which steps have been completed.

Consider an appointment scheduling flow.

GREETING
    |
IDENTIFY INTENT
    |
SAFETY SCREENING
    |
VERIFY IDENTITY (if required)
    |
COLLECT BOOKING DETAILS
    |
FETCH AVAILABLE SLOTS
    |
CONFIRM PATIENT SELECTION
    |
BOOK APPOINTMENT
    |
VERIFY BOOKING RESULT
    |
SEND CONFIRMATION

The application should track these steps explicitly.

A simple TypeScript state model might look like:

type CallState =
  | "greeting"
  | "intent_detection"
  | "identity_verification"
  | "collecting_details"
  | "checking_availability"
  | "confirming_booking"
  | "booking"
  | "completed"
  | "human_handoff";

interface VoiceSession {
  sessionId: string;
  state: CallState;
  verifiedPatientId?: string;
  selectedSlotId?: string;
  appointmentId?: string;
}

The LLM can help interpret the patient's language and propose the next action.

But a workflow controller should validate whether the requested transition is permitted.

For example:

  • The agent should not disclose protected patient information before completing the required identity-verification process.
  • It should not book an appointment before the patient confirms the selected time.
  • It should not claim that a booking succeeded before the scheduling system confirms it.

These rules belong in application logic, not just in a system prompt.

Use the LLM for understanding language. Use deterministic code for enforcing workflow rules.

4. Connecting Voice Agents to EHR Systems

This is where healthcare voice AI becomes significantly more complex than a general-purpose customer support bot.

A voice agent isn't particularly useful if it can only tell a patient:

"Someone from the clinic will call you back to complete your appointment."

The real operational value comes from connecting the conversation to the clinic's existing systems.

That might include:

  • Electronic health records (EHRs).
  • Practice management systems.
  • Appointment scheduling platforms.
  • Insurance eligibility services.
  • Patient communication systems.

Healthcare organizations may use platforms such as Epic, Oracle Health/Cerner, or athenahealth.

But these systems don't all expose identical APIs or permit the same operations.

Understanding FHIR

FHIR, or Fast Healthcare Interoperability Resources, provides standardized resources for exchanging healthcare information.

For scheduling-related workflows, relevant resources can include:

FHIR resource Purpose
Patient Patient identity and demographic information
Practitioner Healthcare professionals
Schedule Availability associated with services or resources
Slot Individual scheduling intervals
Appointment Scheduling details and appointment status

These resources are defined in the HL7 FHIR specification.

FHIR provides a common data model, but it does not guarantee that every EHR supports appointment booking through a public write API.

In practice, scheduling integration may require proprietary APIs, HL7 interfaces, vendor-specific workflows, or integrations through a practice management system.

Use an adapter layer

Instead of allowing the AI agent to communicate directly with each EHR, create an integration boundary.

       Voice Agent
            |
       Tool Controller
            |
     Scheduling Interface
            |
       EHR Adapters
       /     |      \
      /      |       \
   Epic   Oracle    Other
 Adapter  Health    System
          Adapter   Adapter

The conversation engine should call an internal operation such as:

interface BookingRequest {
  requestId: string;
  verifiedPatientId: string;
  practitionerId: string;
  slotId: string;
}

interface SchedulingAdapter {
  bookAppointment(
    request: BookingRequest
  ): Promise<{
    status: "confirmed" | "pending" | "rejected";
    appointmentId?: string;
  }>;
}

The adapter handles the vendor-specific integration.

This also helps isolate business rules from external APIs.

Preventing duplicate appointments

Imagine the patient confirms a booking, but the network connection times out.

The agent doesn't know whether the hospital system completed the operation.

If it simply retries, the patient could receive two appointments.

The booking layer should use an idempotency key and implement duplicate protection wherever the underlying system supports it.

If the EHR doesn't provide idempotent booking operations, the adapter needs a reconciliation strategy.

For example:

async function confirmBooking(
  request: BookingRequest
) {
  const result =
    await schedulingAdapter.bookAppointment(
      request
    );

  if (result.status === "confirmed") {
    return {
      success: true,
      appointmentId: result.appointmentId
    };
  }

  return {
    success: false,
    requiresFollowUp: true
  };
}

This is intentionally simplified. A production workflow also needs authorization, durable request tracking, concurrency control, timeout handling, and verification of ambiguous booking results.

The important point is that a successful conversation is not the same thing as a successful database operation.

Never tell a patient that an appointment is confirmed until the authoritative scheduling system establishes that result.

5. Designing Reliable Insurance Verification

Insurance eligibility is another valuable use case for healthcare voice agents.

But it introduces additional complexity.

The patient may provide a payer name, member ID, and other identifying details.

The application must validate those details before submitting an eligibility request to an authorized payer integration.

A simplified flow looks like this:

Patient Provides Insurance Information
                |
       Verify Patient Identity
                |
        Validate Input Data
                |
      Insurance Eligibility API
                |
        Normalize Response
                |
      Apply Business Rules
                |
      Explain Verified Result

An important distinction is that insurance eligibility does not necessarily guarantee payment or establish an exact final patient responsibility.

Coverage can depend on plan terms, service type, deductibles, authorization requirements, and claim processing.

Therefore, a voice agent should not generate an exact copay merely because a language model thinks one is likely.

It should only communicate values supported by an authoritative response, with appropriate qualifications.

When eligibility information is unavailable or uncertain, the workflow should route the issue to billing staff rather than invent an answer.

This is a recurring principle in healthcare AI development:

The model can explain verified information, but it should not manufacture operational facts.

6. HIPAA Compliance Is an Architectural Requirement

Healthcare voice agents may process protected health information (PHI), including patient names, appointment details, symptoms, insurance information, and other sensitive data.

That makes privacy and security foundational system requirements.

HIPAA compliance is not achieved simply by enabling encryption or using a cloud provider that advertises healthcare support.

The applicable requirements depend on the organization, its role, its vendors, and how PHI is processed.

The U.S. Department of Health and Human Services explains that cloud service providers handling electronic PHI on behalf of covered entities or business associates generally require appropriate Business Associate Agreements (BAAs).

That matters because a healthcare voice application can involve multiple vendors.

For example:

             Patient Voice
                  |
           Telephony Provider
                  |
        Speech Processing Vendor
                  |
              AI Model
                  |
          Application Backend
                  |
              EHR System

Each component needs to be reviewed for its role in receiving, transmitting, storing, or processing PHI.

A suitable architecture should account for several safeguards.

Encrypt sensitive information

Protect data in transit and at rest using appropriate security controls.

Encryption is important, but it is only one part of a broader security program.

Limit access to patient information

Use role-based authorization, narrowly scoped credentials, and appropriate patient identity verification.

A call originating from a patient's known phone number should not automatically be treated as proof of identity.

Minimize stored data

Not every conversation requires permanent audio recording or full transcript retention.

Consider whether the workflow can operate with structured outcomes such as:

{
  "callId": "call_82a",
  "intent": "appointment_booking",
  "outcome": "completed",
  "durationSeconds": 145
}

This record intentionally avoids patient details, but other session data and associated identifiers may still be regulated or sensitive.

If audio or transcripts need to be retained, define access controls, retention periods, deletion policies, and permitted uses.

Keep sensitive content out of logs

Debug logs can easily become an unexpected repository of PHI.

Avoid recording raw transcripts, authentication tokens, insurance member IDs, or medical details in ordinary application logs.

Use structured operational events and carefully controlled audit records instead.

Protect communications

Sending a confirmation SMS may be useful, but the message content and delivery mechanism should follow the healthcare organization's communication policies, patient preferences, and applicable privacy requirements.

Redaction can reduce exposure, but it does not automatically make a system HIPAA compliant.

Privacy controls need to cover the entire data lifecycle, not only what reaches the database.

7. Building a Reliable Human Escalation System

Not every patient request should be completed by an AI agent.

This is especially important in healthcare.

A patient may begin a call by asking for an appointment and then mention symptoms suggesting an urgent medical situation.

The system needs a way to interrupt normal workflows and initiate an approved escalation process.

Keep safety rules outside the LLM

A basic safety layer might look like this:

type RoutingDecision =
  | "continue"
  | "human_handoff"
  | "emergency_protocol";

async function routePatientMessage(
  message: string
): Promise<RoutingDecision> {
  const result = await safetyService.evaluate(
    message
  );

  if (result.emergencyConcern) {
    return "emergency_protocol";
  }

  if (result.requiresHumanReview) {
    return "human_handoff";
  }

  return "continue";
}

This code illustrates the routing boundary, not a clinically validated emergency detector.

A production system needs clinician-approved protocols, tested detection methods, conservative escalation rules, and monitoring for missed high-risk situations.

Keyword matching alone is inadequate, and an LLM classifier should not be treated as a reliable medical triage system without rigorous validation.

The escalation workflow

           Patient Statement
                   |
             Safety Screening
                   |
          +--------+--------+
          |                 |
      Routine            Concern
          |                 |
    Continue Flow     Escalation Logic
                            |
                  +---------+---------+
                  |                   |
              Emergency         Staff Review
                  |                   |
          Emergency Protocol    Human Transfer

For a U.S. healthcare deployment, an emergency protocol might direct someone with a potentially life-threatening emergency to contact 911 immediately.

The precise language and workflow should be established with the healthcare organization.

A voice agent should not attempt to diagnose the patient or provide unsupported reassurance while deciding whether to escalate.

What if the human transfer fails?

This is an important failure scenario.

A clinic may not have an available nurse at midnight.

A transfer could fail because the destination number is busy or unavailable.

The system needs predefined fallback behavior rather than repeatedly attempting transfers while the patient waits.

Possible fallback actions include an approved emergency instruction, an alternate staffed line, or a documented callback workflow for non-emergency cases.

Escalation isn't just a conversational feature.

It's an operational system that needs its own reliability testing.

8. Handling Failures in a Production Voice System

Voice agents depend on several services working together.

A successful call might involve the telephony provider, streaming connection, speech model, conversation model, EHR API, and messaging provider.

Each dependency introduces failure scenarios.

Failure scenario Recommended behavior
Speech recognition cannot understand a patient Ask for clarification, then offer human assistance
EHR API times out Check for an ambiguous result before retrying; avoid claiming a successful booking
AI model becomes unavailable Route to a controlled fallback or human-operated workflow
WebSocket disconnects End or recover the session safely according to call state
Insurance API returns incomplete data Explain the limitation and refer to billing staff
Human transfer fails Follow the clinic's approved fallback protocol

For non-critical processing, background queues can improve system resilience.

Examples include sending confirmation messages, generating operational analytics, and performing post-call reporting.

        Appointment Confirmed
                 |
             Event Queue
                 |
       +---------+----------+
       |                    |
  Notification         Analytics
     Worker              Worker
       |                    |
  SMS / Email         Metrics Store

However, not everything should be asynchronous.

The appointment booking outcome must be established before the agent promises the patient a confirmed appointment.

Notifications can happen later.

This distinction separates the critical transaction path from supporting background work.

The core patient workflow should not depend on unrelated analytics services being available.

9. Measuring Whether the Voice Agent Actually Works

Traditional AI benchmarks focus on model quality, reasoning ability, and language understanding.

A healthcare voice agent needs operational metrics as well.

A system may sound convincing but still fail to book appointments correctly.

That's why production monitoring should cover several categories.

Conversational performance

Measure:

  • Time to first audio response.
  • End-to-end response latency.
  • Speech recognition failures.
  • Repeated clarification requests.
  • Unexpected call disconnections.

Workflow reliability

Measure:

  • Successfully confirmed appointments.
  • Failed or ambiguous scheduling operations.
  • Duplicate booking incidents.
  • Insurance verification errors.
  • Human handoff completion rates.

Safety and quality

Measure:

  • Missed escalation scenarios in controlled evaluations.
  • Unnecessary escalations.
  • Incorrect statements about appointment status.
  • Unauthorized attempts to retrieve patient information.
  • Privacy-related incidents and access-control failures.

One common metric is the containment rate, or the percentage of calls completed without human assistance.

But higher containment is not always better.

A healthcare agent that correctly transfers a concerning call to a nurse may be performing exactly as intended.

A system that keeps the caller engaged with AI instead of escalating could produce a higher containment rate while providing a less safe service.

For this reason, quality and safety should be evaluated alongside automation rates.

Test with realistic scenarios

Before a pilot, create a controlled test suite using synthetic patient data.

Useful scenarios include:

  1. A patient books an available appointment.
  2. A patient changes their requested time during the call.
  3. Two callers attempt to reserve the same slot.
  4. The EHR becomes unavailable after a booking request.
  5. A patient requests information without completing identity verification.
  6. A patient introduces a potentially urgent symptom.
  7. A caller repeatedly interrupts the AI.
  8. A human transfer fails outside business hours.

Run these tests against the complete call workflow, not only the LLM.

That includes streaming audio, backend tools, error handling, and actual integration responses in an appropriately isolated test environment.

10. How to Build a Healthcare Voice AI MVP Without Overengineering

A common development mistake is attempting to automate every front-desk workflow immediately.

Scheduling, insurance verification, billing, referrals, clinical inquiries, and outbound follow-up calls all have different dependencies and risk profiles.

A more practical MVP can be introduced in phases.

Phase 1: Call answering and intelligent routing

Start with low-risk administrative capabilities:

  • Answer calls during and outside business hours.
  • Provide verified clinic hours and location information.
  • Recognize general administrative intent.
  • Route callers to appropriate staff.
  • Apply safety escalation protocols.

This phase helps validate telephony reliability, transcription quality, and conversational experience.

Phase 2: Appointment scheduling

Introduce a controlled scheduling integration.

Start with a limited set of appointment types and providers.

Add patient verification, availability lookup, explicit confirmation, duplicate prevention, and reliable booking outcomes.

Phase 3: More complex administrative workflows

Once the foundational system is stable, expand to capabilities such as:

  • Insurance eligibility checks.
  • Appointment rescheduling.
  • Referral routing.
  • Approved follow-up communication.
  • Billing-related inquiries.

These features should be introduced only after the relevant integrations, permissions, operational policies, and exception handling are ready.

This incremental approach makes it easier to measure actual value without exposing patients and staff to unnecessary complexity.

11. The Biggest Engineering Lesson: Treat AI as an Interface, Not the System of Record

The most useful way to think about healthcare voice AI is not as a replacement for a receptionist.

It's as a conversational interface to a collection of controlled healthcare workflows.

The language model is responsible for understanding natural speech and communicating clearly.

The application backend is responsible for identity verification, authorization, workflow state, and tool execution.

The EHR or practice management system remains the authoritative source for patient and appointment information.

Human staff remain responsible for decisions that require professional judgment, clinical expertise, or escalation.

That separation creates a much more dependable architecture.

        NATURAL LANGUAGE
               |
          AI Voice Layer
               |
       Workflow Controller
               |
       Authorized Services
               |
      Healthcare Systems
               |
        Verified Outcome

At EnactOn, this is the architectural perspective we bring to AI-powered workflow automation: connect intelligent interfaces to dependable systems, rather than treating the language model itself as the entire application.

The long-term value of healthcare voice AI will not come from making agents sound indistinguishable from humans.

It will come from making them reliable enough to handle clearly defined administrative workflows while knowing exactly when to involve a human.

For developers, that means investing as much effort in integrations, security, observability, and failure handling as in the AI conversation itself.

Because in healthcare, a convincing response isn't enough.

The system has to get the underlying action right.

Further reading

  • Invoca — 2026 Healthcare Lead Conversion Benchmarks
  • Twilio — Media Streams Documentation
  • HL7 — FHIR Appointment Resource
  • SMART on FHIR — Backend Authorization
  • HHS — Guidance on HIPAA and Cloud Computing
  • HealthIT.gov — Hospital EHR API Integration Research

What do you think is the hardest part of building production-ready healthcare voice agents: real-time latency, EHR interoperability, data privacy, or reliable human escalation?

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.