Back to work
Voice AIHealthcareMulti-tenantProduction

VoiceOps —
physician outreach voice agent

A production voice agent system that calls physician offices on behalf of a medical supply provider, walks through a structured 7-stage conversation, and captures the documents needed to fulfill a patient order.

VOICEOPS · VOICE AGENT SYSTEM SIGNALWIRE · FASTAPI · POSTGRES · S3 · ECS
SectorHealthcare · US client
RoleVoice AI Engineer
Timeline~8 weeks
StatusLive in production

01The problem

The client processes medical supply orders for patients in the US. Before a single order can be shipped, the company has to call the prescribing physician's office and collect several supporting documents — a prescription, a face-to-face notes form, a sleep study report, and so on. Different products need different documents.

Staff were spending most of their day dialling clinics, navigating phone trees, leaving voicemails and chasing faxes. The work was repetitive, error-prone, and didn't scale with the order volume. They wanted an AI agent that could make those calls consistently and write back a clean, structured outcome for every call.

02What I built

A multi-tenant voice agent service with a purpose-built operator dashboard and a FastAPI backend. An operator uploads a CSV of orders, picks one, and clicks Call. The agent dials the physician's office through SignalWire, runs a strict 7-stage conversation, records the call, transcribes it, and writes a CallOutcome row that downstream systems can act on.

Each tenant has its own SignalWire credentials, its own caller ID, its own document list, and its own data — isolated from the other clinics on the platform.

03The conversation flow

The agent isn't a "freestyle" chatbot. It follows a 7-stage script with explicit guards at each step — if a stage doesn't pass, the agent re-asks or escalates rather than guessing forward. The flow:

  • Greeting & physician verification — identify the caller and confirm we have the right office.
  • Patient identity confirmation — verify the patient is in their records.
  • Order summary — explain the order and the product on a few short lines.
  • Document need — explain why each document is required.
  • Per-document request — ask for each document one at a time and log confirm / decline.
  • Receipt method — capture fax / email / patient portal preference.
  • Professional close — thank, give callback info, hang up.

04Architecture

Clean architecture with SOLID-friendly layering. The system is built around several patterns so the same codebase can be reused for new outbound use cases without rewriting the conversation engine.

Repository patternData-access abstraction over orders, outcomes, transcripts.
Service layerBusiness logic isolated from frameworks and storage.
Strategy patternSwappable storage — SQLite for dev, Postgres for prod.
Template methodBase agent class; per-use-case agents override stages.
Factory + DI containerWires services, repositories and the agent at boot.
Polling fallbackIf a webhook is missed, a poller catches the call within 5 min.

05Reliability — recordings & transcripts

For a healthcare workflow, "we didn't get the recording" is not an acceptable failure. Two layers of redundancy:

  • Webhooks first — SignalWire posts recording and transcript URLs to FastAPI endpoints.
  • Polling fallback — a background service polls for any call that didn't deliver a webhook within 5 minutes and pulls the artifacts itself.
  • Exponential backoff downloads — up to 10 retries with widening delays for any flaky download.
  • Dual-format output — JSON transcript for downstream automation, plain text for humans.

06The structured outcome

Every completed call writes a CallOutcome row that downstream tools consume directly. No "read the transcript and figure it out." The outcome captures: physician verification status, patient confirmation status, per-document confirmed / declined flags, receipt method and contact details, callback need, stage completion, and operator notes.

The same shape feeds the operator dashboard's call-history view and the JSON exports that flow into the client's order management system.

07Deployment

Production runs on AWS ECS Fargate behind an Application Load Balancer. Postgres on RDS, recordings and transcripts on S3, Redis cache in front of the hottest reads. Containers auto-scale on CPU and memory. Secrets in AWS Secrets Manager, logs and metrics in CloudWatch.

PythonFastAPISignalWire OpenAINext.jsPostgreSQL RedisDockerAWS ECS S3RDSCloudWatch

08Outcome

The agent now handles the bulk of routine physician-outreach calls without a human on the line. Operators are involved on the exceptions — calls that need escalation, unclear records, repeat callbacks — which is where their judgement actually adds value.

The structured outcome flowing into the order system means orders that used to wait days for paperwork are now actionable as soon as the call ends.

Need a voice agent that actually ships?

muhammadanask880@gmail.com